Skip to content

Commit 2e6babb

Browse files
committed
Fix wrong prototype of unscopables
Unscopable is supposed to have a null prototype.
1 parent 9f103a2 commit 2e6babb

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/constructs/interface.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,6 +1257,8 @@ class Interface {
12571257
}
12581258
}
12591259
if (Object.keys(unscopables).length > 0) {
1260+
// eslint-disable-next-line no-proto
1261+
unscopables.__proto__ = null;
12601262
this.addProperty("prototype", Symbol.unscopables, JSON.stringify(unscopables), {
12611263
writable: false
12621264
});

test/__snapshots__/test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6670,7 +6670,7 @@ Object.defineProperties(Unscopable.prototype, {
66706670
unscopableTest: { enumerable: true },
66716671
unscopableMixin: { enumerable: true },
66726672
[Symbol.toStringTag]: { value: \\"Unscopable\\", configurable: true },
6673-
[Symbol.unscopables]: { value: { unscopableTest: true, unscopableMixin: true }, configurable: true }
6673+
[Symbol.unscopables]: { value: { unscopableTest: true, unscopableMixin: true, __proto__: null }, configurable: true }
66746674
});
66756675
const iface = {
66766676
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`

0 commit comments

Comments
 (0)