diff options
Diffstat (limited to 'core/00_primordials.js')
-rw-r--r-- | core/00_primordials.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/core/00_primordials.js b/core/00_primordials.js index 908278e21..4ca7ce073 100644 --- a/core/00_primordials.js +++ b/core/00_primordials.js @@ -170,9 +170,6 @@ // Create copy of isNaN primordials[isNaN.name] = isNaN; - // Create copy of queueMicrotask - primordials["queueMicrotask"] = queueMicrotask; - // Create copies of URI handling functions [ decodeURI, @@ -280,6 +277,7 @@ ArrayPrototypeForEach, FunctionPrototypeCall, Map, + ObjectDefineProperty, ObjectFreeze, ObjectSetPrototypeOf, Promise, @@ -456,6 +454,20 @@ .then(a, b) ); + // Create getter and setter for `queueMicrotask`, it hasn't been bound yet. + let queueMicrotask = undefined; + ObjectDefineProperty(primordials, "queueMicrotask", { + get() { + return queueMicrotask; + }, + }); + primordials.setQueueMicrotask = (value) => { + if (queueMicrotask !== undefined) { + throw new Error("queueMicrotask is already defined"); + } + queueMicrotask = value; + }; + ObjectSetPrototypeOf(primordials, null); ObjectFreeze(primordials); |