Skip to content

Commit

Permalink
adapt #966
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Jul 29, 2021
1 parent 261257d commit 9cd5c0b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,7 @@
- Handling `@@toPrimitive` in some cases of `ToPrimitive` internal logic made stricter
- Fixed work of `Request` with polyfilled `URLSearchParams`, [#965](https://github.com/zloirock/core-js/issues/965)
- Fixed possible exposing of collections elements metadata in some cases, [#427](https://github.com/zloirock/core-js/issues/427)
- Fixed crashing of `Object.create(null)` on WSH, [#966](https://github.com/zloirock/core-js/issues/966)
- Fixed some cases of typed arrays subclassing logic
- Fixed a minor bug related to string conversion in `RegExp#exec`
- Fixed `Date.prototype.getYear` feature detection and compat data for IE8-
Expand Down
17 changes: 7 additions & 10 deletions packages/core-js/internals/object-create.js
@@ -1,3 +1,4 @@
/* global ActiveXObject -- old IE, WSH */
var anObject = require('../internals/an-object');
var defineProperties = require('../internals/object-define-properties');
var enumBugKeys = require('../internals/enum-bug-keys');
Expand Down Expand Up @@ -42,14 +43,8 @@ var NullProtoObjectViaIFrame = function () {
iframeDocument.open();
iframeDocument.write(scriptTag('document.F=Object'));
iframeDocument.close();
} else {
/* global ActiveXObject -- in WSH */
activeXDocument = new ActiveXObject('htmlfile'); // without document.domain
iframeDocument = {
F: NullProtoObjectViaActiveX(activeXDocument)
};
return iframeDocument.F;
}
return iframeDocument.F;
};

// Check for document.domain and active x support
Expand All @@ -60,10 +55,12 @@ var NullProtoObjectViaIFrame = function () {
var activeXDocument;
var NullProtoObject = function () {
try {
/* global ActiveXObject -- old IE */
activeXDocument = document.domain && new ActiveXObject('htmlfile');
activeXDocument = new ActiveXObject('htmlfile');
} catch (error) { /* ignore */ }
NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
NullProtoObject = document.domain && activeXDocument ?
NullProtoObjectViaActiveX(activeXDocument) : // old IE
NullProtoObjectViaIFrame() ||
NullProtoObjectViaActiveX(activeXDocument); // WSH
var length = enumBugKeys.length;
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
return NullProtoObject();
Expand Down

0 comments on commit 9cd5c0b

Please sign in to comment.