Skip to content

Commit

Permalink
add a workaround of a specific case of broken Object.prototype, close
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Aug 18, 2021
1 parent 81acbc8 commit 0436d71
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
@@ -1,6 +1,6 @@
## Changelog
##### Unreleased
- Nothing
- Added a workaround of a specific case of broken `Object.prototype`, [#973](https://github.com/zloirock/core-js/issues/973)

##### 3.16.2 - 2021.08.17
- Added a workaround of a Closure Compiler unsafe optimization, [#972](https://github.com/zloirock/core-js/issues/972)
Expand Down
6 changes: 3 additions & 3 deletions packages/core-js-pure/override/internals/export.js
Expand Up @@ -43,7 +43,7 @@ module.exports = function (options, source) {

var nativeSource = GLOBAL ? global : STATIC ? global[TARGET] : (global[TARGET] || {}).prototype;

var target = GLOBAL ? path : path[TARGET] || (path[TARGET] = {});
var target = GLOBAL ? path : path[TARGET] || createNonEnumerableProperty(path, TARGET, {})[TARGET];
var targetPrototype = target.prototype;

var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
Expand Down Expand Up @@ -80,15 +80,15 @@ module.exports = function (options, source) {
createNonEnumerableProperty(resultProperty, 'sham', true);
}

target[key] = resultProperty;
createNonEnumerableProperty(target, key, resultProperty);

if (PROTO) {
VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
if (!has(path, VIRTUAL_PROTOTYPE)) {
createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {});
}
// export virtual prototype methods
path[VIRTUAL_PROTOTYPE][key] = sourceProperty;
createNonEnumerableProperty(path[VIRTUAL_PROTOTYPE], key, sourceProperty);
// export real prototype methods
if (options.real && targetPrototype && !targetPrototype[key]) {
createNonEnumerableProperty(targetPrototype, key, sourceProperty);
Expand Down

0 comments on commit 0436d71

Please sign in to comment.