Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken getOwnPropertySymbols in Mobile Chrome 38 and 39 #539

Merged
merged 3 commits into from
May 10, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var toIndexedObject = require('../internals/to-indexed-object');
var nativeGetOwnPropertySymbols = require('../internals/object-get-own-property-symbols').f;

module.exports.f = function getOwnPropertySymbols(it) {
return nativeGetOwnPropertySymbols(toIndexedObject(it));
};
10 changes: 10 additions & 0 deletions packages/core-js/modules/es.symbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var toPrimitive = require('../internals/to-primitive');
var createPropertyDescriptor = require('../internals/create-property-descriptor');
var nativeObjectCreate = require('../internals/object-create');
var getOwnPropertyNamesExternal = require('../internals/object-get-own-property-names-external');
var getOwnPropertySymbolsExternal = require('../internals/object-get-own-property-symbols-external');
var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
var definePropertyModule = require('../internals/object-define-property');
var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
Expand All @@ -36,6 +37,7 @@ var getInternalState = InternalStateModule.getterFor(SYMBOL);
var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
var nativeDefineProperty = definePropertyModule.f;
var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
var nativeGetOwnPropertySymbols = getOwnPropertySymbolsExternal.f;
var $Symbol = global.Symbol;
var JSON = global.JSON;
var nativeJSONStringify = JSON && JSON.stringify;
Expand Down Expand Up @@ -240,6 +242,14 @@ $export({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {
getOwnPropertySymbols: $getOwnPropertySymbols
});

// Chome Mobile 38 and 39 getOwnPropertySymbols fails on primitives
// https://bugs.chromium.org/p/v8/issues/detail?id=3443
var FAILS_ON_PRIMITIVES = fails(function () { return !Object.getOwnPropertySymbols(1); });

$export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
getOwnPropertySymbols: nativeGetOwnPropertySymbols
});

// `JSON.stringify` method behavior with symbols
// https://tc39.github.io/ecma262/#sec-json.stringify
JSON && $export({ target: 'JSON', stat: true, forced: !NATIVE_SYMBOL || fails(function () {
Expand Down