From 007c54c80c566813116e80037ddabc1af294e357 Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Mon, 3 Aug 2020 14:04:00 -0400 Subject: Issue #618 - Remove eager instantiation - Debug follow up The added debug assertion did not take into account microtask refactoring done in BZ 1405821. Resulting in error: no member named 'IsInMicroTask' in 'nsContentUtils'. This resolves the error. --- dom/base/nsJSUtils.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dom/base/nsJSUtils.cpp b/dom/base/nsJSUtils.cpp index 65965d74b..2601ffd87 100644 --- a/dom/base/nsJSUtils.cpp +++ b/dom/base/nsJSUtils.cpp @@ -315,7 +315,8 @@ nsJSUtils::ModuleInstantiate(JSContext* aCx, JS::Handle aModule) MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext()); MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(nsContentUtils::IsInMicroTask()); + MOZ_ASSERT(CycleCollectedJSContext::Get() && + CycleCollectedJSContext::Get()->MicroTaskLevel()); NS_ENSURE_TRUE(xpc::Scriptability::Get(aModule).Allowed(), NS_OK); -- cgit v1.2.3 From 609815070b88230c896bfa9aa25fe280bc090425 Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Mon, 3 Aug 2020 14:04:26 -0400 Subject: Issue #618 - Lazily initialise module binding maps - Debug follow up The added debug assertion does not work due to missing API. They were added in BZ 1337491, 1395366, and others, but were primarily used for multi-threading. This uses our existing non-multithreaded syntax instead, resolving a `no member named` build error. --- js/src/builtin/ModuleObject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/builtin/ModuleObject.cpp b/js/src/builtin/ModuleObject.cpp index 44e5a2c88..728929e8c 100644 --- a/js/src/builtin/ModuleObject.cpp +++ b/js/src/builtin/ModuleObject.cpp @@ -272,7 +272,7 @@ IndirectBindingMap::put(JSContext* cx, HandleId name, // different zone to the final module. Lazily allocate the map so we don't // have to switch its zone when merging compartments. if (!map_) { - MOZ_ASSERT(!cx->zone()->group()->createdForHelperThread()); + MOZ_ASSERT(!cx->zone()->usedByExclusiveThread); map_.emplace(cx->zone()); if (!map_->init()) { map_.reset(); -- cgit v1.2.3 From c5b47eb66c75642ded54474f3f559ff83c129c09 Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Mon, 3 Aug 2020 14:31:43 -0400 Subject: Issue #618 - Align error handling for module scripts with the spec - Debug follow up MODULE_STATUS_ERRORED is no more. Replacing with newer API. Ref: BZ 1420420 --- js/src/builtin/Module.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/src/builtin/Module.js b/js/src/builtin/Module.js index c9f20c18c..355303d44 100644 --- a/js/src/builtin/Module.js +++ b/js/src/builtin/Module.js @@ -67,7 +67,8 @@ function ModuleGetExportedNames(exportStarSet = []) function ModuleSetStatus(module, newStatus) { - assert(newStatus >= MODULE_STATUS_ERRORED && newStatus <= MODULE_STATUS_EVALUATED, + assert(newStatus >= MODULE_STATUS_UNINSTANTIATED && + newStatus <= MODULE_STATUS_EVALUATED_ERROR, "Bad new module status in ModuleSetStatus"); // Note that under OOM conditions we can fail the module instantiation -- cgit v1.2.3