Skip to content

Commit

Permalink
fix regression of V8 ~ Node 0.12 Sting(Symbol()) bug, close #933
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed May 6, 2021
1 parent b3afb28 commit 9f8ff89
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion 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
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/engine-v8-version.js
Expand Up @@ -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) {
Expand Down
7 changes: 3 additions & 4 deletions 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;
});
4 changes: 2 additions & 2 deletions tests/compat/tests.js
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 () {
Expand Down

0 comments on commit 9f8ff89

Please sign in to comment.