diff --git a/CHANGELOG.md b/CHANGELOG.md index dfd4e80477a9..efc8b7992c97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Changelog ##### Unreleased -- Nothing +- Fixed regression of V8 on Node 0.12 `Sting(Symbol())` bug, [#933](https://github.com/zloirock/core-js/issues/933) ##### 3.11.3 - 2021.05.05 - Native promise-based APIs `Promise#{ catch, finally }` returns polyfilled `Promise` instances when it's required diff --git a/packages/core-js/internals/engine-v8-version.js b/packages/core-js/internals/engine-v8-version.js index 1ff22c30aef0..fd915aa69af3 100644 --- a/packages/core-js/internals/engine-v8-version.js +++ b/packages/core-js/internals/engine-v8-version.js @@ -8,7 +8,7 @@ var match, version; if (v8) { match = v8.split('.'); - version = match[0] + match[1]; + version = match[0] < 4 ? 1 : match[0] + match[1]; } else if (userAgent) { match = userAgent.match(/Edge\/(\d+)/); if (!match || match[1] >= 74) { diff --git a/packages/core-js/internals/native-symbol.js b/packages/core-js/internals/native-symbol.js index 03846ade2736..e013965c4b80 100644 --- a/packages/core-js/internals/native-symbol.js +++ b/packages/core-js/internals/native-symbol.js @@ -1,12 +1,11 @@ -var IS_NODE = require('../internals/engine-is-node'); +/* eslint-disable es/no-symbol -- required for testing */ var V8_VERSION = require('../internals/engine-v8-version'); var fails = require('../internals/fails'); // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing module.exports = !!Object.getOwnPropertySymbols && !fails(function () { - // eslint-disable-next-line es/no-symbol -- required for testing - return !Symbol.sham && + return !String(Symbol()) || // Chrome 38 Symbol has incorrect toString conversion // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances - (IS_NODE ? V8_VERSION === 38 : V8_VERSION > 37 && V8_VERSION < 41); + !Symbol.sham && V8_VERSION && V8_VERSION < 41; }); diff --git a/tests/compat/tests.js b/tests/compat/tests.js index 145b21598e49..f7fa120f88f7 100644 --- a/tests/compat/tests.js +++ b/tests/compat/tests.js @@ -14,7 +14,7 @@ var match, V8_VERSION; if (v8) { match = v8.split('.'); - V8_VERSION = +(match[0] + match[1]); + V8_VERSION = match[0] < 4 ? 1 : +(match[0] + match[1]); } else if (USERAGENT) { match = USERAGENT.match(/Edge\/(\d+)/); if (!match || match[1] >= 74) { @@ -45,7 +45,7 @@ var PROMISES_SUPPORT = function () { }; var SYMBOLS_SUPPORT = function () { - return Symbol && (IS_NODE ? V8_VERSION !== 38 : !(V8_VERSION > 37 && V8_VERSION < 41)); + return String(Symbol()) && !(V8_VERSION && V8_VERSION < 41); }; var URL_AND_URL_SEARCH_PARAMS_SUPPORT = function () {