Skip to content

Commit

Permalink
fix #970
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Aug 10, 2021
1 parent 920121f commit 3771519
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
@@ -1,6 +1,6 @@
## Changelog
##### Unreleased
- Nothing
- One more fix crashing of `Object.create(null)` on WSH, [#970](https://github.com/zloirock/core-js/issues/970)

##### 3.16.1 - 2021.08.09
- Fixed microtask implementation on iOS Pebble, [#967](https://github.com/zloirock/core-js/issues/967)
Expand Down
29 changes: 14 additions & 15 deletions packages/core-js/internals/object-create.js
Expand Up @@ -34,17 +34,15 @@ var NullProtoObjectViaIFrame = function () {
var iframe = documentCreateElement('iframe');
var JS = 'java' + SCRIPT + ':';
var iframeDocument;
if (iframe.style) {
iframe.style.display = 'none';
html.appendChild(iframe);
// https://github.com/zloirock/core-js/issues/475
iframe.src = String(JS);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(scriptTag('document.F=Object'));
iframeDocument.close();
return iframeDocument.F;
}
iframe.style.display = 'none';
html.appendChild(iframe);
// https://github.com/zloirock/core-js/issues/475
iframe.src = String(JS);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(scriptTag('document.F=Object'));
iframeDocument.close();
return iframeDocument.F;
};

// Check for document.domain and active x support
Expand All @@ -57,10 +55,11 @@ var NullProtoObject = function () {
try {
activeXDocument = new ActiveXObject('htmlfile');
} catch (error) { /* ignore */ }
NullProtoObject = document.domain && activeXDocument ?
NullProtoObjectViaActiveX(activeXDocument) : // old IE
NullProtoObjectViaIFrame() ||
NullProtoObjectViaActiveX(activeXDocument); // WSH
NullProtoObject = typeof document != 'undefined'
? 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 3771519

Please sign in to comment.