Skip to content

Commit

Permalink
Further fixes to create sync iterators in the correct realm
Browse files Browse the repository at this point in the history
This was missed in 9260316.
  • Loading branch information
ExE-Boss authored Mar 20, 2021
1 parent b5ed275 commit aadf3d9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/constructs/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,7 @@ class Interface {
// Don't bother checking "length" attribute as interfaces that support indexed properties must implement one.
// "Has value iterator" implies "supports indexed properties".
if (this.supportsIndexedProperties) {
this.addProperty(this.defaultWhence, Symbol.iterator, "Array.prototype[Symbol.iterator]");
this.addProperty(this.defaultWhence, Symbol.iterator, 'ctorRegistry["%Array%"].prototype[Symbol.iterator]');
}
}

Expand Down
24 changes: 16 additions & 8 deletions test/__snapshots__/test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3117,7 +3117,7 @@ exports._internalSetup = (wrapper, globalObject) => {

esValue[implSymbol][\\"length\\"] = V;
},
[Symbol.iterator]: Array.prototype[Symbol.iterator],
[Symbol.iterator]: ctorRegistry[\\"%Array%\\"].prototype[Symbol.iterator],
keys: ctorRegistry[\\"%Array%\\"].prototype.keys,
values: ctorRegistry[\\"%Array%\\"].prototype.values,
entries: ctorRegistry[\\"%Array%\\"].prototype.entries,
Expand Down Expand Up @@ -8000,7 +8000,11 @@ exports.install = (globalObject, globalNames) => {
item: { enumerable: true },
length: { enumerable: true },
[Symbol.toStringTag]: { value: \\"URLList\\", configurable: true },
[Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: true },
[Symbol.iterator]: {
value: ctorRegistry[\\"%Array%\\"].prototype[Symbol.iterator],
configurable: true,
writable: true
},
keys: { value: ctorRegistry[\\"%Array%\\"].prototype.keys, configurable: true, enumerable: true, writable: true },
values: { value: ctorRegistry[\\"%Array%\\"].prototype.values, configurable: true, enumerable: true, writable: true },
entries: { value: ctorRegistry[\\"%Array%\\"].prototype.entries, configurable: true, enumerable: true, writable: true },
Expand Down Expand Up @@ -8790,7 +8794,7 @@ exports.install = (globalObject, globalNames) => {
namedItem: { enumerable: true },
length: { enumerable: true },
[Symbol.toStringTag]: { value: \\"URLSearchParamsCollection\\", configurable: true },
[Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: true }
[Symbol.iterator]: { value: ctorRegistry[\\"%Array%\\"].prototype[Symbol.iterator], configurable: true, writable: true }
});
ctorRegistry[interfaceName] = URLSearchParamsCollection;

Expand Down Expand Up @@ -9086,7 +9090,7 @@ exports.install = (globalObject, globalNames) => {
}
Object.defineProperties(URLSearchParamsCollection2.prototype, {
[Symbol.toStringTag]: { value: \\"URLSearchParamsCollection2\\", configurable: true },
[Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: true }
[Symbol.iterator]: { value: ctorRegistry[\\"%Array%\\"].prototype[Symbol.iterator], configurable: true, writable: true }
});
ctorRegistry[interfaceName] = URLSearchParamsCollection2;

Expand Down Expand Up @@ -13025,7 +13029,7 @@ exports._internalSetup = (wrapper, globalObject) => {

esValue[implSymbol][\\"length\\"] = V;
},
[Symbol.iterator]: Array.prototype[Symbol.iterator],
[Symbol.iterator]: ctorRegistry[\\"%Array%\\"].prototype[Symbol.iterator],
keys: ctorRegistry[\\"%Array%\\"].prototype.keys,
values: ctorRegistry[\\"%Array%\\"].prototype.values,
entries: ctorRegistry[\\"%Array%\\"].prototype.entries,
Expand Down Expand Up @@ -17892,7 +17896,11 @@ exports.install = (globalObject, globalNames) => {
item: { enumerable: true },
length: { enumerable: true },
[Symbol.toStringTag]: { value: \\"URLList\\", configurable: true },
[Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: true },
[Symbol.iterator]: {
value: ctorRegistry[\\"%Array%\\"].prototype[Symbol.iterator],
configurable: true,
writable: true
},
keys: { value: ctorRegistry[\\"%Array%\\"].prototype.keys, configurable: true, enumerable: true, writable: true },
values: { value: ctorRegistry[\\"%Array%\\"].prototype.values, configurable: true, enumerable: true, writable: true },
entries: { value: ctorRegistry[\\"%Array%\\"].prototype.entries, configurable: true, enumerable: true, writable: true },
Expand Down Expand Up @@ -18682,7 +18690,7 @@ exports.install = (globalObject, globalNames) => {
namedItem: { enumerable: true },
length: { enumerable: true },
[Symbol.toStringTag]: { value: \\"URLSearchParamsCollection\\", configurable: true },
[Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: true }
[Symbol.iterator]: { value: ctorRegistry[\\"%Array%\\"].prototype[Symbol.iterator], configurable: true, writable: true }
});
ctorRegistry[interfaceName] = URLSearchParamsCollection;

Expand Down Expand Up @@ -18978,7 +18986,7 @@ exports.install = (globalObject, globalNames) => {
}
Object.defineProperties(URLSearchParamsCollection2.prototype, {
[Symbol.toStringTag]: { value: \\"URLSearchParamsCollection2\\", configurable: true },
[Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: true }
[Symbol.iterator]: { value: ctorRegistry[\\"%Array%\\"].prototype[Symbol.iterator], configurable: true, writable: true }
});
ctorRegistry[interfaceName] = URLSearchParamsCollection2;

Expand Down

0 comments on commit aadf3d9

Please sign in to comment.