Prevent harness code not loading when async/generator/asyncGenerator not supported (#4164)

* Dont throw when async/generato/asyncGenerator not supported

* Apply suggestions from code review
This commit is contained in:
Paul Bakker 2024-07-24 18:18:02 +02:00 committed by GitHub
parent d8aa2e4ef7
commit f55e99796f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 3 deletions

View File

@ -10,6 +10,18 @@ defines:
- GeneratorFunction
---*/
var AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor;
var AsyncFunction;
var AsyncGeneratorFunction;
var GeneratorFunction;
try {
AsyncFunction = Object.getPrototypeOf(new Function('async function () {}')).constructor;
} catch(e) {}
try {
AsyncGeneratorFunction = Object.getPrototypeOf(new Function('async function* () {}')).constructor;
} catch(e) {}
try {
GeneratorFunction = Object.getPrototypeOf(new Function('function* () {}')).constructor;
} catch(e) {}