From bf22f114a6e049744866ebaba48faec2cb86549b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 7 Feb 2022 13:54:32 +0100 Subject: refactor: update runtime code for primordial check for iterators (#13510) --- runtime/js/06_util.js | 6 +++++- runtime/js/40_testing.js | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'runtime/js') diff --git a/runtime/js/06_util.js b/runtime/js/06_util.js index e934c4f0e..c643f758a 100644 --- a/runtime/js/06_util.js +++ b/runtime/js/06_util.js @@ -7,6 +7,7 @@ Error, ObjectPrototypeIsPrototypeOf, Promise, + SafeArrayIterator, StringPrototypeReplace, TypeError, } = window.__bootstrap.primordials; @@ -26,7 +27,10 @@ if (logDebug) { // if we destructure `console` off `globalThis` too early, we don't bind to // the right console, therefore we don't log anything out. - globalThis.console.log(`DEBUG ${logSource} -`, ...args); + globalThis.console.log( + `DEBUG ${logSource} -`, + ...new SafeArrayIterator(args), + ); } } diff --git a/runtime/js/40_testing.js b/runtime/js/40_testing.js index 62eb1e9a9..5ff5c6e15 100644 --- a/runtime/js/40_testing.js +++ b/runtime/js/40_testing.js @@ -24,6 +24,7 @@ RegExp, RegExpPrototypeTest, Set, + SafeArrayIterator, StringPrototypeEndsWith, StringPrototypeIncludes, StringPrototypeSlice, @@ -278,7 +279,10 @@ finishing test case.`; const post = core.resources(); - const allResources = new Set([...ObjectKeys(pre), ...ObjectKeys(post)]); + const allResources = new Set([ + ...new SafeArrayIterator(ObjectKeys(pre)), + ...new SafeArrayIterator(ObjectKeys(post)), + ]); const details = []; for (const resource of allResources) { @@ -322,7 +326,7 @@ finishing test case.`; }); try { - await fn(...params); + await fn(...new SafeArrayIterator(params)); } catch (err) { throw err; } finally { @@ -423,7 +427,7 @@ finishing test case.`; const token = pledgePermissions(permissions); try { - await fn(...params); + await fn(...new SafeArrayIterator(params)); } finally { restorePermissions(token); } -- cgit v1.2.3