Skip to content

Commit

Permalink
Merge pull request #966 from gnh1201/master
Browse files Browse the repository at this point in the history
Fix crash in `NullProtoObjectViaIFrame()` on WSH
  • Loading branch information
zloirock committed Jul 29, 2021
2 parents 5aa8320 + c768be4 commit 261257d
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions packages/core-js/internals/object-create.js
Expand Up @@ -33,14 +33,22 @@ var NullProtoObjectViaIFrame = function () {
var iframe = documentCreateElement('iframe');
var JS = 'java' + SCRIPT + ':';
var iframeDocument;
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();
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();
} else {
/* global ActiveXObject -- in WSH */
activeXDocument = new ActiveXObject('htmlfile'); // without document.domain
iframeDocument = {
F: NullProtoObjectViaActiveX(activeXDocument)
};
}
return iframeDocument.F;
};

Expand Down

0 comments on commit 261257d

Please sign in to comment.