From 4bd0545b29098430e659423d5c905171339baa1b Mon Sep 17 00:00:00 2001 From: Cam Tenny Date: Mon, 5 Dec 2022 14:36:41 -0800 Subject: [PATCH] harness/asyncHelpers.js: Remove dependency on Promise. --- harness/asyncHelpers.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/harness/asyncHelpers.js b/harness/asyncHelpers.js index a764af7ea9..ebc9f09ca7 100644 --- a/harness/asyncHelpers.js +++ b/harness/asyncHelpers.js @@ -10,9 +10,14 @@ function asyncTest(testFunc) { if (!Object.hasOwn(globalThis, "$DONE")) { throw new Test262Error("asyncTest called without async flag"); } + const resolveThenable = { + then(resolve, reject) { + resolve(); + }, + }; if (typeof testFunc !== "function") { $DONE(new Test262Error("asyncTest called with non-function argument")); - return Promise.resolve(); + return resolveThenable; } try { return testFunc().then( @@ -25,7 +30,7 @@ function asyncTest(testFunc) { ); } catch (syncError) { $DONE(syncError); - return Promise.resolve(); + return resolveThenable; } }