Skip to content

Commit 9f8ff89

Browse files
committed
fix regression of V8 ~ Node 0.12 Sting(Symbol()) bug, close #933
1 parent b3afb28 commit 9f8ff89

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Changelog
22
##### Unreleased
3-
- Nothing
3+
- Fixed regression of V8 on Node 0.12 `Sting(Symbol())` bug, [#933](https://github.com/zloirock/core-js/issues/933)
44

55
##### 3.11.3 - 2021.05.05
66
- Native promise-based APIs `Promise#{ catch, finally }` returns polyfilled `Promise` instances when it's required

packages/core-js/internals/engine-v8-version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var match, version;
88

99
if (v8) {
1010
match = v8.split('.');
11-
version = match[0] + match[1];
11+
version = match[0] < 4 ? 1 : match[0] + match[1];
1212
} else if (userAgent) {
1313
match = userAgent.match(/Edge\/(\d+)/);
1414
if (!match || match[1] >= 74) {
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
var IS_NODE = require('../internals/engine-is-node');
1+
/* eslint-disable es/no-symbol -- required for testing */
22
var V8_VERSION = require('../internals/engine-v8-version');
33
var fails = require('../internals/fails');
44

55
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
66
module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
7-
// eslint-disable-next-line es/no-symbol -- required for testing
8-
return !Symbol.sham &&
7+
return !String(Symbol()) ||
98
// Chrome 38 Symbol has incorrect toString conversion
109
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
11-
(IS_NODE ? V8_VERSION === 38 : V8_VERSION > 37 && V8_VERSION < 41);
10+
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
1211
});

tests/compat/tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var match, V8_VERSION;
1414

1515
if (v8) {
1616
match = v8.split('.');
17-
V8_VERSION = +(match[0] + match[1]);
17+
V8_VERSION = match[0] < 4 ? 1 : +(match[0] + match[1]);
1818
} else if (USERAGENT) {
1919
match = USERAGENT.match(/Edge\/(\d+)/);
2020
if (!match || match[1] >= 74) {
@@ -45,7 +45,7 @@ var PROMISES_SUPPORT = function () {
4545
};
4646

4747
var SYMBOLS_SUPPORT = function () {
48-
return Symbol && (IS_NODE ? V8_VERSION !== 38 : !(V8_VERSION > 37 && V8_VERSION < 41));
48+
return String(Symbol()) && !(V8_VERSION && V8_VERSION < 41);
4949
};
5050

5151
var URL_AND_URL_SEARCH_PARAMS_SUPPORT = function () {

0 commit comments

Comments
 (0)