Skip to content

Commit 9cd5c0b

Browse files
committedJul 29, 2021
adapt #966
1 parent 261257d commit 9cd5c0b

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed
 

‎CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Handling `@@toPrimitive` in some cases of `ToPrimitive` internal logic made stricter
99
- Fixed work of `Request` with polyfilled `URLSearchParams`, [#965](https://github.com/zloirock/core-js/issues/965)
1010
- Fixed possible exposing of collections elements metadata in some cases, [#427](https://github.com/zloirock/core-js/issues/427)
11+
- Fixed crashing of `Object.create(null)` on WSH, [#966](https://github.com/zloirock/core-js/issues/966)
1112
- Fixed some cases of typed arrays subclassing logic
1213
- Fixed a minor bug related to string conversion in `RegExp#exec`
1314
- Fixed `Date.prototype.getYear` feature detection and compat data for IE8-

‎packages/core-js/internals/object-create.js

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* global ActiveXObject -- old IE, WSH */
12
var anObject = require('../internals/an-object');
23
var defineProperties = require('../internals/object-define-properties');
34
var enumBugKeys = require('../internals/enum-bug-keys');
@@ -42,14 +43,8 @@ var NullProtoObjectViaIFrame = function () {
4243
iframeDocument.open();
4344
iframeDocument.write(scriptTag('document.F=Object'));
4445
iframeDocument.close();
45-
} else {
46-
/* global ActiveXObject -- in WSH */
47-
activeXDocument = new ActiveXObject('htmlfile'); // without document.domain
48-
iframeDocument = {
49-
F: NullProtoObjectViaActiveX(activeXDocument)
50-
};
46+
return iframeDocument.F;
5147
}
52-
return iframeDocument.F;
5348
};
5449

5550
// Check for document.domain and active x support
@@ -60,10 +55,12 @@ var NullProtoObjectViaIFrame = function () {
6055
var activeXDocument;
6156
var NullProtoObject = function () {
6257
try {
63-
/* global ActiveXObject -- old IE */
64-
activeXDocument = document.domain && new ActiveXObject('htmlfile');
58+
activeXDocument = new ActiveXObject('htmlfile');
6559
} catch (error) { /* ignore */ }
66-
NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
60+
NullProtoObject = document.domain && activeXDocument ?
61+
NullProtoObjectViaActiveX(activeXDocument) : // old IE
62+
NullProtoObjectViaIFrame() ||
63+
NullProtoObjectViaActiveX(activeXDocument); // WSH
6764
var length = enumBugKeys.length;
6865
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
6966
return NullProtoObject();

0 commit comments

Comments
 (0)
Please sign in to comment.