From e133564cfada86457b7a2c935f6ad96efe9e2f61 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Tue, 11 Feb 2025 15:17:16 -0800 Subject: [PATCH] harness: Update list of well-known intrinsics Looks like this list hasn't been updated in a while. Add %AsyncGeneratorPrototype%, %GeneratorPrototype%, %Iterator%, %IteratorHelperPrototype%, and %WrapForValidIteratorPrototype%. %IteratorPrototype% is no longer a well-known intrinsic; I guess it was removed because ever since iterator helpers it's accessible as %Iterator.prototype%. %Iterator% is available as the global property Iterator, but include a fallback for implementations that haven't yet implemented iterator helpers. --- harness/wellKnownIntrinsicObjects.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/harness/wellKnownIntrinsicObjects.js b/harness/wellKnownIntrinsicObjects.js index ecc86bb447..6e598180d2 100644 --- a/harness/wellKnownIntrinsicObjects.js +++ b/harness/wellKnownIntrinsicObjects.js @@ -36,6 +36,10 @@ const WellKnownIntrinsicObjects = [ name: '%AsyncGeneratorFunction%', source: '(async function* () {}).constructor', }, + { + name: '%AsyncGeneratorPrototype%', + source: 'Object.getPrototypeOf(async function* () {}).prototype', + }, { name: '%AsyncIteratorPrototype%', source: '((async function * () {})())[Symbol.asyncIterator]()', @@ -121,6 +125,10 @@ const WellKnownIntrinsicObjects = [ name: '%GeneratorFunction%', source: '(function* () {}).constructor', }, + { + name: '%GeneratorPrototype%', + source: 'Object.getPrototypeOf(function * () {}).prototype', + }, { name: '%Int8Array%', source: 'Int8Array', @@ -142,8 +150,12 @@ const WellKnownIntrinsicObjects = [ source: 'isNaN', }, { - name: '%IteratorPrototype%', - source: 'Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))', + name: '%Iterator%', + source: 'typeof Iterator !== "undefined" ? Iterator : Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())).constructor', + }, + { + name: '%IteratorHelperPrototype%', + source: 'Object.getPrototypeOf(Iterator.from([]).drop(0))', }, { name: '%JSON%', @@ -277,6 +289,10 @@ const WellKnownIntrinsicObjects = [ name: '%WeakSet%', source: 'WeakSet', }, + { + name: '%WrapForValidIteratorPrototype%', + source: 'Object.getPrototypeOf(Iterator.from({ [Symbol.iterator](){ return {}; } }))', + }, ]; WellKnownIntrinsicObjects.forEach((wkio) => {