@@ -63,9 +63,13 @@ const {
6363 Int32ArrayPrototype,
6464 Int8Array,
6565 Int8ArrayPrototype,
66+ Iterator,
67+ IteratorFrom,
6668 IteratorPrototype,
69+ IteratorPrototypeDrop,
6770 Map,
6871 MapPrototype,
72+ MapPrototypeSymbolIterator,
6973 Number,
7074 NumberPrototype,
7175 Object,
@@ -88,15 +92,15 @@ const {
8892 ReflectOwnKeys,
8993 RegExp,
9094 RegExpPrototype,
95+ RegExpPrototypeSymbolMatchAll,
9196 SafeSet,
9297 Set,
9398 SetPrototype,
99+ SetPrototypeSymbolIterator,
94100 String,
95101 StringIteratorPrototype,
96102 StringPrototype,
97103 Symbol,
98- SymbolIterator,
99- SymbolMatchAll,
100104 SymbolPrototype,
101105 SyntaxError,
102106 SyntaxErrorPrototype,
@@ -136,6 +140,16 @@ const {
136140 WebAssembly,
137141} = globalThis ;
138142
143+ const AsyncFunctionPrototype = ObjectGetPrototypeOf ( async function ( ) { } ) ;
144+ const AsyncGeneratorFunctionPrototype = ObjectGetPrototypeOf ( async function * ( ) { } ) ;
145+ const GeneratorFunctionPrototype = ObjectGetPrototypeOf ( function * ( ) { } ) ;
146+ const IteratorHelperPrototype = ObjectGetPrototypeOf ( IteratorPrototypeDrop ( { __proto__ : null } , null ) ) ;
147+ const MapIteratorPrototype = ObjectGetPrototypeOf ( MapPrototypeSymbolIterator ( new Map ( ) ) ) ;
148+ // eslint-disable-next-line node-core/avoid-prototype-pollution, regexp/no-empty-group
149+ const RegExpStringIteratorPrototype = ObjectGetPrototypeOf ( RegExpPrototypeSymbolMatchAll ( / (?: ) / ) ) ;
150+ const SetIteratorPrototype = ObjectGetPrototypeOf ( SetPrototypeSymbolIterator ( new Set ( ) ) ) ;
151+ const WrapForValidIteratorPrototype = ObjectGetPrototypeOf ( IteratorFrom ( { __proto__ : null } ) ) ;
152+
139153module . exports = function ( ) {
140154 const { Console } = require ( 'internal/console/constructor' ) ;
141155 const console = require ( 'internal/console/global' ) ;
@@ -173,8 +187,7 @@ module.exports = function() {
173187 StringPrototype , // 22.1
174188 StringIteratorPrototype , // 22.1.5
175189 RegExpPrototype , // 22.2
176- // 22.2.7 RegExpStringIteratorPrototype
177- ObjectGetPrototypeOf ( / e / [ SymbolMatchAll ] ( ) ) ,
190+ RegExpStringIteratorPrototype , // 22.2.9
178191
179192 // 23 Indexed Collections
180193 ArrayPrototype , // 23.1
@@ -195,11 +208,9 @@ module.exports = function() {
195208
196209 // 24 Keyed Collections
197210 MapPrototype , // 24.1
198- // 24.1.5 MapIteratorPrototype
199- ObjectGetPrototypeOf ( new Map ( ) [ SymbolIterator ] ( ) ) ,
211+ MapIteratorPrototype , // 24.1.5
200212 SetPrototype , // 24.2
201- // 24.2.5 SetIteratorPrototype
202- ObjectGetPrototypeOf ( new Set ( ) [ SymbolIterator ] ( ) ) ,
213+ SetIteratorPrototype , // 24.2.6
203214 WeakMapPrototype , // 24.3
204215 WeakSetPrototype , // 24.4
205216
@@ -212,10 +223,18 @@ module.exports = function() {
212223 FinalizationRegistryPrototype , // 26.2
213224
214225 // 27 Control Abstraction Objects
215- // 27.1 Iteration
216- IteratorPrototype , // 27.1.2 IteratorPrototype
217- AsyncIteratorPrototype , // 27.1.3 AsyncIteratorPrototype
226+ IteratorHelperPrototype , // 27.1.2
227+ IteratorPrototype , // 27.1.3
228+ WrapForValidIteratorPrototype , // 27.1.3.2.2.1
229+ AsyncIteratorPrototype , // 27.1.4
218230 PromisePrototype , // 27.2
231+ GeneratorFunctionPrototype , // 27.3
232+ AsyncGeneratorFunctionPrototype , // 27.4
233+ // 27.5 GeneratorPrototype
234+ GeneratorFunctionPrototype . prototype ,
235+ // 27.6 AsyncGeneratorPrototype
236+ AsyncGeneratorFunctionPrototype . prototype ,
237+ AsyncFunctionPrototype , // 27.7
219238
220239 // Other APIs / Web Compatibility
221240 Console . prototype ,
@@ -268,8 +287,7 @@ module.exports = function() {
268287 String , // 22.1
269288 StringIteratorPrototype , // 22.1.5
270289 RegExp , // 22.2
271- // 22.2.7 RegExpStringIteratorPrototype
272- ObjectGetPrototypeOf ( / e / [ SymbolMatchAll ] ( ) ) ,
290+ RegExpStringIteratorPrototype , // 22.2.9
273291
274292 // 23 Indexed Collections
275293 Array , // 23.1
@@ -290,11 +308,9 @@ module.exports = function() {
290308
291309 // 24 Keyed Collections
292310 Map , // 24.1
293- // 24.1.5 MapIteratorPrototype
294- ObjectGetPrototypeOf ( new Map ( ) [ SymbolIterator ] ( ) ) ,
311+ MapIteratorPrototype , // 24.1.5
295312 Set , // 24.2
296- // 24.2.5 SetIteratorPrototype
297- ObjectGetPrototypeOf ( new Set ( ) [ SymbolIterator ] ( ) ) ,
313+ SetIteratorPrototype , // 24.2.6
298314 WeakMap , // 24.3
299315 WeakSet , // 24.4
300316
@@ -310,19 +326,19 @@ module.exports = function() {
310326 FinalizationRegistry , // 26.2
311327
312328 // 27 Control Abstraction Objects
313- // 27.1 Iteration
314- ObjectGetPrototypeOf ( ArrayIteratorPrototype ) , // 27.1.2 IteratorPrototype
315- // 27.1.3 AsyncIteratorPrototype
316- ObjectGetPrototypeOf ( ObjectGetPrototypeOf ( ObjectGetPrototypeOf (
317- ( async function * ( ) { } ) ( ) ,
318- ) ) ) ,
329+ IteratorHelperPrototype , // 27.1.2
330+ Iterator , // 27.1.3
331+ WrapForValidIteratorPrototype , // 27.1.3.2.2.1
332+ ArrayIteratorPrototype , // 27.1.4
319333 Promise , // 27.2
320334 // 27.3 GeneratorFunction
321- ObjectGetPrototypeOf ( function * ( ) { } ) ,
335+ // 27.5 Generator
336+ GeneratorFunctionPrototype ,
322337 // 27.4 AsyncGeneratorFunction
323- ObjectGetPrototypeOf ( async function * ( ) { } ) ,
338+ // 27.6 AsyncGenerator
339+ AsyncGeneratorFunctionPrototype ,
324340 // 27.7 AsyncFunction
325- ObjectGetPrototypeOf ( async function ( ) { } ) ,
341+ AsyncFunctionPrototype ,
326342
327343 // 28 Reflection
328344 // eslint-disable-next-line node-core/prefer-primordials
0 commit comments