diff --git a/harness/hidden-constructors.js b/harness/hidden-constructors.js index 8a517475a2..d73facfbcf 100644 --- a/harness/hidden-constructors.js +++ b/harness/hidden-constructors.js @@ -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) {}