From 3343938d8c54d6b5f7aa9fd47e84a9368b86efd9 Mon Sep 17 00:00:00 2001 From: Sruthi Chandran Date: Sun, 12 Jan 2020 00:16:45 +0530 Subject: [PATCH] New upstream version 12.6.3 --- CHANGELOG-EE.md | 12 ++++ CHANGELOG.md | 20 +++++++ GITALY_SERVER_VERSION | 2 +- Gemfile | 2 +- Gemfile.lock | 8 +-- VERSION | 2 +- .../knative_serving_namespace_finder.rb | 25 -------- .../knative_version_role_binding_finder.rb | 17 ------ app/models/project.rb | 2 +- app/presenters/release_presenter.rb | 2 +- .../ci/find_exposed_artifacts_service.rb | 2 + .../clusters/aws/provision_service.rb | 3 +- app/services/clusters/kubernetes.rb | 3 - ...reate_or_update_service_account_service.rb | 41 ------------- config/application.rb | 4 ++ config/initializers/7_prometheus_metrics.rb | 6 ++ core-js/LICENSE | 2 +- core-js/es/regexp/test.js | 1 + core-js/es/string/index.js | 1 + core-js/es/string/match.js | 1 + core-js/es/string/replace.js | 1 + core-js/es/string/search.js | 1 + core-js/es/string/split.js | 1 + core-js/es/symbol/async-iterator.js | 2 +- core-js/es/symbol/has-instance.js | 2 +- core-js/es/symbol/is-concat-spreadable.js | 2 +- core-js/es/symbol/iterator.js | 2 +- core-js/es/symbol/match-all.js | 2 +- core-js/es/symbol/match.js | 2 +- core-js/es/symbol/replace.js | 2 +- core-js/es/symbol/search.js | 2 +- core-js/es/symbol/species.js | 2 +- core-js/es/symbol/split.js | 2 +- core-js/es/symbol/to-primitive.js | 2 +- core-js/es/symbol/to-string-tag.js | 2 +- core-js/es/symbol/unscopables.js | 2 +- core-js/features/symbol/async-dispose.js | 2 +- core-js/features/symbol/dispose.js | 2 +- core-js/features/symbol/observable.js | 2 +- core-js/features/symbol/pattern-match.js | 2 +- core-js/features/symbol/replace-all.js | 2 +- core-js/internals/array-buffer-native.js | 1 + core-js/internals/array-buffer-view-core.js | 10 +--- core-js/internals/array-buffer.js | 16 ++++- core-js/internals/array-for-each.js | 8 ++- core-js/internals/array-from.js | 15 +++-- core-js/internals/array-iteration.js | 2 +- core-js/internals/array-last-index-of.js | 9 ++- .../array-method-has-species-support.js | 2 +- ...ay-method.js => array-method-is-strict.js} | 2 +- .../internals/array-method-uses-to-length.js | 30 ++++++++++ ...roxy.js => async-iterator-create-proxy.js} | 0 core-js/internals/collection-from.js | 2 +- core-js/internals/collection-strong.js | 2 +- core-js/internals/define-well-known-symbol.js | 2 +- core-js/internals/descriptors.js | 2 +- .../internals/{is-ios.js => engine-is-ios.js} | 2 +- .../{user-agent.js => engine-user-agent.js} | 0 .../{v8-version.js => engine-v8-version.js} | 2 +- core-js/internals/entry-unbind.js | 2 +- .../fix-regexp-well-known-symbol-logic.js | 22 ++++++- core-js/internals/flatten-into-array.js | 2 +- ...nd-context.js => function-bind-context.js} | 0 core-js/internals/iterate.js | 2 +- ...ator-proxy.js => iterator-create-proxy.js} | 0 core-js/internals/microtask.js | 2 +- .../{parse-float.js => number-parse-float.js} | 8 +-- .../{parse-int.js => number-parse-int.js} | 8 +-- ...s => object-prototype-accessors-forced.js} | 0 core-js/internals/shared.js | 4 +- ...g-html-method.js => string-html-forced.js} | 0 ...ng-pad-bug.js => string-pad-webkit-bug.js} | 2 +- ...o-ascii.js => string-punycode-to-ascii.js} | 0 ...g-trim-method.js => string-trim-forced.js} | 0 core-js/internals/task.js | 4 +- core-js/internals/typed-array-constructor.js | 2 +- ...ed-array-constructors-require-wrappers.js} | 0 core-js/internals/typed-array-from.js | 2 +- ...symbol.js => well-known-symbol-wrapped.js} | 0 core-js/modules/es.array.concat.js | 2 +- core-js/modules/es.array.every.js | 8 ++- core-js/modules/es.array.filter.js | 6 +- core-js/modules/es.array.find-index.js | 5 +- core-js/modules/es.array.find.js | 5 +- core-js/modules/es.array.includes.js | 5 +- core-js/modules/es.array.index-of.js | 8 ++- core-js/modules/es.array.join.js | 6 +- core-js/modules/es.array.map.js | 6 +- core-js/modules/es.array.reduce-right.js | 8 ++- core-js/modules/es.array.reduce.js | 8 ++- core-js/modules/es.array.slice.js | 8 ++- core-js/modules/es.array.some.js | 8 ++- core-js/modules/es.array.sort.js | 6 +- core-js/modules/es.array.splice.js | 6 +- core-js/modules/es.data-view.js | 2 +- core-js/modules/es.number.parse-float.js | 2 +- core-js/modules/es.number.parse-int.js | 2 +- core-js/modules/es.object.define-getter.js | 2 +- core-js/modules/es.object.define-setter.js | 2 +- core-js/modules/es.object.lookup-getter.js | 2 +- core-js/modules/es.object.lookup-setter.js | 2 +- core-js/modules/es.parse-float.js | 2 +- core-js/modules/es.parse-int.js | 2 +- core-js/modules/es.promise.js | 2 +- core-js/modules/es.regexp.test.js | 2 + core-js/modules/es.string.anchor.js | 2 +- core-js/modules/es.string.big.js | 2 +- core-js/modules/es.string.blink.js | 2 +- core-js/modules/es.string.bold.js | 2 +- core-js/modules/es.string.fixed.js | 2 +- core-js/modules/es.string.fontcolor.js | 2 +- core-js/modules/es.string.fontsize.js | 2 +- core-js/modules/es.string.italics.js | 2 +- core-js/modules/es.string.link.js | 2 +- core-js/modules/es.string.pad-end.js | 2 +- core-js/modules/es.string.pad-start.js | 2 +- core-js/modules/es.string.replace.js | 9 ++- core-js/modules/es.string.small.js | 2 +- core-js/modules/es.string.strike.js | 2 +- core-js/modules/es.string.sub.js | 2 +- core-js/modules/es.string.sup.js | 2 +- core-js/modules/es.string.trim-end.js | 2 +- core-js/modules/es.string.trim-start.js | 2 +- core-js/modules/es.string.trim.js | 2 +- core-js/modules/es.symbol.js | 2 +- core-js/modules/es.typed-array.from.js | 2 +- core-js/modules/es.typed-array.of.js | 2 +- .../esnext.async-iterator.as-indexed-pairs.js | 2 +- core-js/modules/esnext.async-iterator.drop.js | 2 +- .../modules/esnext.async-iterator.filter.js | 2 +- .../modules/esnext.async-iterator.flat-map.js | 2 +- core-js/modules/esnext.async-iterator.from.js | 2 +- core-js/modules/esnext.async-iterator.map.js | 2 +- core-js/modules/esnext.async-iterator.take.js | 2 +- .../esnext.iterator.as-indexed-pairs.js | 2 +- core-js/modules/esnext.iterator.drop.js | 2 +- core-js/modules/esnext.iterator.filter.js | 2 +- core-js/modules/esnext.iterator.flat-map.js | 2 +- core-js/modules/esnext.iterator.from.js | 2 +- core-js/modules/esnext.iterator.map.js | 2 +- core-js/modules/esnext.iterator.take.js | 2 +- core-js/modules/esnext.map.every.js | 2 +- core-js/modules/esnext.map.filter.js | 2 +- core-js/modules/esnext.map.find-key.js | 2 +- core-js/modules/esnext.map.find.js | 2 +- core-js/modules/esnext.map.map-keys.js | 2 +- core-js/modules/esnext.map.map-values.js | 2 +- core-js/modules/esnext.map.some.js | 2 +- core-js/modules/esnext.number.from-string.js | 2 +- core-js/modules/esnext.set.every.js | 2 +- core-js/modules/esnext.set.filter.js | 2 +- core-js/modules/esnext.set.find.js | 2 +- core-js/modules/esnext.set.map.js | 2 +- core-js/modules/esnext.set.some.js | 2 +- core-js/modules/web.timers.js | 2 +- core-js/modules/web.url-search-params.js | 2 +- core-js/modules/web.url.js | 2 +- core-js/package.json | 2 +- danger/changelog/Dangerfile | 2 +- danger/metadata/Dangerfile | 2 +- doc/user/project/clusters/serverless/index.md | 16 +---- .../prerequisite/kubernetes_namespace.rb | 22 +------ lib/gitlab/ci/config/entry/artifacts.rb | 5 ++ lib/gitlab/danger/helper.rb | 6 ++ lib/gitlab/kubernetes/cluster_role.rb | 29 ---------- lib/gitlab/kubernetes/kube_client.rb | 8 --- lib/gitlab/metrics.rb | 6 ++ lib/gitlab/metrics/prometheus.rb | 18 +++++- lib/gitlab/plugin.rb | 12 +++- scripts/static-analysis | 15 ++++- spec/features/boards/sidebar_spec.rb | 1 + .../releases/user_views_releases_spec.rb | 10 ++++ .../knative_serving_namespace_finder_spec.rb | 55 ------------------ .../prerequisite/kubernetes_namespace_spec.rb | 58 ++----------------- spec/lib/gitlab/ci/yaml_processor_spec.rb | 13 +++++ spec/lib/gitlab/danger/changelog_spec.rb | 1 + spec/lib/gitlab/danger/helper_spec.rb | 22 +++++++ spec/lib/gitlab/metrics/prometheus_spec.rb | 21 +++++++ spec/lib/gitlab/plugin_spec.rb | 57 ++++++++++++++---- spec/models/project_spec.rb | 7 +++ spec/presenters/release_presenter_spec.rb | 24 ++++++++ spec/requests/api/releases_spec.rb | 10 ++++ .../ci/find_exposed_artifacts_service_spec.rb | 29 ++++++++++ .../clusters/aws/provision_service_spec.rb | 2 +- ...create_or_update_namespace_service_spec.rb | 4 +- ..._or_update_service_account_service_spec.rb | 27 --------- spec/services/clusters/kubernetes_spec.rb | 3 - spec/support/helpers/kubernetes_helpers.rb | 31 +--------- 188 files changed, 579 insertions(+), 529 deletions(-) delete mode 100644 app/finders/clusters/knative_serving_namespace_finder.rb delete mode 100644 app/finders/clusters/knative_version_role_binding_finder.rb create mode 100644 core-js/internals/array-buffer-native.js rename core-js/internals/{sloppy-array-method.js => array-method-is-strict.js} (87%) create mode 100644 core-js/internals/array-method-uses-to-length.js rename core-js/internals/{create-async-iterator-proxy.js => async-iterator-create-proxy.js} (100%) rename core-js/internals/{is-ios.js => engine-is-ios.js} (54%) rename core-js/internals/{user-agent.js => engine-user-agent.js} (100%) rename core-js/internals/{v8-version.js => engine-v8-version.js} (88%) rename core-js/internals/{bind-context.js => function-bind-context.js} (100%) rename core-js/internals/{create-iterator-proxy.js => iterator-create-proxy.js} (100%) rename core-js/internals/{parse-float.js => number-parse-float.js} (69%) rename core-js/internals/{parse-int.js => number-parse-int.js} (60%) rename core-js/internals/{forced-object-prototype-accessors-methods.js => object-prototype-accessors-forced.js} (100%) rename core-js/internals/{forced-string-html-method.js => string-html-forced.js} (100%) rename core-js/internals/{webkit-string-pad-bug.js => string-pad-webkit-bug.js} (76%) rename core-js/internals/{punycode-to-ascii.js => string-punycode-to-ascii.js} (100%) rename core-js/internals/{forced-string-trim-method.js => string-trim-forced.js} (100%) rename core-js/internals/{typed-arrays-constructors-requires-wrappers.js => typed-array-constructors-require-wrappers.js} (100%) rename core-js/internals/{wrapped-well-known-symbol.js => well-known-symbol-wrapped.js} (100%) delete mode 100644 lib/gitlab/kubernetes/cluster_role.rb delete mode 100644 spec/finders/clusters/knative_serving_namespace_finder_spec.rb diff --git a/CHANGELOG-EE.md b/CHANGELOG-EE.md index dc4e390ebc..12caedf0c3 100644 --- a/CHANGELOG-EE.md +++ b/CHANGELOG-EE.md @@ -1,5 +1,17 @@ Please view this file on the master branch, on stable branches it's out of date. +## 12.6.3 + +- No changes. + +## 12.6.2 + +### Security (2 changes) + +- Don't publish drafts if user can't create notes. +- Remove protected tag access when group is removed. + + ## 12.6.1 - No changes. diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fb44fa826..ff7faa4ef2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,26 @@ documentation](doc/development/changelog.md) for instructions on adding your own entry. +## 12.6.3 + +- No changes. +### Security (1 change) + +- Upgrade json-jwt to v1.11.0. !22440 + +### Fixed (9 changes) + +- Fix RefreshMergeRequestsService raises an exception and unnecessary sidekiq retry. !22262 +- Disable Prometheus metrics if initialization fails. !22355 +- Fix bug when trying to expose artifacts and no artifacts are produced by the job. !22378 +- Gracefully error handle CI lint errors in artifacts section. !22388 +- Fix GitLab plugins not working without hooks configured. !22409 +- Fix releases page when tag contains a slash. !22527 +- Reverts Add RBAC permissions for getting knative version. !22560 +- Remove unused keyword from EKS provision service. !22633 +- Fix CAS users being signed out repeatedly. !22704 + + ## 12.6.2 ### Security (6 changes) diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index 93952905b6..b1131583c6 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -a4b6c71d4b7c1588587345e2dfe0c6bd7cc63a83 +1.77.1 diff --git a/Gemfile b/Gemfile index b6f57297c0..2c4a5f2e81 100644 --- a/Gemfile +++ b/Gemfile @@ -327,7 +327,7 @@ group :metrics do gem 'influxdb', '~> 0.2', require: false # Prometheus - gem 'prometheus-client-mmap', '~> 0.9.10' + gem 'prometheus-client-mmap', '~> 0.10.0' gem 'raindrops', '~> 0.18' end diff --git a/Gemfile.lock b/Gemfile.lock index 0e32270586..57e428ca95 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -531,8 +531,8 @@ GEM regexp_parser (~> 1.1) regexp_property_values (~> 0.3) json (1.8.6) - json-jwt (1.9.4) - activesupport + json-jwt (1.11.0) + activesupport (>= 4.2) aes_key_wrap bindata json-schema (2.8.0) @@ -746,7 +746,7 @@ GEM parser unparser procto (0.0.3) - prometheus-client-mmap (0.9.10) + prometheus-client-mmap (0.10.0) pry (0.11.3) coderay (~> 1.1.0) method_source (~> 0.9.0) @@ -1283,7 +1283,7 @@ DEPENDENCIES peek (~> 1.1) pg (~> 1.1) premailer-rails (~> 1.10.3) - prometheus-client-mmap (~> 0.9.10) + prometheus-client-mmap (~> 0.10.0) pry-byebug (~> 3.5.1) pry-rails (~> 0.3.4) rack (~> 2.0.7) diff --git a/VERSION b/VERSION index 3304dae76d..1121ad37ee 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -12.6.2 +12.6.3 diff --git a/app/finders/clusters/knative_serving_namespace_finder.rb b/app/finders/clusters/knative_serving_namespace_finder.rb deleted file mode 100644 index b6cf84beb7..0000000000 --- a/app/finders/clusters/knative_serving_namespace_finder.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -module Clusters - class KnativeServingNamespaceFinder - attr_reader :cluster - - def initialize(cluster) - @cluster = cluster - end - - def execute - cluster.kubeclient&.get_namespace(Clusters::Kubernetes::KNATIVE_SERVING_NAMESPACE) - rescue Kubeclient::ResourceNotFoundError - nil - rescue Kubeclient::HttpError => e - # If the kubernetes auth engine is enabled, it will return 403 - if e.error_code == 403 - Gitlab::ErrorTracking.track_exception(e) - nil - else - raise - end - end - end -end diff --git a/app/finders/clusters/knative_version_role_binding_finder.rb b/app/finders/clusters/knative_version_role_binding_finder.rb deleted file mode 100644 index 26f5492840..0000000000 --- a/app/finders/clusters/knative_version_role_binding_finder.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -module Clusters - class KnativeVersionRoleBindingFinder - attr_reader :cluster - - def initialize(cluster) - @cluster = cluster - end - - def execute - cluster.kubeclient&.get_cluster_role_binding(Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_BINDING_NAME) - rescue Kubeclient::ResourceNotFoundError - nil - end - end -end diff --git a/app/models/project.rb b/app/models/project.rb index cfdcdbed50..3f6c2d6a44 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1320,7 +1320,7 @@ class Project < ApplicationRecord end def has_active_hooks?(hooks_scope = :push_hooks) - hooks.hooks_for(hooks_scope).any? || SystemHook.hooks_for(hooks_scope).any? + hooks.hooks_for(hooks_scope).any? || SystemHook.hooks_for(hooks_scope).any? || Gitlab::Plugin.any? end def has_active_services?(hooks_scope = :push_hooks) diff --git a/app/presenters/release_presenter.rb b/app/presenters/release_presenter.rb index b38bbc8d96..099ac9b09c 100644 --- a/app/presenters/release_presenter.rb +++ b/app/presenters/release_presenter.rb @@ -40,7 +40,7 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated def evidence_file_path return unless release.evidence.present? - evidence_project_release_url(project, tag, format: :json) + evidence_project_release_url(project, release.to_param, format: :json) end private diff --git a/app/services/ci/find_exposed_artifacts_service.rb b/app/services/ci/find_exposed_artifacts_service.rb index 5c75af294b..d268252577 100644 --- a/app/services/ci/find_exposed_artifacts_service.rb +++ b/app/services/ci/find_exposed_artifacts_service.rb @@ -46,6 +46,8 @@ module Ci # it could contain many. We only need to know whether it has 1 or more # artifacts, so fetching the first 2 would be sufficient. def first_2_metadata_entries_for_artifacts_paths(job) + return [] unless job.artifacts_metadata + job.artifacts_paths .lazy .map { |path| job.artifacts_metadata_entry(path, recursive: true) } diff --git a/app/services/clusters/aws/provision_service.rb b/app/services/clusters/aws/provision_service.rb index 35fe8433b4..109e4c04a9 100644 --- a/app/services/clusters/aws/provision_service.rb +++ b/app/services/clusters/aws/provision_service.rb @@ -38,8 +38,7 @@ module Clusters def credentials @credentials ||= Clusters::Aws::FetchCredentialsService.new( provision_role, - provider: provider, - region: provider.region + provider: provider ).execute end diff --git a/app/services/clusters/kubernetes.rb b/app/services/clusters/kubernetes.rb index 59cb1c4b3a..d29519999b 100644 --- a/app/services/clusters/kubernetes.rb +++ b/app/services/clusters/kubernetes.rb @@ -12,8 +12,5 @@ module Clusters GITLAB_KNATIVE_SERVING_ROLE_BINDING_NAME = 'gitlab-knative-serving-rolebinding' GITLAB_CROSSPLANE_DATABASE_ROLE_NAME = 'gitlab-crossplane-database-role' GITLAB_CROSSPLANE_DATABASE_ROLE_BINDING_NAME = 'gitlab-crossplane-database-rolebinding' - GITLAB_KNATIVE_VERSION_ROLE_NAME = 'gitlab-knative-version-role' - GITLAB_KNATIVE_VERSION_ROLE_BINDING_NAME = 'gitlab-knative-version-rolebinding' - KNATIVE_SERVING_NAMESPACE = 'knative-serving' end end diff --git a/app/services/clusters/kubernetes/create_or_update_service_account_service.rb b/app/services/clusters/kubernetes/create_or_update_service_account_service.rb index 046046bf5a..d798dcdcfd 100644 --- a/app/services/clusters/kubernetes/create_or_update_service_account_service.rb +++ b/app/services/clusters/kubernetes/create_or_update_service_account_service.rb @@ -49,14 +49,8 @@ module Clusters create_or_update_knative_serving_role create_or_update_knative_serving_role_binding - create_or_update_crossplane_database_role create_or_update_crossplane_database_role_binding - - return unless knative_serving_namespace - - create_or_update_knative_version_role - create_or_update_knative_version_role_binding end private @@ -70,12 +64,6 @@ module Clusters ).ensure_exists! end - def knative_serving_namespace - kubeclient.get_namespace(Clusters::Kubernetes::KNATIVE_SERVING_NAMESPACE) - rescue Kubeclient::ResourceNotFoundError - nil - end - def create_role_or_cluster_role_binding if namespace_creator kubeclient.create_or_update_role_binding(role_binding_resource) @@ -100,14 +88,6 @@ module Clusters kubeclient.update_role_binding(crossplane_database_role_binding_resource) end - def create_or_update_knative_version_role - kubeclient.update_cluster_role(knative_version_role_resource) - end - - def create_or_update_knative_version_role_binding - kubeclient.update_cluster_role_binding(knative_version_role_binding_resource) - end - def service_account_resource Gitlab::Kubernetes::ServiceAccount.new( service_account_name, @@ -186,27 +166,6 @@ module Clusters service_account_name: service_account_name ).generate end - - def knative_version_role_resource - Gitlab::Kubernetes::ClusterRole.new( - name: Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_NAME, - rules: [{ - apiGroups: %w(apps), - resources: %w(deployments), - verbs: %w(list get) - }] - ).generate - end - - def knative_version_role_binding_resource - subjects = [{ kind: 'ServiceAccount', name: service_account_name, namespace: service_account_namespace }] - - Gitlab::Kubernetes::ClusterRoleBinding.new( - Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_BINDING_NAME, - Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_NAME, - subjects - ).generate - end end end end diff --git a/config/application.rb b/config/application.rb index cad5c8bbe7..33c1c1b90d 100644 --- a/config/application.rb +++ b/config/application.rb @@ -260,6 +260,10 @@ module Gitlab caching_config_hash[:pool_timeout] = 1 end + # Overrides RedisCacheStore's default value of 0 + # This makes the default value the same with Gitlab::Redis::Cache + caching_config_hash[:reconnect_attempts] ||= ::Redis::Client::DEFAULTS[:reconnect_attempts] + config.cache_store = :redis_cache_store, caching_config_hash config.active_job.queue_adapter = :sidekiq diff --git a/config/initializers/7_prometheus_metrics.rb b/config/initializers/7_prometheus_metrics.rb index c14ee1458b..383fe6493a 100644 --- a/config/initializers/7_prometheus_metrics.rb +++ b/config/initializers/7_prometheus_metrics.rb @@ -43,6 +43,9 @@ if !Rails.env.test? && Gitlab::Metrics.prometheus_metrics_enabled? defined?(::Prometheus::Client.reinitialize_on_pid_change) && Prometheus::Client.reinitialize_on_pid_change Gitlab::Metrics::Samplers::RubySampler.initialize_instance(Settings.monitoring.ruby_sampler_interval).start + rescue IOError => e + Gitlab::ErrorTracking.track_exception(e) + Gitlab::Metrics.error_detected! end Gitlab::Cluster::LifecycleEvents.on_master_start do @@ -55,6 +58,9 @@ if !Rails.env.test? && Gitlab::Metrics.prometheus_metrics_enabled? end Gitlab::Metrics::RequestsRackMiddleware.initialize_http_request_duration_seconds + rescue IOError => e + Gitlab::ErrorTracking.track_exception(e) + Gitlab::Metrics.error_detected! end end diff --git a/core-js/LICENSE b/core-js/LICENSE index 834b267db7..9c4e4e17e9 100644 --- a/core-js/LICENSE +++ b/core-js/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014-2019 Denis Pushkarev +Copyright (c) 2014-2020 Denis Pushkarev Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/core-js/es/regexp/test.js b/core-js/es/regexp/test.js index da01a6b937..b71d4a0f78 100644 --- a/core-js/es/regexp/test.js +++ b/core-js/es/regexp/test.js @@ -1,3 +1,4 @@ +require('../../modules/es.regexp.exec'); require('../../modules/es.regexp.test'); module.exports = function (re, string) { diff --git a/core-js/es/string/index.js b/core-js/es/string/index.js index b843d33ff9..f036fe4076 100644 --- a/core-js/es/string/index.js +++ b/core-js/es/string/index.js @@ -1,3 +1,4 @@ +require('../../modules/es.regexp.exec'); require('../../modules/es.string.from-code-point'); require('../../modules/es.string.raw'); require('../../modules/es.string.code-point-at'); diff --git a/core-js/es/string/match.js b/core-js/es/string/match.js index 0a372374d7..b484de08e7 100644 --- a/core-js/es/string/match.js +++ b/core-js/es/string/match.js @@ -1,3 +1,4 @@ +require('../../modules/es.regexp.exec'); require('../../modules/es.string.match'); var entryUnbind = require('../../internals/entry-unbind'); diff --git a/core-js/es/string/replace.js b/core-js/es/string/replace.js index 0ac4e6a1a3..28b62e3dfb 100644 --- a/core-js/es/string/replace.js +++ b/core-js/es/string/replace.js @@ -1,3 +1,4 @@ +require('../../modules/es.regexp.exec'); require('../../modules/es.string.replace'); var entryUnbind = require('../../internals/entry-unbind'); diff --git a/core-js/es/string/search.js b/core-js/es/string/search.js index c2ed44a696..bfb5ab0279 100644 --- a/core-js/es/string/search.js +++ b/core-js/es/string/search.js @@ -1,3 +1,4 @@ +require('../../modules/es.regexp.exec'); require('../../modules/es.string.search'); var entryUnbind = require('../../internals/entry-unbind'); diff --git a/core-js/es/string/split.js b/core-js/es/string/split.js index 0651c055f6..a890153e33 100644 --- a/core-js/es/string/split.js +++ b/core-js/es/string/split.js @@ -1,3 +1,4 @@ +require('../../modules/es.regexp.exec'); require('../../modules/es.string.split'); var entryUnbind = require('../../internals/entry-unbind'); diff --git a/core-js/es/symbol/async-iterator.js b/core-js/es/symbol/async-iterator.js index 6f5dd5d5ed..672167ffe1 100644 --- a/core-js/es/symbol/async-iterator.js +++ b/core-js/es/symbol/async-iterator.js @@ -1,4 +1,4 @@ require('../../modules/es.symbol.async-iterator'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('asyncIterator'); diff --git a/core-js/es/symbol/has-instance.js b/core-js/es/symbol/has-instance.js index 8fbd177224..80cfe23bf5 100644 --- a/core-js/es/symbol/has-instance.js +++ b/core-js/es/symbol/has-instance.js @@ -1,5 +1,5 @@ require('../../modules/es.symbol.has-instance'); require('../../modules/es.function.has-instance'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('hasInstance'); diff --git a/core-js/es/symbol/is-concat-spreadable.js b/core-js/es/symbol/is-concat-spreadable.js index 860123c01c..26711710e9 100644 --- a/core-js/es/symbol/is-concat-spreadable.js +++ b/core-js/es/symbol/is-concat-spreadable.js @@ -1,5 +1,5 @@ require('../../modules/es.symbol.is-concat-spreadable'); require('../../modules/es.array.concat'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('isConcatSpreadable'); diff --git a/core-js/es/symbol/iterator.js b/core-js/es/symbol/iterator.js index b8398936f4..73fa41d36c 100644 --- a/core-js/es/symbol/iterator.js +++ b/core-js/es/symbol/iterator.js @@ -1,6 +1,6 @@ require('../../modules/es.symbol.iterator'); require('../../modules/es.string.iterator'); require('../../modules/web.dom-collections.iterator'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('iterator'); diff --git a/core-js/es/symbol/match-all.js b/core-js/es/symbol/match-all.js index dd1c243863..b0b2f23e03 100644 --- a/core-js/es/symbol/match-all.js +++ b/core-js/es/symbol/match-all.js @@ -1,5 +1,5 @@ require('../../modules/es.symbol.match-all'); require('../../modules/es.string.match-all'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('matchAll'); diff --git a/core-js/es/symbol/match.js b/core-js/es/symbol/match.js index de607a86ec..df77b4f5c7 100644 --- a/core-js/es/symbol/match.js +++ b/core-js/es/symbol/match.js @@ -1,5 +1,5 @@ require('../../modules/es.symbol.match'); require('../../modules/es.string.match'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('match'); diff --git a/core-js/es/symbol/replace.js b/core-js/es/symbol/replace.js index 95ad78cedd..02b0f99710 100644 --- a/core-js/es/symbol/replace.js +++ b/core-js/es/symbol/replace.js @@ -1,5 +1,5 @@ require('../../modules/es.symbol.replace'); require('../../modules/es.string.replace'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('replace'); diff --git a/core-js/es/symbol/search.js b/core-js/es/symbol/search.js index 1717f1ca69..5122ca1d53 100644 --- a/core-js/es/symbol/search.js +++ b/core-js/es/symbol/search.js @@ -1,5 +1,5 @@ require('../../modules/es.symbol.search'); require('../../modules/es.string.search'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('search'); diff --git a/core-js/es/symbol/species.js b/core-js/es/symbol/species.js index 3139bc6b7b..28d3895158 100644 --- a/core-js/es/symbol/species.js +++ b/core-js/es/symbol/species.js @@ -1,4 +1,4 @@ require('../../modules/es.symbol.species'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('species'); diff --git a/core-js/es/symbol/split.js b/core-js/es/symbol/split.js index 3045f77123..25757943d3 100644 --- a/core-js/es/symbol/split.js +++ b/core-js/es/symbol/split.js @@ -1,5 +1,5 @@ require('../../modules/es.symbol.split'); require('../../modules/es.string.split'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('split'); diff --git a/core-js/es/symbol/to-primitive.js b/core-js/es/symbol/to-primitive.js index 655270f086..390c1ee910 100644 --- a/core-js/es/symbol/to-primitive.js +++ b/core-js/es/symbol/to-primitive.js @@ -1,4 +1,4 @@ require('../../modules/es.symbol.to-primitive'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('toPrimitive'); diff --git a/core-js/es/symbol/to-string-tag.js b/core-js/es/symbol/to-string-tag.js index 6f29062ffc..6af1551256 100644 --- a/core-js/es/symbol/to-string-tag.js +++ b/core-js/es/symbol/to-string-tag.js @@ -2,6 +2,6 @@ require('../../modules/es.symbol.to-string-tag'); require('../../modules/es.object.to-string'); require('../../modules/es.math.to-string-tag'); require('../../modules/es.json.to-string-tag'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('toStringTag'); diff --git a/core-js/es/symbol/unscopables.js b/core-js/es/symbol/unscopables.js index cc6f5eb979..6a2d972dce 100644 --- a/core-js/es/symbol/unscopables.js +++ b/core-js/es/symbol/unscopables.js @@ -1,4 +1,4 @@ require('../../modules/es.symbol.unscopables'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('unscopables'); diff --git a/core-js/features/symbol/async-dispose.js b/core-js/features/symbol/async-dispose.js index 39fde3708e..195abe1dbd 100644 --- a/core-js/features/symbol/async-dispose.js +++ b/core-js/features/symbol/async-dispose.js @@ -1,4 +1,4 @@ require('../../modules/esnext.symbol.async-dispose'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('asyncDispose'); diff --git a/core-js/features/symbol/dispose.js b/core-js/features/symbol/dispose.js index 09ba080f77..71a4d50443 100644 --- a/core-js/features/symbol/dispose.js +++ b/core-js/features/symbol/dispose.js @@ -1,4 +1,4 @@ require('../../modules/esnext.symbol.dispose'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('dispose'); diff --git a/core-js/features/symbol/observable.js b/core-js/features/symbol/observable.js index f16e2ce550..f1fa6cb15a 100644 --- a/core-js/features/symbol/observable.js +++ b/core-js/features/symbol/observable.js @@ -1,4 +1,4 @@ require('../../modules/esnext.symbol.observable'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('observable'); diff --git a/core-js/features/symbol/pattern-match.js b/core-js/features/symbol/pattern-match.js index 0ccbf594b2..98ffbb0f1e 100644 --- a/core-js/features/symbol/pattern-match.js +++ b/core-js/features/symbol/pattern-match.js @@ -1,4 +1,4 @@ require('../../modules/esnext.symbol.pattern-match'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('patternMatch'); diff --git a/core-js/features/symbol/replace-all.js b/core-js/features/symbol/replace-all.js index 6fee490af3..011b117ba3 100644 --- a/core-js/features/symbol/replace-all.js +++ b/core-js/features/symbol/replace-all.js @@ -1,5 +1,5 @@ // TODO: Remove from `core-js@4` require('../../modules/esnext.symbol.replace-all'); -var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); +var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); module.exports = WrappedWellKnownSymbolModule.f('replaceAll'); diff --git a/core-js/internals/array-buffer-native.js b/core-js/internals/array-buffer-native.js new file mode 100644 index 0000000000..36da2d744b --- /dev/null +++ b/core-js/internals/array-buffer-native.js @@ -0,0 +1 @@ +module.exports = typeof ArrayBuffer !== 'undefined' && typeof DataView !== 'undefined'; diff --git a/core-js/internals/array-buffer-view-core.js b/core-js/internals/array-buffer-view-core.js index e9b97df991..2952bc673a 100644 --- a/core-js/internals/array-buffer-view-core.js +++ b/core-js/internals/array-buffer-view-core.js @@ -1,4 +1,5 @@ 'use strict'; +var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-native'); var DESCRIPTORS = require('../internals/descriptors'); var global = require('../internals/global'); var isObject = require('../internals/is-object'); @@ -12,8 +13,6 @@ var setPrototypeOf = require('../internals/object-set-prototype-of'); var wellKnownSymbol = require('../internals/well-known-symbol'); var uid = require('../internals/uid'); -var DataView = global.DataView; -var DataViewPrototype = DataView && DataView.prototype; var Int8Array = global.Int8Array; var Int8ArrayPrototype = Int8Array && Int8Array.prototype; var Uint8ClampedArray = global.Uint8ClampedArray; @@ -25,7 +24,6 @@ var isPrototypeOf = ObjectPrototype.isPrototypeOf; var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG'); -var NATIVE_ARRAY_BUFFER = !!(global.ArrayBuffer && DataView); // Fixing native typed arrays in Opera Presto crashes the browser, see #595 var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera'; var TYPED_ARRAY_TAG_REQIRED = false; @@ -144,13 +142,7 @@ if (DESCRIPTORS && !has(TypedArrayPrototype, TO_STRING_TAG)) { } } -// WebKit bug - the same parent prototype for typed arrays and data view -if (NATIVE_ARRAY_BUFFER && setPrototypeOf && getPrototypeOf(DataViewPrototype) !== ObjectPrototype) { - setPrototypeOf(DataViewPrototype, ObjectPrototype); -} - module.exports = { - NATIVE_ARRAY_BUFFER: NATIVE_ARRAY_BUFFER, NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS, TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG, aTypedArray: aTypedArray, diff --git a/core-js/internals/array-buffer.js b/core-js/internals/array-buffer.js index 5b38ad9f92..d8eb5d5185 100644 --- a/core-js/internals/array-buffer.js +++ b/core-js/internals/array-buffer.js @@ -1,7 +1,7 @@ 'use strict'; var global = require('../internals/global'); var DESCRIPTORS = require('../internals/descriptors'); -var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-view-core').NATIVE_ARRAY_BUFFER; +var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-native'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var redefineAll = require('../internals/redefine-all'); var fails = require('../internals/fails'); @@ -10,6 +10,8 @@ var toInteger = require('../internals/to-integer'); var toLength = require('../internals/to-length'); var toIndex = require('../internals/to-index'); var IEEE754 = require('../internals/ieee754'); +var getPrototypeOf = require('../internals/object-get-prototype-of'); +var setPrototypeOf = require('../internals/object-set-prototype-of'); var getOwnPropertyNames = require('../internals/object-get-own-property-names').f; var defineProperty = require('../internals/object-define-property').f; var arrayFill = require('../internals/array-fill'); @@ -26,6 +28,8 @@ var WRONG_INDEX = 'Wrong index'; var NativeArrayBuffer = global[ARRAY_BUFFER]; var $ArrayBuffer = NativeArrayBuffer; var $DataView = global[DATA_VIEW]; +var $DataViewPrototype = $DataView && $DataView[PROTOTYPE]; +var ObjectPrototype = Object.prototype; var RangeError = global.RangeError; var packIEEE754 = IEEE754.pack; @@ -192,12 +196,18 @@ if (!NATIVE_ARRAY_BUFFER) { } ArrayBufferPrototype.constructor = $ArrayBuffer; } + + // WebKit bug - the same parent prototype for typed arrays and data view + if (setPrototypeOf && getPrototypeOf($DataViewPrototype) !== ObjectPrototype) { + setPrototypeOf($DataViewPrototype, ObjectPrototype); + } + // iOS Safari 7.x bug var testView = new $DataView(new $ArrayBuffer(2)); - var nativeSetInt8 = $DataView[PROTOTYPE].setInt8; + var nativeSetInt8 = $DataViewPrototype.setInt8; testView.setInt8(0, 2147483648); testView.setInt8(1, 2147483649); - if (testView.getInt8(0) || !testView.getInt8(1)) redefineAll($DataView[PROTOTYPE], { + if (testView.getInt8(0) || !testView.getInt8(1)) redefineAll($DataViewPrototype, { setInt8: function setInt8(byteOffset, value) { nativeSetInt8.call(this, byteOffset, value << 24 >> 24); }, diff --git a/core-js/internals/array-for-each.js b/core-js/internals/array-for-each.js index b666e31540..d8872dbd21 100644 --- a/core-js/internals/array-for-each.js +++ b/core-js/internals/array-for-each.js @@ -1,9 +1,13 @@ 'use strict'; var $forEach = require('../internals/array-iteration').forEach; -var sloppyArrayMethod = require('../internals/sloppy-array-method'); +var arrayMethodIsStrict = require('../internals/array-method-is-strict'); +var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length'); + +var STRICT_METHOD = arrayMethodIsStrict('forEach'); +var USES_TO_LENGTH = arrayMethodUsesToLength('forEach'); // `Array.prototype.forEach` method implementation // https://tc39.github.io/ecma262/#sec-array.prototype.foreach -module.exports = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) { +module.exports = (!STRICT_METHOD || !USES_TO_LENGTH) ? function forEach(callbackfn /* , thisArg */) { return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } : [].forEach; diff --git a/core-js/internals/array-from.js b/core-js/internals/array-from.js index e45ebe493c..490a3c29cd 100644 --- a/core-js/internals/array-from.js +++ b/core-js/internals/array-from.js @@ -1,5 +1,5 @@ 'use strict'; -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var toObject = require('../internals/to-object'); var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing'); var isArrayIteratorMethod = require('../internals/is-array-iterator-method'); @@ -15,9 +15,9 @@ module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undef var argumentsLength = arguments.length; var mapfn = argumentsLength > 1 ? arguments[1] : undefined; var mapping = mapfn !== undefined; - var index = 0; var iteratorMethod = getIteratorMethod(O); - var length, result, step, iterator, next; + var index = 0; + var length, result, step, iterator, next, value; if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2); // if the target is not iterable or it's an array with the default iterator - use a simple case if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) { @@ -25,16 +25,15 @@ module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undef next = iterator.next; result = new C(); for (;!(step = next.call(iterator)).done; index++) { - createProperty(result, index, mapping - ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) - : step.value - ); + value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value; + createProperty(result, index, value); } } else { length = toLength(O.length); result = new C(length); for (;length > index; index++) { - createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); + value = mapping ? mapfn(O[index], index) : O[index]; + createProperty(result, index, value); } } result.length = index; diff --git a/core-js/internals/array-iteration.js b/core-js/internals/array-iteration.js index eab3f5bf8b..8014dacefa 100644 --- a/core-js/internals/array-iteration.js +++ b/core-js/internals/array-iteration.js @@ -1,4 +1,4 @@ -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var IndexedObject = require('../internals/indexed-object'); var toObject = require('../internals/to-object'); var toLength = require('../internals/to-length'); diff --git a/core-js/internals/array-last-index-of.js b/core-js/internals/array-last-index-of.js index 3401db3fce..69e38a491a 100644 --- a/core-js/internals/array-last-index-of.js +++ b/core-js/internals/array-last-index-of.js @@ -2,16 +2,19 @@ var toIndexedObject = require('../internals/to-indexed-object'); var toInteger = require('../internals/to-integer'); var toLength = require('../internals/to-length'); -var sloppyArrayMethod = require('../internals/sloppy-array-method'); +var arrayMethodIsStrict = require('../internals/array-method-is-strict'); +var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length'); var min = Math.min; var nativeLastIndexOf = [].lastIndexOf; var NEGATIVE_ZERO = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0; -var SLOPPY_METHOD = sloppyArrayMethod('lastIndexOf'); +var STRICT_METHOD = arrayMethodIsStrict('lastIndexOf'); +var USES_TO_LENGTH = arrayMethodUsesToLength('lastIndexOf', { ACCESSORS: true, 1: 2147483647 }); +var FORCED = NEGATIVE_ZERO || !STRICT_METHOD || !USES_TO_LENGTH; // `Array.prototype.lastIndexOf` method implementation // https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof -module.exports = (NEGATIVE_ZERO || SLOPPY_METHOD) ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { +module.exports = FORCED ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { // convert -0 to +0 if (NEGATIVE_ZERO) return nativeLastIndexOf.apply(this, arguments) || 0; var O = toIndexedObject(this); diff --git a/core-js/internals/array-method-has-species-support.js b/core-js/internals/array-method-has-species-support.js index 55396dab07..0d5d380c0f 100644 --- a/core-js/internals/array-method-has-species-support.js +++ b/core-js/internals/array-method-has-species-support.js @@ -1,6 +1,6 @@ var fails = require('../internals/fails'); var wellKnownSymbol = require('../internals/well-known-symbol'); -var V8_VERSION = require('../internals/v8-version'); +var V8_VERSION = require('../internals/engine-v8-version'); var SPECIES = wellKnownSymbol('species'); diff --git a/core-js/internals/sloppy-array-method.js b/core-js/internals/array-method-is-strict.js similarity index 87% rename from core-js/internals/sloppy-array-method.js rename to core-js/internals/array-method-is-strict.js index 8ec998384a..8ea8df073f 100644 --- a/core-js/internals/sloppy-array-method.js +++ b/core-js/internals/array-method-is-strict.js @@ -3,7 +3,7 @@ var fails = require('../internals/fails'); module.exports = function (METHOD_NAME, argument) { var method = [][METHOD_NAME]; - return !method || !fails(function () { + return !!method && fails(function () { // eslint-disable-next-line no-useless-call,no-throw-literal method.call(null, argument || function () { throw 1; }, 1); }); diff --git a/core-js/internals/array-method-uses-to-length.js b/core-js/internals/array-method-uses-to-length.js new file mode 100644 index 0000000000..b55d1f14a6 --- /dev/null +++ b/core-js/internals/array-method-uses-to-length.js @@ -0,0 +1,30 @@ +var DESCRIPTORS = require('../internals/descriptors'); +var fails = require('../internals/fails'); +var has = require('../internals/has'); + +var defineProperty = Object.defineProperty; + +var thrower = function (it) { throw it; }; + +module.exports = function (METHOD_NAME, options) { + if (!options) options = {}; + var method = [][METHOD_NAME]; + var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false; + var argument0 = has(options, 0) ? options[0] : thrower; + var argument1 = has(options, 1) ? options[1] : undefined; + + return !!method && !fails(function () { + if (ACCESSORS && !DESCRIPTORS) return true; + var O = { length: -1 }; + + var addTrap = function (key) { + if (ACCESSORS) defineProperty(O, key, { enumerable: true, get: thrower }); + else O[key] = 1; + }; + + addTrap(1); + addTrap(2147483646); + addTrap(4294967294); + method.call(O, argument0, argument1); + }); +}; diff --git a/core-js/internals/create-async-iterator-proxy.js b/core-js/internals/async-iterator-create-proxy.js similarity index 100% rename from core-js/internals/create-async-iterator-proxy.js rename to core-js/internals/async-iterator-create-proxy.js diff --git a/core-js/internals/collection-from.js b/core-js/internals/collection-from.js index fcdd078c63..7a4136deb5 100644 --- a/core-js/internals/collection-from.js +++ b/core-js/internals/collection-from.js @@ -1,7 +1,7 @@ 'use strict'; // https://tc39.github.io/proposal-setmap-offrom/ var aFunction = require('../internals/a-function'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var iterate = require('../internals/iterate'); module.exports = function from(source /* , mapFn, thisArg */) { diff --git a/core-js/internals/collection-strong.js b/core-js/internals/collection-strong.js index 14f6f0ec13..2a67798746 100644 --- a/core-js/internals/collection-strong.js +++ b/core-js/internals/collection-strong.js @@ -2,7 +2,7 @@ var defineProperty = require('../internals/object-define-property').f; var create = require('../internals/object-create'); var redefineAll = require('../internals/redefine-all'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var anInstance = require('../internals/an-instance'); var iterate = require('../internals/iterate'); var defineIterator = require('../internals/define-iterator'); diff --git a/core-js/internals/define-well-known-symbol.js b/core-js/internals/define-well-known-symbol.js index d383029176..e5479451fa 100644 --- a/core-js/internals/define-well-known-symbol.js +++ b/core-js/internals/define-well-known-symbol.js @@ -1,6 +1,6 @@ var path = require('../internals/path'); var has = require('../internals/has'); -var wrappedWellKnownSymbolModule = require('../internals/wrapped-well-known-symbol'); +var wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped'); var defineProperty = require('../internals/object-define-property').f; module.exports = function (NAME) { diff --git a/core-js/internals/descriptors.js b/core-js/internals/descriptors.js index cae051891d..2673a79994 100644 --- a/core-js/internals/descriptors.js +++ b/core-js/internals/descriptors.js @@ -2,5 +2,5 @@ var fails = require('../internals/fails'); // Thank's IE8 for his funny defineProperty module.exports = !fails(function () { - return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; + return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); diff --git a/core-js/internals/is-ios.js b/core-js/internals/engine-is-ios.js similarity index 54% rename from core-js/internals/is-ios.js rename to core-js/internals/engine-is-ios.js index d14fc29663..6d68296b62 100644 --- a/core-js/internals/is-ios.js +++ b/core-js/internals/engine-is-ios.js @@ -1,3 +1,3 @@ -var userAgent = require('../internals/user-agent'); +var userAgent = require('../internals/engine-user-agent'); module.exports = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent); diff --git a/core-js/internals/user-agent.js b/core-js/internals/engine-user-agent.js similarity index 100% rename from core-js/internals/user-agent.js rename to core-js/internals/engine-user-agent.js diff --git a/core-js/internals/v8-version.js b/core-js/internals/engine-v8-version.js similarity index 88% rename from core-js/internals/v8-version.js rename to core-js/internals/engine-v8-version.js index 551b155dfc..1ff22c30ae 100644 --- a/core-js/internals/v8-version.js +++ b/core-js/internals/engine-v8-version.js @@ -1,5 +1,5 @@ var global = require('../internals/global'); -var userAgent = require('../internals/user-agent'); +var userAgent = require('../internals/engine-user-agent'); var process = global.process; var versions = process && process.versions; diff --git a/core-js/internals/entry-unbind.js b/core-js/internals/entry-unbind.js index 4707c9c42a..69ead9b525 100644 --- a/core-js/internals/entry-unbind.js +++ b/core-js/internals/entry-unbind.js @@ -1,5 +1,5 @@ var global = require('../internals/global'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var call = Function.call; diff --git a/core-js/internals/fix-regexp-well-known-symbol-logic.js b/core-js/internals/fix-regexp-well-known-symbol-logic.js index 8b523726e9..eb6e51d0b3 100644 --- a/core-js/internals/fix-regexp-well-known-symbol-logic.js +++ b/core-js/internals/fix-regexp-well-known-symbol-logic.js @@ -1,4 +1,6 @@ 'use strict'; +// TODO: Remove from `core-js@4` since it's moved to entry points +require('../modules/es.regexp.exec'); var redefine = require('../internals/redefine'); var fails = require('../internals/fails'); var wellKnownSymbol = require('../internals/well-known-symbol'); @@ -26,6 +28,15 @@ var REPLACE_KEEPS_$0 = (function () { return 'a'.replace(/./, '$0') === '$0'; })(); +var REPLACE = wellKnownSymbol('replace'); +// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string +var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () { + if (/./[REPLACE]) { + return /./[REPLACE]('a', '$0') === ''; + } + return false; +})(); + // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec // Weex JS has frozen built-in prototypes, so use try / catch wrapper var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () { @@ -73,7 +84,11 @@ module.exports = function (KEY, length, exec, sham) { if ( !DELEGATES_TO_SYMBOL || !DELEGATES_TO_EXEC || - (KEY === 'replace' && !(REPLACE_SUPPORTS_NAMED_GROUPS && REPLACE_KEEPS_$0)) || + (KEY === 'replace' && !( + REPLACE_SUPPORTS_NAMED_GROUPS && + REPLACE_KEEPS_$0 && + !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE + )) || (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC) ) { var nativeRegExpMethod = /./[SYMBOL]; @@ -88,7 +103,10 @@ module.exports = function (KEY, length, exec, sham) { return { done: true, value: nativeMethod.call(str, regexp, arg2) }; } return { done: false }; - }, { REPLACE_KEEPS_$0: REPLACE_KEEPS_$0 }); + }, { + REPLACE_KEEPS_$0: REPLACE_KEEPS_$0, + REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE + }); var stringMethod = methods[0]; var regexMethod = methods[1]; diff --git a/core-js/internals/flatten-into-array.js b/core-js/internals/flatten-into-array.js index e218b1dcb8..df29916565 100644 --- a/core-js/internals/flatten-into-array.js +++ b/core-js/internals/flatten-into-array.js @@ -1,7 +1,7 @@ 'use strict'; var isArray = require('../internals/is-array'); var toLength = require('../internals/to-length'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); // `FlattenIntoArray` abstract operation // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray diff --git a/core-js/internals/bind-context.js b/core-js/internals/function-bind-context.js similarity index 100% rename from core-js/internals/bind-context.js rename to core-js/internals/function-bind-context.js diff --git a/core-js/internals/iterate.js b/core-js/internals/iterate.js index 851c96b1e3..a68c416123 100644 --- a/core-js/internals/iterate.js +++ b/core-js/internals/iterate.js @@ -1,7 +1,7 @@ var anObject = require('../internals/an-object'); var isArrayIteratorMethod = require('../internals/is-array-iterator-method'); var toLength = require('../internals/to-length'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var getIteratorMethod = require('../internals/get-iterator-method'); var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing'); diff --git a/core-js/internals/create-iterator-proxy.js b/core-js/internals/iterator-create-proxy.js similarity index 100% rename from core-js/internals/create-iterator-proxy.js rename to core-js/internals/iterator-create-proxy.js diff --git a/core-js/internals/microtask.js b/core-js/internals/microtask.js index 479ff84197..6df180c61d 100644 --- a/core-js/internals/microtask.js +++ b/core-js/internals/microtask.js @@ -2,7 +2,7 @@ var global = require('../internals/global'); var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; var classof = require('../internals/classof-raw'); var macrotask = require('../internals/task').set; -var IS_IOS = require('../internals/is-ios'); +var IS_IOS = require('../internals/engine-is-ios'); var MutationObserver = global.MutationObserver || global.WebKitMutationObserver; var process = global.process; diff --git a/core-js/internals/parse-float.js b/core-js/internals/number-parse-float.js similarity index 69% rename from core-js/internals/parse-float.js rename to core-js/internals/number-parse-float.js index 1242a674fa..0ff341d34e 100644 --- a/core-js/internals/parse-float.js +++ b/core-js/internals/number-parse-float.js @@ -2,13 +2,13 @@ var global = require('../internals/global'); var trim = require('../internals/string-trim').trim; var whitespaces = require('../internals/whitespaces'); -var nativeParseFloat = global.parseFloat; -var FORCED = 1 / nativeParseFloat(whitespaces + '-0') !== -Infinity; +var $parseFloat = global.parseFloat; +var FORCED = 1 / $parseFloat(whitespaces + '-0') !== -Infinity; // `parseFloat` method // https://tc39.github.io/ecma262/#sec-parsefloat-string module.exports = FORCED ? function parseFloat(string) { var trimmedString = trim(String(string)); - var result = nativeParseFloat(trimmedString); + var result = $parseFloat(trimmedString); return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result; -} : nativeParseFloat; +} : $parseFloat; diff --git a/core-js/internals/parse-int.js b/core-js/internals/number-parse-int.js similarity index 60% rename from core-js/internals/parse-int.js rename to core-js/internals/number-parse-int.js index a068efab87..11b8232f24 100644 --- a/core-js/internals/parse-int.js +++ b/core-js/internals/number-parse-int.js @@ -2,13 +2,13 @@ var global = require('../internals/global'); var trim = require('../internals/string-trim').trim; var whitespaces = require('../internals/whitespaces'); -var nativeParseInt = global.parseInt; +var $parseInt = global.parseInt; var hex = /^[+-]?0[Xx]/; -var FORCED = nativeParseInt(whitespaces + '08') !== 8 || nativeParseInt(whitespaces + '0x16') !== 22; +var FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22; // `parseInt` method // https://tc39.github.io/ecma262/#sec-parseint-string-radix module.exports = FORCED ? function parseInt(string, radix) { var S = trim(String(string)); - return nativeParseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10)); -} : nativeParseInt; + return $parseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10)); +} : $parseInt; diff --git a/core-js/internals/forced-object-prototype-accessors-methods.js b/core-js/internals/object-prototype-accessors-forced.js similarity index 100% rename from core-js/internals/forced-object-prototype-accessors-methods.js rename to core-js/internals/object-prototype-accessors-forced.js diff --git a/core-js/internals/shared.js b/core-js/internals/shared.js index 91c12ff761..0f2c312d56 100644 --- a/core-js/internals/shared.js +++ b/core-js/internals/shared.js @@ -4,7 +4,7 @@ var store = require('../internals/shared-store'); (module.exports = function (key, value) { return store[key] || (store[key] = value !== undefined ? value : {}); })('versions', []).push({ - version: '3.6.1', + version: '3.6.3', mode: IS_PURE ? 'pure' : 'global', - copyright: '© 2019 Denis Pushkarev (zloirock.ru)' + copyright: '© 2020 Denis Pushkarev (zloirock.ru)' }); diff --git a/core-js/internals/forced-string-html-method.js b/core-js/internals/string-html-forced.js similarity index 100% rename from core-js/internals/forced-string-html-method.js rename to core-js/internals/string-html-forced.js diff --git a/core-js/internals/webkit-string-pad-bug.js b/core-js/internals/string-pad-webkit-bug.js similarity index 76% rename from core-js/internals/webkit-string-pad-bug.js rename to core-js/internals/string-pad-webkit-bug.js index 31ab9fc222..9f94d3a151 100644 --- a/core-js/internals/webkit-string-pad-bug.js +++ b/core-js/internals/string-pad-webkit-bug.js @@ -1,5 +1,5 @@ // https://github.com/zloirock/core-js/issues/280 -var userAgent = require('../internals/user-agent'); +var userAgent = require('../internals/engine-user-agent'); // eslint-disable-next-line unicorn/no-unsafe-regex module.exports = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent); diff --git a/core-js/internals/punycode-to-ascii.js b/core-js/internals/string-punycode-to-ascii.js similarity index 100% rename from core-js/internals/punycode-to-ascii.js rename to core-js/internals/string-punycode-to-ascii.js diff --git a/core-js/internals/forced-string-trim-method.js b/core-js/internals/string-trim-forced.js similarity index 100% rename from core-js/internals/forced-string-trim-method.js rename to core-js/internals/string-trim-forced.js diff --git a/core-js/internals/task.js b/core-js/internals/task.js index d1aa586f30..834585fe5a 100644 --- a/core-js/internals/task.js +++ b/core-js/internals/task.js @@ -1,10 +1,10 @@ var global = require('../internals/global'); var fails = require('../internals/fails'); var classof = require('../internals/classof-raw'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var html = require('../internals/html'); var createElement = require('../internals/document-create-element'); -var IS_IOS = require('../internals/is-ios'); +var IS_IOS = require('../internals/engine-is-ios'); var location = global.location; var set = global.setImmediate; diff --git a/core-js/internals/typed-array-constructor.js b/core-js/internals/typed-array-constructor.js index bdd624f735..61ef391c1b 100644 --- a/core-js/internals/typed-array-constructor.js +++ b/core-js/internals/typed-array-constructor.js @@ -2,7 +2,7 @@ var $ = require('../internals/export'); var global = require('../internals/global'); var DESCRIPTORS = require('../internals/descriptors'); -var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-arrays-constructors-requires-wrappers'); +var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-array-constructors-require-wrappers'); var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var ArrayBufferModule = require('../internals/array-buffer'); var anInstance = require('../internals/an-instance'); diff --git a/core-js/internals/typed-arrays-constructors-requires-wrappers.js b/core-js/internals/typed-array-constructors-require-wrappers.js similarity index 100% rename from core-js/internals/typed-arrays-constructors-requires-wrappers.js rename to core-js/internals/typed-array-constructors-require-wrappers.js diff --git a/core-js/internals/typed-array-from.js b/core-js/internals/typed-array-from.js index 8a4debdf54..9d61dc797c 100644 --- a/core-js/internals/typed-array-from.js +++ b/core-js/internals/typed-array-from.js @@ -2,7 +2,7 @@ var toObject = require('../internals/to-object'); var toLength = require('../internals/to-length'); var getIteratorMethod = require('../internals/get-iterator-method'); var isArrayIteratorMethod = require('../internals/is-array-iterator-method'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var aTypedArrayConstructor = require('../internals/array-buffer-view-core').aTypedArrayConstructor; module.exports = function from(source /* , mapfn, thisArg */) { diff --git a/core-js/internals/wrapped-well-known-symbol.js b/core-js/internals/well-known-symbol-wrapped.js similarity index 100% rename from core-js/internals/wrapped-well-known-symbol.js rename to core-js/internals/well-known-symbol-wrapped.js diff --git a/core-js/modules/es.array.concat.js b/core-js/modules/es.array.concat.js index d850844ae5..1c2249909f 100644 --- a/core-js/modules/es.array.concat.js +++ b/core-js/modules/es.array.concat.js @@ -9,7 +9,7 @@ var createProperty = require('../internals/create-property'); var arraySpeciesCreate = require('../internals/array-species-create'); var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); var wellKnownSymbol = require('../internals/well-known-symbol'); -var V8_VERSION = require('../internals/v8-version'); +var V8_VERSION = require('../internals/engine-v8-version'); var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable'); var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; diff --git a/core-js/modules/es.array.every.js b/core-js/modules/es.array.every.js index da54b92533..231c5c2418 100644 --- a/core-js/modules/es.array.every.js +++ b/core-js/modules/es.array.every.js @@ -1,11 +1,15 @@ 'use strict'; var $ = require('../internals/export'); var $every = require('../internals/array-iteration').every; -var sloppyArrayMethod = require('../internals/sloppy-array-method'); +var arrayMethodIsStrict = require('../internals/array-method-is-strict'); +var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length'); + +var STRICT_METHOD = arrayMethodIsStrict('every'); +var USES_TO_LENGTH = arrayMethodUsesToLength('every'); // `Array.prototype.every` method // https://tc39.github.io/ecma262/#sec-array.prototype.every -$({ target: 'Array', proto: true, forced: sloppyArrayMethod('every') }, { +$({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH }, { every: function every(callbackfn /* , thisArg */) { return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } diff --git a/core-js/modules/es.array.filter.js b/core-js/modules/es.array.filter.js index 7d8bd50852..df2509bc76 100644 --- a/core-js/modules/es.array.filter.js +++ b/core-js/modules/es.array.filter.js @@ -1,14 +1,12 @@ 'use strict'; var $ = require('../internals/export'); var $filter = require('../internals/array-iteration').filter; -var fails = require('../internals/fails'); var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); +var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length'); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter'); // Edge 14- issue -var USES_TO_LENGTH = HAS_SPECIES_SUPPORT && !fails(function () { - [].filter.call({ length: -1, 0: 1 }, function (it) { throw it; }); -}); +var USES_TO_LENGTH = arrayMethodUsesToLength('filter'); // `Array.prototype.filter` method // https://tc39.github.io/ecma262/#sec-array.prototype.filter diff --git a/core-js/modules/es.array.find-index.js b/core-js/modules/es.array.find-index.js index 6a13c7b27b..56c0b68fad 100644 --- a/core-js/modules/es.array.find-index.js +++ b/core-js/modules/es.array.find-index.js @@ -2,16 +2,19 @@ var $ = require('../internals/export'); var $findIndex = require('../internals/array-iteration').findIndex; var addToUnscopables = require('../internals/add-to-unscopables'); +var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length'); var FIND_INDEX = 'findIndex'; var SKIPS_HOLES = true; +var USES_TO_LENGTH = arrayMethodUsesToLength(FIND_INDEX); + // Shouldn't skip holes if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; }); // `Array.prototype.findIndex` method // https://tc39.github.io/ecma262/#sec-array.prototype.findindex -$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { +$({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH }, { findIndex: function findIndex(callbackfn /* , that = undefined */) { return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } diff --git a/core-js/modules/es.array.find.js b/core-js/modules/es.array.find.js index 961f804bf2..ad37cc796f 100644 --- a/core-js/modules/es.array.find.js +++ b/core-js/modules/es.array.find.js @@ -2,16 +2,19 @@ var $ = require('../internals/export'); var $find = require('../internals/array-iteration').find; var addToUnscopables = require('../internals/add-to-unscopables'); +var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length'); var FIND = 'find'; var SKIPS_HOLES = true; +var USES_TO_LENGTH = arrayMethodUsesToLength(FIND); + // Shouldn't skip holes if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; }); // `Array.prototype.find` method // https://tc39.github.io/ecma262/#sec-array.prototype.find -$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { +$({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH }, { find: function find(callbackfn /* , that = undefined */) { return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } diff --git a/core-js/modules/es.array.includes.js b/core-js/modules/es.array.includes.js index a374c0faae..003655699d 100644 --- a/core-js/modules/es.array.includes.js +++ b/core-js/modules/es.array.includes.js @@ -2,10 +2,13 @@ var $ = require('../internals/export'); var $includes = require('../internals/array-includes').includes; var addToUnscopables = require('../internals/add-to-unscopables'); +var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length'); + +var USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 }); // `Array.prototype.includes` method // https://tc39.github.io/ecma262/#sec-array.prototype.includes -$({ target: 'Array', proto: true }, { +$({ target: 'Array', proto: true, forced: !USES_TO_LENGTH }, { includes: function includes(el /* , fromIndex = 0 */) { return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); } diff --git a/core-js/modules/es.array.index-of.js b/core-js/modules/es.array.index-of.js index 004399dff9..5a1442b394 100644 --- a/core-js/modules/es.array.index-of.js +++ b/core-js/modules/es.array.index-of.js @@ -1,16 +1,18 @@ 'use strict'; var $ = require('../internals/export'); var $indexOf = require('../internals/array-includes').indexOf; -var sloppyArrayMethod = require('../internals/sloppy-array-method'); +var arrayMethodIsStrict = require('../internals/array-method-is-strict'); +var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length'); var nativeIndexOf = [].indexOf; var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0; -var SLOPPY_METHOD = sloppyArrayMethod('indexOf'); +var STRICT_METHOD = arrayMethodIsStrict('indexOf'); +var USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 }); // `Array.prototype.indexOf` method // https://tc39.github.io/ecma262/#sec-array.prototype.indexof -$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || SLOPPY_METHOD }, { +$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD || !USES_TO_LENGTH }, { indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { return NEGATIVE_ZERO // convert -0 to +0 diff --git a/core-js/modules/es.array.join.js b/core-js/modules/es.array.join.js index c733598b40..79ad8d2657 100644 --- a/core-js/modules/es.array.join.js +++ b/core-js/modules/es.array.join.js @@ -2,16 +2,16 @@ var $ = require('../internals/export'); var IndexedObject = require('../internals/indexed-object'); var toIndexedObject = require('../internals/to-indexed-object'); -var sloppyArrayMethod = require('../internals/sloppy-array-method'); +var arrayMethodIsStrict = require('../internals/array-method-is-strict'); var nativeJoin = [].join; var ES3_STRINGS = IndexedObject != Object; -var SLOPPY_METHOD = sloppyArrayMethod('join', ','); +var STRICT_METHOD = arrayMethodIsStrict('join', ','); // `Array.prototype.join` method // https://tc39.github.io/ecma262/#sec-array.prototype.join -$({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD }, { +$({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, { join: function join(separator) { return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator); } diff --git a/core-js/modules/es.array.map.js b/core-js/modules/es.array.map.js index a7449c25d2..f9a8cdfe52 100644 --- a/core-js/modules/es.array.map.js +++ b/core-js/modules/es.array.map.js @@ -1,14 +1,12 @@ 'use strict'; var $ = require('../internals/export'); var $map = require('../internals/array-iteration').map; -var fails = require('../internals/fails'); var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); +var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length'); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map'); // FF49- issue -var USES_TO_LENGTH = HAS_SPECIES_SUPPORT && !fails(function () { - [].map.call({ length: -1, 0: 1 }, function (it) { throw it; }); -}); +var USES_TO_LENGTH = arrayMethodUsesToLength('map'); // `Array.prototype.map` method // https://tc39.github.io/ecma262/#sec-array.prototype.map diff --git a/core-js/modules/es.array.reduce-right.js b/core-js/modules/es.array.reduce-right.js index 292f9d84f8..d044bc9603 100644 --- a/core-js/modules/es.array.reduce-right.js +++ b/core-js/modules/es.array.reduce-right.js @@ -1,11 +1,15 @@ 'use strict'; var $ = require('../internals/export'); var $reduceRight = require('../internals/array-reduce').right; -var sloppyArrayMethod = require('../internals/sloppy-array-method'); +var arrayMethodIsStrict = require('../internals/array-method-is-strict'); +var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length'); + +var STRICT_METHOD = arrayMethodIsStrict('reduceRight'); +var USES_TO_LENGTH = arrayMethodUsesToLength('reduceRight', { 1: 0 }); // `Array.prototype.reduceRight` method // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright -$({ target: 'Array', proto: true, forced: sloppyArrayMethod('reduceRight') }, { +$({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH }, { reduceRight: function reduceRight(callbackfn /* , initialValue */) { return $reduceRight(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); } diff --git a/core-js/modules/es.array.reduce.js b/core-js/modules/es.array.reduce.js index a776812697..40e0458751 100644 --- a/core-js/modules/es.array.reduce.js +++ b/core-js/modules/es.array.reduce.js @@ -1,11 +1,15 @@ 'use strict'; var $ = require('../internals/export'); var $reduce = require('../internals/array-reduce').left; -var sloppyArrayMethod = require('../internals/sloppy-array-method'); +var arrayMethodIsStrict = require('../internals/array-method-is-strict'); +var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length'); + +var STRICT_METHOD = arrayMethodIsStrict('reduce'); +var USES_TO_LENGTH = arrayMethodUsesToLength('reduce', { 1: 0 }); // `Array.prototype.reduce` method // https://tc39.github.io/ecma262/#sec-array.prototype.reduce -$({ target: 'Array', proto: true, forced: sloppyArrayMethod('reduce') }, { +$({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH }, { reduce: function reduce(callbackfn /* , initialValue */) { return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); } diff --git a/core-js/modules/es.array.slice.js b/core-js/modules/es.array.slice.js index ac71ebf78a..27609f5358 100644 --- a/core-js/modules/es.array.slice.js +++ b/core-js/modules/es.array.slice.js @@ -6,8 +6,12 @@ var toAbsoluteIndex = require('../internals/to-absolute-index'); var toLength = require('../internals/to-length'); var toIndexedObject = require('../internals/to-indexed-object'); var createProperty = require('../internals/create-property'); -var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); var wellKnownSymbol = require('../internals/well-known-symbol'); +var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); +var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length'); + +var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice'); +var USES_TO_LENGTH = arrayMethodUsesToLength('slice', { ACCESSORS: true, 0: 0, 1: 2 }); var SPECIES = wellKnownSymbol('species'); var nativeSlice = [].slice; @@ -16,7 +20,7 @@ var max = Math.max; // `Array.prototype.slice` method // https://tc39.github.io/ecma262/#sec-array.prototype.slice // fallback for not array-like ES3 strings and DOM objects -$({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('slice') }, { +$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, { slice: function slice(start, end) { var O = toIndexedObject(this); var length = toLength(O.length); diff --git a/core-js/modules/es.array.some.js b/core-js/modules/es.array.some.js index 60e77ed6dc..e143d07e66 100644 --- a/core-js/modules/es.array.some.js +++ b/core-js/modules/es.array.some.js @@ -1,11 +1,15 @@ 'use strict'; var $ = require('../internals/export'); var $some = require('../internals/array-iteration').some; -var sloppyArrayMethod = require('../internals/sloppy-array-method'); +var arrayMethodIsStrict = require('../internals/array-method-is-strict'); +var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length'); + +var STRICT_METHOD = arrayMethodIsStrict('some'); +var USES_TO_LENGTH = arrayMethodUsesToLength('some'); // `Array.prototype.some` method // https://tc39.github.io/ecma262/#sec-array.prototype.some -$({ target: 'Array', proto: true, forced: sloppyArrayMethod('some') }, { +$({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH }, { some: function some(callbackfn /* , thisArg */) { return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } diff --git a/core-js/modules/es.array.sort.js b/core-js/modules/es.array.sort.js index 40c3f3fea9..1b46f51562 100644 --- a/core-js/modules/es.array.sort.js +++ b/core-js/modules/es.array.sort.js @@ -3,7 +3,7 @@ var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); var toObject = require('../internals/to-object'); var fails = require('../internals/fails'); -var sloppyArrayMethod = require('../internals/sloppy-array-method'); +var arrayMethodIsStrict = require('../internals/array-method-is-strict'); var test = []; var nativeSort = test.sort; @@ -17,9 +17,9 @@ var FAILS_ON_NULL = fails(function () { test.sort(null); }); // Old WebKit -var SLOPPY_METHOD = sloppyArrayMethod('sort'); +var STRICT_METHOD = arrayMethodIsStrict('sort'); -var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD; +var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD; // `Array.prototype.sort` method // https://tc39.github.io/ecma262/#sec-array.prototype.sort diff --git a/core-js/modules/es.array.splice.js b/core-js/modules/es.array.splice.js index aa17d55551..31debcac1f 100644 --- a/core-js/modules/es.array.splice.js +++ b/core-js/modules/es.array.splice.js @@ -7,6 +7,10 @@ var toObject = require('../internals/to-object'); var arraySpeciesCreate = require('../internals/array-species-create'); var createProperty = require('../internals/create-property'); var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); +var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length'); + +var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice'); +var USES_TO_LENGTH = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 }); var max = Math.max; var min = Math.min; @@ -16,7 +20,7 @@ var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; // `Array.prototype.splice` method // https://tc39.github.io/ecma262/#sec-array.prototype.splice // with adding support of @@species -$({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('splice') }, { +$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, { splice: function splice(start, deleteCount /* , ...items */) { var O = toObject(this); var len = toLength(O.length); diff --git a/core-js/modules/es.data-view.js b/core-js/modules/es.data-view.js index c369dd3c89..a45ac41134 100644 --- a/core-js/modules/es.data-view.js +++ b/core-js/modules/es.data-view.js @@ -1,6 +1,6 @@ var $ = require('../internals/export'); var ArrayBufferModule = require('../internals/array-buffer'); -var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-view-core').NATIVE_ARRAY_BUFFER; +var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-native'); // `DataView` constructor // https://tc39.github.io/ecma262/#sec-dataview-constructor diff --git a/core-js/modules/es.number.parse-float.js b/core-js/modules/es.number.parse-float.js index 9d88958026..5310ec1ed7 100644 --- a/core-js/modules/es.number.parse-float.js +++ b/core-js/modules/es.number.parse-float.js @@ -1,5 +1,5 @@ var $ = require('../internals/export'); -var parseFloat = require('../internals/parse-float'); +var parseFloat = require('../internals/number-parse-float'); // `Number.parseFloat` method // https://tc39.github.io/ecma262/#sec-number.parseFloat diff --git a/core-js/modules/es.number.parse-int.js b/core-js/modules/es.number.parse-int.js index c8fcc545e3..7f31df1c06 100644 --- a/core-js/modules/es.number.parse-int.js +++ b/core-js/modules/es.number.parse-int.js @@ -1,5 +1,5 @@ var $ = require('../internals/export'); -var parseInt = require('../internals/parse-int'); +var parseInt = require('../internals/number-parse-int'); // `Number.parseInt` method // https://tc39.github.io/ecma262/#sec-number.parseint diff --git a/core-js/modules/es.object.define-getter.js b/core-js/modules/es.object.define-getter.js index 6cf5974998..0a44e45413 100644 --- a/core-js/modules/es.object.define-getter.js +++ b/core-js/modules/es.object.define-getter.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); -var FORCED = require('../internals/forced-object-prototype-accessors-methods'); +var FORCED = require('../internals/object-prototype-accessors-forced'); var toObject = require('../internals/to-object'); var aFunction = require('../internals/a-function'); var definePropertyModule = require('../internals/object-define-property'); diff --git a/core-js/modules/es.object.define-setter.js b/core-js/modules/es.object.define-setter.js index c0860d5895..4250177ea9 100644 --- a/core-js/modules/es.object.define-setter.js +++ b/core-js/modules/es.object.define-setter.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); -var FORCED = require('../internals/forced-object-prototype-accessors-methods'); +var FORCED = require('../internals/object-prototype-accessors-forced'); var toObject = require('../internals/to-object'); var aFunction = require('../internals/a-function'); var definePropertyModule = require('../internals/object-define-property'); diff --git a/core-js/modules/es.object.lookup-getter.js b/core-js/modules/es.object.lookup-getter.js index 58743ac3c5..46e3fd00f6 100644 --- a/core-js/modules/es.object.lookup-getter.js +++ b/core-js/modules/es.object.lookup-getter.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); -var FORCED = require('../internals/forced-object-prototype-accessors-methods'); +var FORCED = require('../internals/object-prototype-accessors-forced'); var toObject = require('../internals/to-object'); var toPrimitive = require('../internals/to-primitive'); var getPrototypeOf = require('../internals/object-get-prototype-of'); diff --git a/core-js/modules/es.object.lookup-setter.js b/core-js/modules/es.object.lookup-setter.js index e469c45c1d..57d49fad27 100644 --- a/core-js/modules/es.object.lookup-setter.js +++ b/core-js/modules/es.object.lookup-setter.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); -var FORCED = require('../internals/forced-object-prototype-accessors-methods'); +var FORCED = require('../internals/object-prototype-accessors-forced'); var toObject = require('../internals/to-object'); var toPrimitive = require('../internals/to-primitive'); var getPrototypeOf = require('../internals/object-get-prototype-of'); diff --git a/core-js/modules/es.parse-float.js b/core-js/modules/es.parse-float.js index 48194b01f1..1245deb530 100644 --- a/core-js/modules/es.parse-float.js +++ b/core-js/modules/es.parse-float.js @@ -1,5 +1,5 @@ var $ = require('../internals/export'); -var parseFloatImplementation = require('../internals/parse-float'); +var parseFloatImplementation = require('../internals/number-parse-float'); // `parseFloat` method // https://tc39.github.io/ecma262/#sec-parsefloat-string diff --git a/core-js/modules/es.parse-int.js b/core-js/modules/es.parse-int.js index 9e8051b403..b462541afb 100644 --- a/core-js/modules/es.parse-int.js +++ b/core-js/modules/es.parse-int.js @@ -1,5 +1,5 @@ var $ = require('../internals/export'); -var parseIntImplementation = require('../internals/parse-int'); +var parseIntImplementation = require('../internals/number-parse-int'); // `parseInt` method // https://tc39.github.io/ecma262/#sec-parseint-string-radix diff --git a/core-js/modules/es.promise.js b/core-js/modules/es.promise.js index 691f5b322d..b79d2bc259 100644 --- a/core-js/modules/es.promise.js +++ b/core-js/modules/es.promise.js @@ -25,7 +25,7 @@ var perform = require('../internals/perform'); var InternalStateModule = require('../internals/internal-state'); var isForced = require('../internals/is-forced'); var wellKnownSymbol = require('../internals/well-known-symbol'); -var V8_VERSION = require('../internals/v8-version'); +var V8_VERSION = require('../internals/engine-v8-version'); var SPECIES = wellKnownSymbol('species'); var PROMISE = 'Promise'; diff --git a/core-js/modules/es.regexp.test.js b/core-js/modules/es.regexp.test.js index 07c38d9a6b..b2a0df4c68 100644 --- a/core-js/modules/es.regexp.test.js +++ b/core-js/modules/es.regexp.test.js @@ -1,4 +1,6 @@ 'use strict'; +// TODO: Remove from `core-js@4` since it's moved to entry points +require('../modules/es.regexp.exec'); var $ = require('../internals/export'); var isObject = require('../internals/is-object'); diff --git a/core-js/modules/es.string.anchor.js b/core-js/modules/es.string.anchor.js index 3a7fd0d9b0..004cc0a50c 100644 --- a/core-js/modules/es.string.anchor.js +++ b/core-js/modules/es.string.anchor.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); +var forcedStringHTMLMethod = require('../internals/string-html-forced'); // `String.prototype.anchor` method // https://tc39.github.io/ecma262/#sec-string.prototype.anchor diff --git a/core-js/modules/es.string.big.js b/core-js/modules/es.string.big.js index 3e530641a0..3273d00c82 100644 --- a/core-js/modules/es.string.big.js +++ b/core-js/modules/es.string.big.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); +var forcedStringHTMLMethod = require('../internals/string-html-forced'); // `String.prototype.big` method // https://tc39.github.io/ecma262/#sec-string.prototype.big diff --git a/core-js/modules/es.string.blink.js b/core-js/modules/es.string.blink.js index fa4b7b547f..9373820d52 100644 --- a/core-js/modules/es.string.blink.js +++ b/core-js/modules/es.string.blink.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); +var forcedStringHTMLMethod = require('../internals/string-html-forced'); // `String.prototype.blink` method // https://tc39.github.io/ecma262/#sec-string.prototype.blink diff --git a/core-js/modules/es.string.bold.js b/core-js/modules/es.string.bold.js index e0d07e0d39..ea8c48c97c 100644 --- a/core-js/modules/es.string.bold.js +++ b/core-js/modules/es.string.bold.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); +var forcedStringHTMLMethod = require('../internals/string-html-forced'); // `String.prototype.bold` method // https://tc39.github.io/ecma262/#sec-string.prototype.bold diff --git a/core-js/modules/es.string.fixed.js b/core-js/modules/es.string.fixed.js index 5e240e421c..13f8a0433a 100644 --- a/core-js/modules/es.string.fixed.js +++ b/core-js/modules/es.string.fixed.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); +var forcedStringHTMLMethod = require('../internals/string-html-forced'); // `String.prototype.fixed` method // https://tc39.github.io/ecma262/#sec-string.prototype.fixed diff --git a/core-js/modules/es.string.fontcolor.js b/core-js/modules/es.string.fontcolor.js index 50b4f35780..88636c2008 100644 --- a/core-js/modules/es.string.fontcolor.js +++ b/core-js/modules/es.string.fontcolor.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); +var forcedStringHTMLMethod = require('../internals/string-html-forced'); // `String.prototype.fontcolor` method // https://tc39.github.io/ecma262/#sec-string.prototype.fontcolor diff --git a/core-js/modules/es.string.fontsize.js b/core-js/modules/es.string.fontsize.js index dbf2826dae..09c071506c 100644 --- a/core-js/modules/es.string.fontsize.js +++ b/core-js/modules/es.string.fontsize.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); +var forcedStringHTMLMethod = require('../internals/string-html-forced'); // `String.prototype.fontsize` method // https://tc39.github.io/ecma262/#sec-string.prototype.fontsize diff --git a/core-js/modules/es.string.italics.js b/core-js/modules/es.string.italics.js index ce66fbfc86..76bf3e49e1 100644 --- a/core-js/modules/es.string.italics.js +++ b/core-js/modules/es.string.italics.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); +var forcedStringHTMLMethod = require('../internals/string-html-forced'); // `String.prototype.italics` method // https://tc39.github.io/ecma262/#sec-string.prototype.italics diff --git a/core-js/modules/es.string.link.js b/core-js/modules/es.string.link.js index fcd97bbef9..65f823288e 100644 --- a/core-js/modules/es.string.link.js +++ b/core-js/modules/es.string.link.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); +var forcedStringHTMLMethod = require('../internals/string-html-forced'); // `String.prototype.link` method // https://tc39.github.io/ecma262/#sec-string.prototype.link diff --git a/core-js/modules/es.string.pad-end.js b/core-js/modules/es.string.pad-end.js index 5880847261..9108024c49 100644 --- a/core-js/modules/es.string.pad-end.js +++ b/core-js/modules/es.string.pad-end.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var $padEnd = require('../internals/string-pad').end; -var WEBKIT_BUG = require('../internals/webkit-string-pad-bug'); +var WEBKIT_BUG = require('../internals/string-pad-webkit-bug'); // `String.prototype.padEnd` method // https://tc39.github.io/ecma262/#sec-string.prototype.padend diff --git a/core-js/modules/es.string.pad-start.js b/core-js/modules/es.string.pad-start.js index 13e265f0e1..69b788fa01 100644 --- a/core-js/modules/es.string.pad-start.js +++ b/core-js/modules/es.string.pad-start.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var $padStart = require('../internals/string-pad').start; -var WEBKIT_BUG = require('../internals/webkit-string-pad-bug'); +var WEBKIT_BUG = require('../internals/string-pad-webkit-bug'); // `String.prototype.padStart` method // https://tc39.github.io/ecma262/#sec-string.prototype.padstart diff --git a/core-js/modules/es.string.replace.js b/core-js/modules/es.string.replace.js index 6eeb2abdee..b11e30652f 100644 --- a/core-js/modules/es.string.replace.js +++ b/core-js/modules/es.string.replace.js @@ -20,6 +20,10 @@ var maybeToString = function (it) { // @@replace logic fixRegExpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) { + var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE; + var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0; + var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0'; + return [ // `String.prototype.replace` method // https://tc39.github.io/ecma262/#sec-string.prototype.replace @@ -33,7 +37,10 @@ fixRegExpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, ma // `RegExp.prototype[@@replace]` method // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace function (regexp, replaceValue) { - if (reason.REPLACE_KEEPS_$0 || (typeof replaceValue === 'string' && replaceValue.indexOf('$0') === -1)) { + if ( + (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) || + (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1) + ) { var res = maybeCallNative(nativeReplace, regexp, this, replaceValue); if (res.done) return res.value; } diff --git a/core-js/modules/es.string.small.js b/core-js/modules/es.string.small.js index f66b11c4d0..c8587d6538 100644 --- a/core-js/modules/es.string.small.js +++ b/core-js/modules/es.string.small.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); +var forcedStringHTMLMethod = require('../internals/string-html-forced'); // `String.prototype.small` method // https://tc39.github.io/ecma262/#sec-string.prototype.small diff --git a/core-js/modules/es.string.strike.js b/core-js/modules/es.string.strike.js index 81a2ed0031..4f0fa2eff1 100644 --- a/core-js/modules/es.string.strike.js +++ b/core-js/modules/es.string.strike.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); +var forcedStringHTMLMethod = require('../internals/string-html-forced'); // `String.prototype.strike` method // https://tc39.github.io/ecma262/#sec-string.prototype.strike diff --git a/core-js/modules/es.string.sub.js b/core-js/modules/es.string.sub.js index db7949e639..4b901d2d6e 100644 --- a/core-js/modules/es.string.sub.js +++ b/core-js/modules/es.string.sub.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); +var forcedStringHTMLMethod = require('../internals/string-html-forced'); // `String.prototype.sub` method // https://tc39.github.io/ecma262/#sec-string.prototype.sub diff --git a/core-js/modules/es.string.sup.js b/core-js/modules/es.string.sup.js index 46b6e10c0e..3fc0b181c7 100644 --- a/core-js/modules/es.string.sup.js +++ b/core-js/modules/es.string.sup.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); +var forcedStringHTMLMethod = require('../internals/string-html-forced'); // `String.prototype.sup` method // https://tc39.github.io/ecma262/#sec-string.prototype.sup diff --git a/core-js/modules/es.string.trim-end.js b/core-js/modules/es.string.trim-end.js index eec4a08a4b..4db829a987 100644 --- a/core-js/modules/es.string.trim-end.js +++ b/core-js/modules/es.string.trim-end.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var $trimEnd = require('../internals/string-trim').end; -var forcedStringTrimMethod = require('../internals/forced-string-trim-method'); +var forcedStringTrimMethod = require('../internals/string-trim-forced'); var FORCED = forcedStringTrimMethod('trimEnd'); diff --git a/core-js/modules/es.string.trim-start.js b/core-js/modules/es.string.trim-start.js index 882a1871d0..b4f6e43d6e 100644 --- a/core-js/modules/es.string.trim-start.js +++ b/core-js/modules/es.string.trim-start.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var $trimStart = require('../internals/string-trim').start; -var forcedStringTrimMethod = require('../internals/forced-string-trim-method'); +var forcedStringTrimMethod = require('../internals/string-trim-forced'); var FORCED = forcedStringTrimMethod('trimStart'); diff --git a/core-js/modules/es.string.trim.js b/core-js/modules/es.string.trim.js index d71156406f..124768f207 100644 --- a/core-js/modules/es.string.trim.js +++ b/core-js/modules/es.string.trim.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var $trim = require('../internals/string-trim').trim; -var forcedStringTrimMethod = require('../internals/forced-string-trim-method'); +var forcedStringTrimMethod = require('../internals/string-trim-forced'); // `String.prototype.trim` method // https://tc39.github.io/ecma262/#sec-string.prototype.trim diff --git a/core-js/modules/es.symbol.js b/core-js/modules/es.symbol.js index 3fbac06858..07f1ee943a 100644 --- a/core-js/modules/es.symbol.js +++ b/core-js/modules/es.symbol.js @@ -30,7 +30,7 @@ var sharedKey = require('../internals/shared-key'); var hiddenKeys = require('../internals/hidden-keys'); var uid = require('../internals/uid'); var wellKnownSymbol = require('../internals/well-known-symbol'); -var wrappedWellKnownSymbolModule = require('../internals/wrapped-well-known-symbol'); +var wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped'); var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); var setToStringTag = require('../internals/set-to-string-tag'); var InternalStateModule = require('../internals/internal-state'); diff --git a/core-js/modules/es.typed-array.from.js b/core-js/modules/es.typed-array.from.js index a571e1df62..8c21e15dc8 100644 --- a/core-js/modules/es.typed-array.from.js +++ b/core-js/modules/es.typed-array.from.js @@ -1,5 +1,5 @@ 'use strict'; -var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-arrays-constructors-requires-wrappers'); +var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-array-constructors-require-wrappers'); var exportTypedArrayStaticMethod = require('../internals/array-buffer-view-core').exportTypedArrayStaticMethod; var typedArrayFrom = require('../internals/typed-array-from'); diff --git a/core-js/modules/es.typed-array.of.js b/core-js/modules/es.typed-array.of.js index aa1839348c..8bad32b59b 100644 --- a/core-js/modules/es.typed-array.of.js +++ b/core-js/modules/es.typed-array.of.js @@ -1,6 +1,6 @@ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-arrays-constructors-requires-wrappers'); +var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-array-constructors-require-wrappers'); var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor; var exportTypedArrayStaticMethod = ArrayBufferViewCore.exportTypedArrayStaticMethod; diff --git a/core-js/modules/esnext.async-iterator.as-indexed-pairs.js b/core-js/modules/esnext.async-iterator.as-indexed-pairs.js index d0cb60a441..446deee0c1 100644 --- a/core-js/modules/esnext.async-iterator.as-indexed-pairs.js +++ b/core-js/modules/esnext.async-iterator.as-indexed-pairs.js @@ -2,7 +2,7 @@ // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var anObject = require('../internals/an-object'); -var createAsyncIteratorProxy = require('../internals/create-async-iterator-proxy'); +var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy'); var AsyncIteratorProxy = createAsyncIteratorProxy(function (arg, Promise) { var state = this; diff --git a/core-js/modules/esnext.async-iterator.drop.js b/core-js/modules/esnext.async-iterator.drop.js index 5924f855cc..fd2878bca6 100644 --- a/core-js/modules/esnext.async-iterator.drop.js +++ b/core-js/modules/esnext.async-iterator.drop.js @@ -3,7 +3,7 @@ var $ = require('../internals/export'); var anObject = require('../internals/an-object'); var toPositiveInteger = require('../internals/to-positive-integer'); -var createAsyncIteratorProxy = require('../internals/create-async-iterator-proxy'); +var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy'); var AsyncIteratorProxy = createAsyncIteratorProxy(function (arg, Promise) { var state = this; diff --git a/core-js/modules/esnext.async-iterator.filter.js b/core-js/modules/esnext.async-iterator.filter.js index 4861047ef0..2ddbabac10 100644 --- a/core-js/modules/esnext.async-iterator.filter.js +++ b/core-js/modules/esnext.async-iterator.filter.js @@ -3,7 +3,7 @@ var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); -var createAsyncIteratorProxy = require('../internals/create-async-iterator-proxy'); +var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy'); var AsyncIteratorProxy = createAsyncIteratorProxy(function (arg, Promise) { var state = this; diff --git a/core-js/modules/esnext.async-iterator.flat-map.js b/core-js/modules/esnext.async-iterator.flat-map.js index d1e8c2b99b..0613368ce3 100644 --- a/core-js/modules/esnext.async-iterator.flat-map.js +++ b/core-js/modules/esnext.async-iterator.flat-map.js @@ -3,7 +3,7 @@ var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); -var createAsyncIteratorProxy = require('../internals/create-async-iterator-proxy'); +var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy'); var getAsyncIteratorMethod = require('../internals/get-async-iterator-method'); var AsyncIteratorProxy = createAsyncIteratorProxy(function (arg, Promise) { diff --git a/core-js/modules/esnext.async-iterator.from.js b/core-js/modules/esnext.async-iterator.from.js index 025b3e758b..e986a73b28 100644 --- a/core-js/modules/esnext.async-iterator.from.js +++ b/core-js/modules/esnext.async-iterator.from.js @@ -4,7 +4,7 @@ var path = require('../internals/path'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var toObject = require('../internals/to-object'); -var createAsyncIteratorProxy = require('../internals/create-async-iterator-proxy'); +var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy'); var getAsyncIteratorMethod = require('../internals/get-async-iterator-method'); var AsyncIterator = path.AsyncIterator; diff --git a/core-js/modules/esnext.async-iterator.map.js b/core-js/modules/esnext.async-iterator.map.js index d0688dd4a6..a5c2a8ac8f 100644 --- a/core-js/modules/esnext.async-iterator.map.js +++ b/core-js/modules/esnext.async-iterator.map.js @@ -3,7 +3,7 @@ var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); -var createAsyncIteratorProxy = require('../internals/create-async-iterator-proxy'); +var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy'); var AsyncIteratorProxy = createAsyncIteratorProxy(function (arg, Promise) { var state = this; diff --git a/core-js/modules/esnext.async-iterator.take.js b/core-js/modules/esnext.async-iterator.take.js index 396a091af4..fc59d883b2 100644 --- a/core-js/modules/esnext.async-iterator.take.js +++ b/core-js/modules/esnext.async-iterator.take.js @@ -3,7 +3,7 @@ var $ = require('../internals/export'); var anObject = require('../internals/an-object'); var toPositiveInteger = require('../internals/to-positive-integer'); -var createAsyncIteratorProxy = require('../internals/create-async-iterator-proxy'); +var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy'); var AsyncIteratorProxy = createAsyncIteratorProxy(function (arg) { if (!this.remaining--) { diff --git a/core-js/modules/esnext.iterator.as-indexed-pairs.js b/core-js/modules/esnext.iterator.as-indexed-pairs.js index a803d43238..fb3bf857bd 100644 --- a/core-js/modules/esnext.iterator.as-indexed-pairs.js +++ b/core-js/modules/esnext.iterator.as-indexed-pairs.js @@ -2,7 +2,7 @@ // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var anObject = require('../internals/an-object'); -var createIteratorProxy = require('../internals/create-iterator-proxy'); +var createIteratorProxy = require('../internals/iterator-create-proxy'); var IteratorProxy = createIteratorProxy(function (arg) { var result = anObject(this.next.call(this.iterator, arg)); diff --git a/core-js/modules/esnext.iterator.drop.js b/core-js/modules/esnext.iterator.drop.js index 5cf33915b7..62cc89d0f8 100644 --- a/core-js/modules/esnext.iterator.drop.js +++ b/core-js/modules/esnext.iterator.drop.js @@ -3,7 +3,7 @@ var $ = require('../internals/export'); var anObject = require('../internals/an-object'); var toPositiveInteger = require('../internals/to-positive-integer'); -var createIteratorProxy = require('../internals/create-iterator-proxy'); +var createIteratorProxy = require('../internals/iterator-create-proxy'); var IteratorProxy = createIteratorProxy(function (arg) { var iterator = this.iterator; diff --git a/core-js/modules/esnext.iterator.filter.js b/core-js/modules/esnext.iterator.filter.js index 2a779523b5..db45c9beaa 100644 --- a/core-js/modules/esnext.iterator.filter.js +++ b/core-js/modules/esnext.iterator.filter.js @@ -3,7 +3,7 @@ var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); -var createIteratorProxy = require('../internals/create-iterator-proxy'); +var createIteratorProxy = require('../internals/iterator-create-proxy'); var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing'); var IteratorProxy = createIteratorProxy(function (arg) { diff --git a/core-js/modules/esnext.iterator.flat-map.js b/core-js/modules/esnext.iterator.flat-map.js index 6748cb4f5b..0841996bbc 100644 --- a/core-js/modules/esnext.iterator.flat-map.js +++ b/core-js/modules/esnext.iterator.flat-map.js @@ -4,7 +4,7 @@ var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var getIteratorMethod = require('../internals/get-iterator-method'); -var createIteratorProxy = require('../internals/create-iterator-proxy'); +var createIteratorProxy = require('../internals/iterator-create-proxy'); var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing'); var IteratorProxy = createIteratorProxy(function (arg) { diff --git a/core-js/modules/esnext.iterator.from.js b/core-js/modules/esnext.iterator.from.js index dc66d29962..10fa7f2960 100644 --- a/core-js/modules/esnext.iterator.from.js +++ b/core-js/modules/esnext.iterator.from.js @@ -4,7 +4,7 @@ var path = require('../internals/path'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var toObject = require('../internals/to-object'); -var createIteratorProxy = require('../internals/create-iterator-proxy'); +var createIteratorProxy = require('../internals/iterator-create-proxy'); var getIteratorMethod = require('../internals/get-iterator-method'); var Iterator = path.Iterator; diff --git a/core-js/modules/esnext.iterator.map.js b/core-js/modules/esnext.iterator.map.js index c1c0119f0d..054a7d1c78 100644 --- a/core-js/modules/esnext.iterator.map.js +++ b/core-js/modules/esnext.iterator.map.js @@ -3,7 +3,7 @@ var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); -var createIteratorProxy = require('../internals/create-iterator-proxy'); +var createIteratorProxy = require('../internals/iterator-create-proxy'); var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing'); var IteratorProxy = createIteratorProxy(function (arg) { diff --git a/core-js/modules/esnext.iterator.take.js b/core-js/modules/esnext.iterator.take.js index 81a927d386..5ed1cd36d3 100644 --- a/core-js/modules/esnext.iterator.take.js +++ b/core-js/modules/esnext.iterator.take.js @@ -3,7 +3,7 @@ var $ = require('../internals/export'); var anObject = require('../internals/an-object'); var toPositiveInteger = require('../internals/to-positive-integer'); -var createIteratorProxy = require('../internals/create-iterator-proxy'); +var createIteratorProxy = require('../internals/iterator-create-proxy'); var IteratorProxy = createIteratorProxy(function (arg) { if (!this.remaining--) { diff --git a/core-js/modules/esnext.map.every.js b/core-js/modules/esnext.map.every.js index f91460a060..6272c71f5a 100644 --- a/core-js/modules/esnext.map.every.js +++ b/core-js/modules/esnext.map.every.js @@ -2,7 +2,7 @@ var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); diff --git a/core-js/modules/esnext.map.filter.js b/core-js/modules/esnext.map.filter.js index 3813a1f9d0..a140cc0005 100644 --- a/core-js/modules/esnext.map.filter.js +++ b/core-js/modules/esnext.map.filter.js @@ -4,7 +4,7 @@ var IS_PURE = require('../internals/is-pure'); var getBuiltIn = require('../internals/get-built-in'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var speciesConstructor = require('../internals/species-constructor'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); diff --git a/core-js/modules/esnext.map.find-key.js b/core-js/modules/esnext.map.find-key.js index 72634c7947..67489ec680 100644 --- a/core-js/modules/esnext.map.find-key.js +++ b/core-js/modules/esnext.map.find-key.js @@ -2,7 +2,7 @@ var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); diff --git a/core-js/modules/esnext.map.find.js b/core-js/modules/esnext.map.find.js index 2d759af68b..c0a9fed918 100644 --- a/core-js/modules/esnext.map.find.js +++ b/core-js/modules/esnext.map.find.js @@ -2,7 +2,7 @@ var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); diff --git a/core-js/modules/esnext.map.map-keys.js b/core-js/modules/esnext.map.map-keys.js index 05c7ae9112..0d9fdcb414 100644 --- a/core-js/modules/esnext.map.map-keys.js +++ b/core-js/modules/esnext.map.map-keys.js @@ -4,7 +4,7 @@ var IS_PURE = require('../internals/is-pure'); var getBuiltIn = require('../internals/get-built-in'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var speciesConstructor = require('../internals/species-constructor'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); diff --git a/core-js/modules/esnext.map.map-values.js b/core-js/modules/esnext.map.map-values.js index 125fd1030d..8bd5076cfb 100644 --- a/core-js/modules/esnext.map.map-values.js +++ b/core-js/modules/esnext.map.map-values.js @@ -4,7 +4,7 @@ var IS_PURE = require('../internals/is-pure'); var getBuiltIn = require('../internals/get-built-in'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var speciesConstructor = require('../internals/species-constructor'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); diff --git a/core-js/modules/esnext.map.some.js b/core-js/modules/esnext.map.some.js index 822f437d77..56cc03a74e 100644 --- a/core-js/modules/esnext.map.some.js +++ b/core-js/modules/esnext.map.some.js @@ -2,7 +2,7 @@ var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); diff --git a/core-js/modules/esnext.number.from-string.js b/core-js/modules/esnext.number.from-string.js index 2e2c0e94ca..85f1498454 100644 --- a/core-js/modules/esnext.number.from-string.js +++ b/core-js/modules/esnext.number.from-string.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var toInteger = require('../internals/to-integer'); -var parseInt = require('../internals/parse-int'); +var parseInt = require('../internals/number-parse-int'); var INVALID_NUMBER_REPRESENTATION = 'Invalid number representation'; var INVALID_RADIX = 'Invalid radix'; diff --git a/core-js/modules/esnext.set.every.js b/core-js/modules/esnext.set.every.js index c8a8e1d9fb..03813f99b6 100644 --- a/core-js/modules/esnext.set.every.js +++ b/core-js/modules/esnext.set.every.js @@ -2,7 +2,7 @@ var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var getSetIterator = require('../internals/get-set-iterator'); var iterate = require('../internals/iterate'); diff --git a/core-js/modules/esnext.set.filter.js b/core-js/modules/esnext.set.filter.js index aeca99ac95..a40827322b 100644 --- a/core-js/modules/esnext.set.filter.js +++ b/core-js/modules/esnext.set.filter.js @@ -4,7 +4,7 @@ var IS_PURE = require('../internals/is-pure'); var getBuiltIn = require('../internals/get-built-in'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var speciesConstructor = require('../internals/species-constructor'); var getSetIterator = require('../internals/get-set-iterator'); var iterate = require('../internals/iterate'); diff --git a/core-js/modules/esnext.set.find.js b/core-js/modules/esnext.set.find.js index 991ee2e16a..fcfef511ea 100644 --- a/core-js/modules/esnext.set.find.js +++ b/core-js/modules/esnext.set.find.js @@ -2,7 +2,7 @@ var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var getSetIterator = require('../internals/get-set-iterator'); var iterate = require('../internals/iterate'); diff --git a/core-js/modules/esnext.set.map.js b/core-js/modules/esnext.set.map.js index 023a82a93e..e9c6c1415e 100644 --- a/core-js/modules/esnext.set.map.js +++ b/core-js/modules/esnext.set.map.js @@ -4,7 +4,7 @@ var IS_PURE = require('../internals/is-pure'); var getBuiltIn = require('../internals/get-built-in'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var speciesConstructor = require('../internals/species-constructor'); var getSetIterator = require('../internals/get-set-iterator'); var iterate = require('../internals/iterate'); diff --git a/core-js/modules/esnext.set.some.js b/core-js/modules/esnext.set.some.js index abb653eb1f..df8dda8e31 100644 --- a/core-js/modules/esnext.set.some.js +++ b/core-js/modules/esnext.set.some.js @@ -2,7 +2,7 @@ var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var getSetIterator = require('../internals/get-set-iterator'); var iterate = require('../internals/iterate'); diff --git a/core-js/modules/web.timers.js b/core-js/modules/web.timers.js index 0a5fc97481..0a4a7fc4a1 100644 --- a/core-js/modules/web.timers.js +++ b/core-js/modules/web.timers.js @@ -1,6 +1,6 @@ var $ = require('../internals/export'); var global = require('../internals/global'); -var userAgent = require('../internals/user-agent'); +var userAgent = require('../internals/engine-user-agent'); var slice = [].slice; var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check diff --git a/core-js/modules/web.url-search-params.js b/core-js/modules/web.url-search-params.js index 5429fe9f4f..e2b54c7d12 100644 --- a/core-js/modules/web.url-search-params.js +++ b/core-js/modules/web.url-search-params.js @@ -11,7 +11,7 @@ var createIteratorConstructor = require('../internals/create-iterator-constructo var InternalStateModule = require('../internals/internal-state'); var anInstance = require('../internals/an-instance'); var hasOwn = require('../internals/has'); -var bind = require('../internals/bind-context'); +var bind = require('../internals/function-bind-context'); var classof = require('../internals/classof'); var anObject = require('../internals/an-object'); var isObject = require('../internals/is-object'); diff --git a/core-js/modules/web.url.js b/core-js/modules/web.url.js index 6f29c0856a..4e4df4ba15 100644 --- a/core-js/modules/web.url.js +++ b/core-js/modules/web.url.js @@ -12,7 +12,7 @@ var has = require('../internals/has'); var assign = require('../internals/object-assign'); var arrayFrom = require('../internals/array-from'); var codeAt = require('../internals/string-multibyte').codeAt; -var toASCII = require('../internals/punycode-to-ascii'); +var toASCII = require('../internals/string-punycode-to-ascii'); var setToStringTag = require('../internals/set-to-string-tag'); var URLSearchParamsModule = require('../modules/web.url-search-params'); var InternalStateModule = require('../internals/internal-state'); diff --git a/core-js/package.json b/core-js/package.json index 9d77ef022d..a421d770b7 100644 --- a/core-js/package.json +++ b/core-js/package.json @@ -1,7 +1,7 @@ { "name": "core-js", "description": "Standard library", - "version": "3.6.1", + "version": "3.6.3", "repository": { "type": "git", "url": "https://github.com/zloirock/core-js.git" diff --git a/danger/changelog/Dangerfile b/danger/changelog/Dangerfile index 62b41d14be..8c010accd5 100644 --- a/danger/changelog/Dangerfile +++ b/danger/changelog/Dangerfile @@ -26,7 +26,7 @@ def check_changelog(path) fail "`title` should be set, in #{gitlab.html_link(path)}! #{SEE_DOC}" if yaml["title"].nil? fail "`type` should be set, in #{gitlab.html_link(path)}! #{SEE_DOC}" if yaml["type"].nil? - if yaml["merge_request"].nil? + if yaml["merge_request"].nil? && !helper.security_mr? message "Consider setting `merge_request` to #{gitlab.mr_json["iid"]} in #{gitlab.html_link(path)}. #{SEE_DOC}" elsif yaml["merge_request"] != gitlab.mr_json["iid"] && !changelog.ce_port_changelog?(path) fail "Merge request ID was not set to #{gitlab.mr_json["iid"]}! #{SEE_DOC}" diff --git a/danger/metadata/Dangerfile b/danger/metadata/Dangerfile index f2d68e64eb..5edd134cba 100644 --- a/danger/metadata/Dangerfile +++ b/danger/metadata/Dangerfile @@ -32,7 +32,7 @@ end has_pick_into_stable_label = gitlab.mr_labels.find { |label| label.start_with?('Pick into') } -if gitlab.branch_for_base != "master" && !has_pick_into_stable_label +if gitlab.branch_for_base != "master" && !has_pick_into_stable_label && !helper.security_mr? warn "Most of the time, merge requests should target `master`. Otherwise, please set the relevant `Pick into X.Y` label." end diff --git a/doc/user/project/clusters/serverless/index.md b/doc/user/project/clusters/serverless/index.md index ae04dbab1a..9aaf046e78 100644 --- a/doc/user/project/clusters/serverless/index.md +++ b/doc/user/project/clusters/serverless/index.md @@ -118,8 +118,7 @@ You must do the following: 1. Ensure GitLab can manage Knative: - For a non-GitLab managed cluster, ensure that the service account for the token - provided can manage resources in the `serving.knative.dev` API group. It will also - need list access to the deployments in the `knative-serving` namespace. + provided can manage resources in the `serving.knative.dev` API group. - For a GitLab managed cluster, if you added the cluster in [GitLab 12.1 or later](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/30235), then GitLab will already have the required access and you can proceed to the next step. @@ -156,19 +155,6 @@ You must do the following: - delete - patch - watch - --- - apiVersion: rbac.authorization.k8s.io/v1 - kind: ClusterRole - metadata: - name: gitlab-knative-version-role - rules: - - apiGroups: - - apps - resources: - - deployments - verbs: - - list - - get ``` Then run the following command: diff --git a/lib/gitlab/ci/build/prerequisite/kubernetes_namespace.rb b/lib/gitlab/ci/build/prerequisite/kubernetes_namespace.rb index 465877871e..b64990d6a7 100644 --- a/lib/gitlab/ci/build/prerequisite/kubernetes_namespace.rb +++ b/lib/gitlab/ci/build/prerequisite/kubernetes_namespace.rb @@ -8,7 +8,7 @@ module Gitlab def unmet? deployment_cluster.present? && deployment_cluster.managed? && - (missing_namespace? || need_knative_version_role_binding?) + missing_namespace? end def complete! @@ -23,10 +23,6 @@ module Gitlab kubernetes_namespace.nil? || kubernetes_namespace.service_account_token.blank? end - def need_knative_version_role_binding? - !knative_serving_namespace.nil? && knative_version_role_binding.nil? - end - def deployment_cluster build.deployment&.cluster end @@ -35,22 +31,6 @@ module Gitlab build.deployment.environment end - def knative_serving_namespace - strong_memoize(:knative_serving_namespace) do - Clusters::KnativeServingNamespaceFinder.new( - deployment_cluster - ).execute - end - end - - def knative_version_role_binding - strong_memoize(:knative_version_role_binding) do - Clusters::KnativeVersionRoleBindingFinder.new( - deployment_cluster - ).execute - end - end - def kubernetes_namespace strong_memoize(:kubernetes_namespace) do Clusters::KubernetesNamespaceFinder.new( diff --git a/lib/gitlab/ci/config/entry/artifacts.rb b/lib/gitlab/ci/config/entry/artifacts.rb index 9d8d767523..aebc1675be 100644 --- a/lib/gitlab/ci/config/entry/artifacts.rb +++ b/lib/gitlab/ci/config/entry/artifacts.rb @@ -54,6 +54,11 @@ module Gitlab def expose_as_present? return false unless Feature.enabled?(:ci_expose_arbitrary_artifacts_in_mr, default_enabled: true) + # This duplicates the `validates :config, type: Hash` above, + # but Validatable currently doesn't halt the validation + # chain if it encounters a validation error. + return false unless @config.is_a?(Hash) + !@config[:expose_as].nil? end end diff --git a/lib/gitlab/danger/helper.rb b/lib/gitlab/danger/helper.rb index cd7d617509..90cef384a1 100644 --- a/lib/gitlab/danger/helper.rb +++ b/lib/gitlab/danger/helper.rb @@ -174,6 +174,12 @@ module Gitlab labels - current_mr_labels end + def security_mr? + return false unless gitlab_helper + + gitlab_helper.mr_json['web_url'].include?('/gitlab-org/security/') + end + private def has_database_scoped_labels?(current_mr_labels) diff --git a/lib/gitlab/kubernetes/cluster_role.rb b/lib/gitlab/kubernetes/cluster_role.rb deleted file mode 100644 index 4d40736a0b..0000000000 --- a/lib/gitlab/kubernetes/cluster_role.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module Kubernetes - class ClusterRole - attr_reader :name, :rules - - def initialize(name:, rules:) - @name = name - @rules = rules - end - - def generate - ::Kubeclient::Resource.new( - metadata: metadata, - rules: rules - ) - end - - private - - def metadata - { - name: name - } - end - end - end -end diff --git a/lib/gitlab/kubernetes/kube_client.rb b/lib/gitlab/kubernetes/kube_client.rb index b23ca09541..66c28a9b70 100644 --- a/lib/gitlab/kubernetes/kube_client.rb +++ b/lib/gitlab/kubernetes/kube_client.rb @@ -56,7 +56,6 @@ module Gitlab # group client delegate :create_cluster_role_binding, :get_cluster_role_binding, - :get_cluster_role_bindings, :update_cluster_role_binding, to: :rbac_client @@ -67,13 +66,6 @@ module Gitlab :update_role, to: :rbac_client - # RBAC methods delegates to the apis/rbac.authorization.k8s.io api - # group client - delegate :create_cluster_role, - :get_cluster_role, - :update_cluster_role, - to: :rbac_client - # RBAC methods delegates to the apis/rbac.authorization.k8s.io api # group client delegate :create_role_binding, diff --git a/lib/gitlab/metrics.rb b/lib/gitlab/metrics.rb index 61ed20ad62..d759ae2405 100644 --- a/lib/gitlab/metrics.rb +++ b/lib/gitlab/metrics.rb @@ -5,8 +5,14 @@ module Gitlab include Gitlab::Metrics::InfluxDb include Gitlab::Metrics::Prometheus + @error = false + def self.enabled? influx_metrics_enabled? || prometheus_metrics_enabled? end + + def self.error? + @error + end end end diff --git a/lib/gitlab/metrics/prometheus.rb b/lib/gitlab/metrics/prometheus.rb index cab1edab48..757762499a 100644 --- a/lib/gitlab/metrics/prometheus.rb +++ b/lib/gitlab/metrics/prometheus.rb @@ -61,6 +61,22 @@ module Gitlab safe_provide_metric(:histogram, name, docstring, base_labels, buckets) end + def error_detected! + set_error!(true) + end + + def clear_errors! + set_error!(false) + end + + def set_error!(status) + clear_memoization(:prometheus_metrics_enabled) + + PROVIDER_MUTEX.synchronize do + @error = status + end + end + private def safe_provide_metric(method, name, *args) @@ -81,7 +97,7 @@ module Gitlab end def prometheus_metrics_enabled_unmemoized - metrics_folder_present? && Gitlab::CurrentSettings.prometheus_metrics_enabled || false + !error? && metrics_folder_present? && Gitlab::CurrentSettings.prometheus_metrics_enabled || false end end end diff --git a/lib/gitlab/plugin.rb b/lib/gitlab/plugin.rb index 23353f3602..b6700f4733 100644 --- a/lib/gitlab/plugin.rb +++ b/lib/gitlab/plugin.rb @@ -2,10 +2,16 @@ module Gitlab module Plugin + def self.any? + plugin_glob.any? { |entry| File.file?(entry) } + end + def self.files - Dir.glob(Rails.root.join('plugins/*')).select do |entry| - File.file?(entry) - end + plugin_glob.select { |entry| File.file?(entry) } + end + + def self.plugin_glob + Dir.glob(Rails.root.join('plugins/*')) end def self.execute_all_async(data) diff --git a/scripts/static-analysis b/scripts/static-analysis index 1392a4f6a2..c26c9a55bb 100755 --- a/scripts/static-analysis +++ b/scripts/static-analysis @@ -26,6 +26,19 @@ def emit_errors(static_analysis) end end +ALLOWED_WARNINGS = [ + # https://github.com/browserslist/browserslist/blob/d0ec62eb48c41c218478cd3ac28684df051cc865/node.js#L329 + # warns if caniuse-lite package is older than 6 months. Ignore this + # warning message so that GitLab backports don't fail. + "Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`" +].freeze + +def warning_count(static_analysis) + static_analysis.warned_results + .reject { |result| ALLOWED_WARNINGS.include?(result.stderr.strip) } + .count +end + def jobs_to_run(node_index, node_total) all_tasks = [ %w[bin/rake lint:all], @@ -81,7 +94,7 @@ elsif static_analysis.all_success? emit_warnings(static_analysis) - exit 2 + exit 2 if warning_count(static_analysis).nonzero? else puts 'Some static analyses failed:' diff --git a/spec/features/boards/sidebar_spec.rb b/spec/features/boards/sidebar_spec.rb index 2b923df40c..9143db16b8 100644 --- a/spec/features/boards/sidebar_spec.rb +++ b/spec/features/boards/sidebar_spec.rb @@ -318,6 +318,7 @@ describe 'Issue Boards', :js do wait_for_requests click_link bug.title + within('.dropdown-menu-labels') { expect(page).to have_selector('.is-active', count: 3) } click_link regression.title wait_for_requests diff --git a/spec/features/projects/releases/user_views_releases_spec.rb b/spec/features/projects/releases/user_views_releases_spec.rb index a9b8ff9dc4..4507d90576 100644 --- a/spec/features/projects/releases/user_views_releases_spec.rb +++ b/spec/features/projects/releases/user_views_releases_spec.rb @@ -57,4 +57,14 @@ describe 'User views releases', :js do expect(page).to have_content('Upcoming Release') end end + + context 'with a tag containing a slash' do + it 'sees the release' do + release = create :release, :with_evidence, project: project, tag: 'debian/2.4.0-1' + visit project_releases_path(project) + + expect(page).to have_content(release.name) + expect(page).to have_content(release.tag) + end + end end diff --git a/spec/finders/clusters/knative_serving_namespace_finder_spec.rb b/spec/finders/clusters/knative_serving_namespace_finder_spec.rb deleted file mode 100644 index f3587df680..0000000000 --- a/spec/finders/clusters/knative_serving_namespace_finder_spec.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe Clusters::KnativeServingNamespaceFinder do - include KubernetesHelpers - let(:cluster) { create(:cluster, :project, :provided_by_gcp) } - let(:service) { environment.deployment_platform } - let(:project) { cluster.cluster_project.project } - let(:environment) { create(:environment, project: project) } - - subject { described_class.new(cluster) } - - before do - stub_kubeclient_discover(service.api_url) - end - - it 'finds the namespace in a cluster where it exists' do - stub_kubeclient_get_namespace(service.api_url, namespace: Clusters::Kubernetes::KNATIVE_SERVING_NAMESPACE) - expect(subject.execute).to be_a Kubeclient::Resource - end - - it 'returns nil in a cluster where it does not' do - stub_kubeclient_get_namespace( - service.api_url, - namespace: Clusters::Kubernetes::KNATIVE_SERVING_NAMESPACE, - response: { - status: [404, "Resource Not Found"] - } - ) - expect(subject.execute).to be nil - end - - it 'returns nil in a cluster where the lookup results in a 403 as it will in some versions of kubernetes' do - stub_kubeclient_get_namespace( - service.api_url, - namespace: Clusters::Kubernetes::KNATIVE_SERVING_NAMESPACE, - response: { - status: [403, "Resource Not Found"] - } - ) - expect(subject.execute).to be nil - end - - it 'raises an error if error code is not 404 or 403' do - stub_kubeclient_get_namespace( - service.api_url, - namespace: Clusters::Kubernetes::KNATIVE_SERVING_NAMESPACE, - response: { - status: [500, "Internal Server Error"] - } - ) - expect { subject.execute }.to raise_error(Kubeclient::HttpError) - end -end diff --git a/spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb b/spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb index 2493855f85..66240380ed 100644 --- a/spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb +++ b/spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb @@ -38,45 +38,13 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do .and_return(double(execute: kubernetes_namespace)) end - context 'and the knative-serving namespace is missing' do - before do - allow(Clusters::KnativeServingNamespaceFinder).to receive(:new) - .and_return(double(execute: false)) - end + it { is_expected.to be_falsey } + + context 'and the service_account_token is blank' do + let(:kubernetes_namespace) { instance_double(Clusters::KubernetesNamespace, service_account_token: nil) } it { is_expected.to be_truthy } end - - context 'and the knative-serving namespace exists' do - before do - allow(Clusters::KnativeServingNamespaceFinder).to receive(:new) - .and_return(double(execute: true)) - end - - context 'and the knative version role binding is missing' do - before do - allow(Clusters::KnativeVersionRoleBindingFinder).to receive(:new) - .and_return(double(execute: nil)) - end - - it { is_expected.to be_truthy } - end - - context 'and the knative version role binding already exists' do - before do - allow(Clusters::KnativeVersionRoleBindingFinder).to receive(:new) - .and_return(double(execute: true)) - end - - it { is_expected.to be_falsey } - - context 'and the service_account_token is blank' do - let(:kubernetes_namespace) { instance_double(Clusters::KubernetesNamespace, service_account_token: nil) } - - it { is_expected.to be_truthy } - end - end - end end end @@ -188,24 +156,6 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do subject end end - - context 'knative version role binding is missing' do - before do - allow(Clusters::KubernetesNamespaceFinder).to receive(:new) - .and_return(double(execute: kubernetes_namespace)) - allow(Clusters::KnativeVersionRoleBindingFinder).to receive(:new) - .and_return(double(execute: nil)) - end - - it 'creates the knative version role binding' do - expect(Clusters::Kubernetes::CreateOrUpdateNamespaceService) - .to receive(:new) - .with(cluster: cluster, kubernetes_namespace: kubernetes_namespace) - .and_return(service) - - subject - end - end end context 'completion is not required' do diff --git a/spec/lib/gitlab/ci/yaml_processor_spec.rb b/spec/lib/gitlab/ci/yaml_processor_spec.rb index 8f9c5c7426..fea8073f99 100644 --- a/spec/lib/gitlab/ci/yaml_processor_spec.rb +++ b/spec/lib/gitlab/ci/yaml_processor_spec.rb @@ -1255,6 +1255,19 @@ module Gitlab expect(builds.first[:options][:artifacts][:when]).to eq(when_state) end end + + it "gracefully handles errors in artifacts type" do + config = <<~YAML + test: + script: + - echo "Hello world" + artifacts: + - paths: + - test/ + YAML + + expect { described_class.new(config) }.to raise_error(described_class::ValidationError) + end end describe '#environment' do diff --git a/spec/lib/gitlab/danger/changelog_spec.rb b/spec/lib/gitlab/danger/changelog_spec.rb index 888094eaf6..689957993e 100644 --- a/spec/lib/gitlab/danger/changelog_spec.rb +++ b/spec/lib/gitlab/danger/changelog_spec.rb @@ -34,6 +34,7 @@ describe Gitlab::Danger::Changelog do { docs: nil, none: nil } ].each do |categories| let(:changes_by_category) { categories } + it "is falsy when categories don't require a changelog" do is_expected.to be_falsy end diff --git a/spec/lib/gitlab/danger/helper_spec.rb b/spec/lib/gitlab/danger/helper_spec.rb index d7e67444fc..edcd020a10 100644 --- a/spec/lib/gitlab/danger/helper_spec.rb +++ b/spec/lib/gitlab/danger/helper_spec.rb @@ -312,4 +312,26 @@ describe Gitlab::Danger::Helper do it { is_expected.to match_array(['database', 'database::review pending']) } end end + + describe '#security_mr?' do + it 'returns false when `gitlab_helper` is unavailable' do + expect(helper).to receive(:gitlab_helper).and_return(nil) + + expect(helper).not_to be_security_mr + end + + it 'returns false when on a normal merge request' do + expect(fake_gitlab).to receive(:mr_json) + .and_return('web_url' => 'https://gitlab.com/gitlab-org/gitlab/merge_requests/1') + + expect(helper).not_to be_security_mr + end + + it 'returns true when on a security merge request' do + expect(fake_gitlab).to receive(:mr_json) + .and_return('web_url' => 'https://gitlab.com/gitlab-org/security/gitlab/merge_requests/1') + + expect(helper).to be_security_mr + end + end end diff --git a/spec/lib/gitlab/metrics/prometheus_spec.rb b/spec/lib/gitlab/metrics/prometheus_spec.rb index b37624982e..e15a063fc9 100644 --- a/spec/lib/gitlab/metrics/prometheus_spec.rb +++ b/spec/lib/gitlab/metrics/prometheus_spec.rb @@ -6,6 +6,10 @@ describe Gitlab::Metrics::Prometheus, :prometheus do let(:all_metrics) { Gitlab::Metrics } let(:registry) { all_metrics.registry } + after do + all_metrics.clear_errors! + end + describe '#reset_registry!' do it 'clears existing metrics' do registry.counter(:test, 'test metric') @@ -17,4 +21,21 @@ describe Gitlab::Metrics::Prometheus, :prometheus do expect(all_metrics.registry.metrics.count).to eq(0) end end + + describe '#error_detected!' do + before do + allow(all_metrics).to receive(:metrics_folder_present?).and_return(true) + stub_application_setting(prometheus_metrics_enabled: true) + end + + it 'disables Prometheus metrics' do + expect(all_metrics.error?).to be_falsey + expect(all_metrics.prometheus_metrics_enabled?).to be_truthy + + all_metrics.error_detected! + + expect(all_metrics.prometheus_metrics_enabled?).to be_falsey + expect(all_metrics.error?).to be_truthy + end + end end diff --git a/spec/lib/gitlab/plugin_spec.rb b/spec/lib/gitlab/plugin_spec.rb index a8ddd774f3..5d9f6d04ca 100644 --- a/spec/lib/gitlab/plugin_spec.rb +++ b/spec/lib/gitlab/plugin_spec.rb @@ -3,22 +3,59 @@ require 'spec_helper' describe Gitlab::Plugin do + let(:plugin) { Rails.root.join('plugins', 'test.rb') } + let(:tmp_file) { Tempfile.new('plugin-dump') } + + let(:plugin_source) do + <<~EOS + #!/usr/bin/env ruby + x = STDIN.read + File.write('#{tmp_file.path}', x) + EOS + end + + context 'with plugins present' do + before do + File.write(plugin, plugin_source) + end + + after do + FileUtils.rm(plugin) + end + + describe '.any?' do + it 'returns true' do + expect(described_class.any?).to be true + end + end + + describe '.files?' do + it 'returns a list of plugins' do + expect(described_class.files).to match_array([plugin.to_s]) + end + end + end + + context 'without any plugins' do + describe '.any?' do + it 'returns false' do + expect(described_class.any?).to be false + end + end + + describe '.files' do + it 'returns an empty list' do + expect(described_class.files).to be_empty + end + end + end + describe '.execute' do let(:data) { Gitlab::DataBuilder::Push::SAMPLE_DATA } - let(:plugin) { Rails.root.join('plugins', 'test.rb') } - let(:tmp_file) { Tempfile.new('plugin-dump') } let(:result) { described_class.execute(plugin.to_s, data) } let(:success) { result.first } let(:message) { result.last } - let(:plugin_source) do - <<~EOS - #!/usr/bin/env ruby - x = STDIN.read - File.write('#{tmp_file.path}', x) - EOS - end - before do File.write(plugin, plugin_source) end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 99d7e4d156..d55530bf82 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -4714,6 +4714,13 @@ describe Project do expect(project.has_active_hooks?(:merge_request_events)).to be_falsey expect(project.has_active_hooks?).to be_truthy end + + it 'returns true when a plugin exists' do + expect(Gitlab::Plugin).to receive(:any?).twice.and_return(true) + + expect(project.has_active_hooks?(:merge_request_events)).to be_truthy + expect(project.has_active_hooks?).to be_truthy + end end describe '#has_active_services?' do diff --git a/spec/presenters/release_presenter_spec.rb b/spec/presenters/release_presenter_spec.rb index 2f978b0a03..4c6142f2ed 100644 --- a/spec/presenters/release_presenter_spec.rb +++ b/spec/presenters/release_presenter_spec.rb @@ -96,4 +96,28 @@ describe ReleasePresenter do it { is_expected.to be_nil } end end + + describe '#evidence_file_path' do + subject { presenter.evidence_file_path } + + context 'without evidence' do + it { is_expected.to be_falsy } + end + + context 'with evidence' do + let(:release) { create :release, :with_evidence, project: project } + + specify do + is_expected.to match /#{evidence_project_release_url(project, release.tag, format: :json)}/ + end + end + + context 'when a tag contains a slash' do + let(:release) { create :release, :with_evidence, project: project, tag: 'debian/2.4.0-1' } + + specify do + is_expected.to match /#{evidence_project_release_url(project, CGI.escape(release.tag), format: :json)}/ + end + end + end end diff --git a/spec/requests/api/releases_spec.rb b/spec/requests/api/releases_spec.rb index 233f0497b7..d3fe4c22b1 100644 --- a/spec/requests/api/releases_spec.rb +++ b/spec/requests/api/releases_spec.rb @@ -115,6 +115,16 @@ describe API::Releases do end end + context 'when tag contains a slash' do + let!(:release) { create(:release, project: project, tag: 'debian/2.4.0-1', description: "debian/2.4.0-1") } + + it 'returns 200 HTTP status' do + get api("/projects/#{project.id}/releases", maintainer) + + expect(response).to have_gitlab_http_status(:ok) + end + end + context 'when user is a guest' do let!(:release) do create(:release, diff --git a/spec/services/ci/find_exposed_artifacts_service_spec.rb b/spec/services/ci/find_exposed_artifacts_service_spec.rb index f6309822fe..b0f190b0e7 100644 --- a/spec/services/ci/find_exposed_artifacts_service_spec.rb +++ b/spec/services/ci/find_exposed_artifacts_service_spec.rb @@ -50,10 +50,39 @@ describe Ci::FindExposedArtifactsService do end end + shared_examples 'does not find any matches' do + it 'returns empty array' do + expect(subject).to eq [] + end + end + let_it_be(:pipeline) { create(:ci_pipeline, project: project) } subject { described_class.new(project, user).for_pipeline(pipeline) } + context 'with jobs having no exposed artifacts' do + let!(:job) do + create_job_with_artifacts(artifacts: { + paths: ['other_artifacts_0.1.2/doc_sample.txt', 'something-else.html'] + }) + end + + it_behaves_like 'does not find any matches' + end + + context 'with jobs having no artifacts (metadata)' do + let!(:job) do + create(:ci_build, pipeline: pipeline, options: { + artifacts: { + expose_as: 'Exposed artifact', + paths: ['other_artifacts_0.1.2/doc_sample.txt', 'something-else.html'] + } + }) + end + + it_behaves_like 'does not find any matches' + end + context 'with jobs having at most 1 matching exposed artifact' do let!(:job) do create_job_with_artifacts(artifacts: { diff --git a/spec/services/clusters/aws/provision_service_spec.rb b/spec/services/clusters/aws/provision_service_spec.rb index 927ffaef00..15571c64e1 100644 --- a/spec/services/clusters/aws/provision_service_spec.rb +++ b/spec/services/clusters/aws/provision_service_spec.rb @@ -35,7 +35,7 @@ describe Clusters::Aws::ProvisionService do before do allow(Clusters::Aws::FetchCredentialsService).to receive(:new) - .with(provision_role, provider: provider, region: provider.region) + .with(provision_role, provider: provider) .and_return(double(execute: credentials)) allow(provider).to receive(:api_client) diff --git a/spec/services/clusters/kubernetes/create_or_update_namespace_service_spec.rb b/spec/services/clusters/kubernetes/create_or_update_namespace_service_spec.rb index 5dc4a1dc0b..bd1a90996a 100644 --- a/spec/services/clusters/kubernetes/create_or_update_namespace_service_spec.rb +++ b/spec/services/clusters/kubernetes/create_or_update_namespace_service_spec.rb @@ -22,6 +22,7 @@ describe Clusters::Kubernetes::CreateOrUpdateNamespaceService, '#execute' do before do stub_kubeclient_discover(api_url) + stub_kubeclient_get_namespace(api_url) stub_kubeclient_get_service_account_error(api_url, 'gitlab') stub_kubeclient_create_service_account(api_url) stub_kubeclient_get_secret_error(api_url, 'gitlab-token') @@ -30,7 +31,6 @@ describe Clusters::Kubernetes::CreateOrUpdateNamespaceService, '#execute' do stub_kubeclient_get_role_binding(api_url, "gitlab-#{namespace}", namespace: namespace) stub_kubeclient_put_role_binding(api_url, "gitlab-#{namespace}", namespace: namespace) stub_kubeclient_get_namespace(api_url, namespace: namespace) - stub_kubeclient_get_namespace(api_url, namespace: Clusters::Kubernetes::KNATIVE_SERVING_NAMESPACE) stub_kubeclient_get_service_account_error(api_url, "#{namespace}-service-account", namespace: namespace) stub_kubeclient_create_service_account(api_url, namespace: namespace) stub_kubeclient_create_secret(api_url, namespace: namespace) @@ -39,8 +39,6 @@ describe Clusters::Kubernetes::CreateOrUpdateNamespaceService, '#execute' do stub_kubeclient_put_role_binding(api_url, Clusters::Kubernetes::GITLAB_KNATIVE_SERVING_ROLE_BINDING_NAME, namespace: namespace) stub_kubeclient_put_role(api_url, Clusters::Kubernetes::GITLAB_CROSSPLANE_DATABASE_ROLE_NAME, namespace: namespace) stub_kubeclient_put_role_binding(api_url, Clusters::Kubernetes::GITLAB_CROSSPLANE_DATABASE_ROLE_BINDING_NAME, namespace: namespace) - stub_kubeclient_put_cluster_role(api_url, Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_NAME) - stub_kubeclient_put_cluster_role_binding(api_url, Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_BINDING_NAME) stub_kubeclient_get_secret( api_url, diff --git a/spec/services/clusters/kubernetes/create_or_update_service_account_service_spec.rb b/spec/services/clusters/kubernetes/create_or_update_service_account_service_spec.rb index 1ca3c50c46..4df73fcc2a 100644 --- a/spec/services/clusters/kubernetes/create_or_update_service_account_service_spec.rb +++ b/spec/services/clusters/kubernetes/create_or_update_service_account_service_spec.rb @@ -141,15 +141,12 @@ describe Clusters::Kubernetes::CreateOrUpdateServiceAccountService do before do cluster.platform_kubernetes.rbac! - stub_kubeclient_get_namespace(api_url, namespace: Clusters::Kubernetes::KNATIVE_SERVING_NAMESPACE) stub_kubeclient_get_role_binding_error(api_url, role_binding_name, namespace: namespace) stub_kubeclient_create_role_binding(api_url, namespace: namespace) stub_kubeclient_put_role(api_url, Clusters::Kubernetes::GITLAB_KNATIVE_SERVING_ROLE_NAME, namespace: namespace) stub_kubeclient_put_role_binding(api_url, Clusters::Kubernetes::GITLAB_KNATIVE_SERVING_ROLE_BINDING_NAME, namespace: namespace) stub_kubeclient_put_role(api_url, Clusters::Kubernetes::GITLAB_CROSSPLANE_DATABASE_ROLE_NAME, namespace: namespace) stub_kubeclient_put_role_binding(api_url, Clusters::Kubernetes::GITLAB_CROSSPLANE_DATABASE_ROLE_BINDING_NAME, namespace: namespace) - stub_kubeclient_put_cluster_role(api_url, Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_NAME) - stub_kubeclient_put_cluster_role_binding(api_url, Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_BINDING_NAME) end it_behaves_like 'creates service account and token' @@ -237,30 +234,6 @@ describe Clusters::Kubernetes::CreateOrUpdateServiceAccountService do ) ) end - - it 'creates a role and role binding granting the ability to get the version of deployments in knative-serving namespace' do - subject - - expect(WebMock).to have_requested(:put, api_url + "/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/#{Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_BINDING_NAME}").with( - body: hash_including( - metadata: { - name: Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_BINDING_NAME - }, - roleRef: { - apiGroup: "rbac.authorization.k8s.io", - kind: "ClusterRole", - name: Clusters::Kubernetes::GITLAB_KNATIVE_VERSION_ROLE_NAME - }, - subjects: [ - { - kind: "ServiceAccount", - name: service_account_name, - namespace: namespace - } - ] - ) - ) - end end end end diff --git a/spec/services/clusters/kubernetes_spec.rb b/spec/services/clusters/kubernetes_spec.rb index 7f2c5e0461..09cc304deb 100644 --- a/spec/services/clusters/kubernetes_spec.rb +++ b/spec/services/clusters/kubernetes_spec.rb @@ -13,7 +13,4 @@ describe Clusters::Kubernetes do it { is_expected.to be_const_defined(:GITLAB_KNATIVE_SERVING_ROLE_BINDING_NAME) } it { is_expected.to be_const_defined(:GITLAB_CROSSPLANE_DATABASE_ROLE_NAME) } it { is_expected.to be_const_defined(:GITLAB_CROSSPLANE_DATABASE_ROLE_BINDING_NAME) } - it { is_expected.to be_const_defined(:GITLAB_KNATIVE_VERSION_ROLE_NAME) } - it { is_expected.to be_const_defined(:GITLAB_KNATIVE_VERSION_ROLE_BINDING_NAME) } - it { is_expected.to be_const_defined(:KNATIVE_SERVING_NAMESPACE) } end diff --git a/spec/support/helpers/kubernetes_helpers.rb b/spec/support/helpers/kubernetes_helpers.rb index b2145ca729..9435a0e148 100644 --- a/spec/support/helpers/kubernetes_helpers.rb +++ b/spec/support/helpers/kubernetes_helpers.rb @@ -194,11 +194,6 @@ module KubernetesHelpers .to_return(kube_response({})) end - def stub_kubeclient_put_cluster_role_binding(api_url, name) - WebMock.stub_request(:put, api_url + "/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/#{name}") - .to_return(kube_response({})) - end - def stub_kubeclient_get_role_binding(api_url, name, namespace: 'default') WebMock.stub_request(:get, api_url + "/apis/rbac.authorization.k8s.io/v1/namespaces/#{namespace}/rolebindings/#{name}") .to_return(kube_response({})) @@ -224,18 +219,8 @@ module KubernetesHelpers .to_return(kube_response({})) end - def stub_kubeclient_get_namespaces(api_url) - WebMock.stub_request(:get, api_url + '/api/v1/namespaces') - .to_return(kube_response(kube_v1_namespace_list_body)) - end - - def stub_kubeclient_get_namespace(api_url, namespace: 'default', response: kube_response({})) + def stub_kubeclient_get_namespace(api_url, namespace: 'default') WebMock.stub_request(:get, api_url + "/api/v1/namespaces/#{namespace}") - .to_return(response) - end - - def stub_kubeclient_put_cluster_role(api_url, name) - WebMock.stub_request(:put, api_url + "/apis/rbac.authorization.k8s.io/v1/clusterroles/#{name}") .to_return(kube_response({})) end @@ -272,20 +257,6 @@ module KubernetesHelpers } end - def kube_v1_namespace_list_body - { - "kind" => "NamespaceList", - "apiVersion" => "v1", - "items" => [ - { - "metadata" => { - "name" => "knative-serving" - } - } - ] - } - end - def kube_v1beta1_discovery_body { "kind" => "APIResourceList",