From a8f9ac654dce7b7b62c44d8810a8b6bf9acc7c37 Mon Sep 17 00:00:00 2001 From: Simon Rask <33556894+SimonRask@users.noreply.github.com> Date: Sun, 4 Jul 2021 17:26:38 +0200 Subject: [PATCH] fix: primordials in extensions/net and runtime/js (#11270) --- extensions/net/01_net.js | 3 +-- runtime/js/99_main.js | 13 ++++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/extensions/net/01_net.js b/extensions/net/01_net.js index 9703bd3219..cc10a1c0ab 100644 --- a/extensions/net/01_net.js +++ b/extensions/net/01_net.js @@ -6,7 +6,6 @@ const { BadResource } = core; const { PromiseResolve, - Symbol, SymbolAsyncIterator, Uint8Array, TypedArrayPrototypeSubarray, @@ -187,7 +186,7 @@ core.close(this.rid); } - async *[Symbol.asyncIterator]() { + async *[SymbolAsyncIterator]() { while (true) { try { yield await this.receive(); diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index a72b2177b7..41cd0d05bc 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -20,6 +20,7 @@ delete Object.prototype.__proto__; Symbol, SymbolFor, SymbolIterator, + PromisePrototypeThen, } = window.__bootstrap.primordials; const util = window.__bootstrap.util; const eventTarget = window.__bootstrap.eventTarget; @@ -67,11 +68,13 @@ delete Object.prototype.__proto__; windowIsClosing = true; // Push a macrotask to exit after a promise resolve. // This is not perfect, but should be fine for first pass. - PromiseResolve().then(() => - FunctionPrototypeCall(timers.setTimeout, null, () => { - // This should be fine, since only Window/MainWorker has .close() - os.exit(0); - }, 0) + PromisePrototypeThen( + PromiseResolve(), + () => + FunctionPrototypeCall(timers.setTimeout, null, () => { + // This should be fine, since only Window/MainWorker has .close() + os.exit(0); + }, 0), ); } }