summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-07-01 21:12:49 +0000
committerMoonchild <moonchild@palemoon.org>2020-07-01 21:12:49 +0000
commit98752af13349e2da56b5ed1219cae30008ef250a (patch)
tree71264c20b8ee2d37472a18dae9d36902d558e5cc
parentec10b65ddeab41c1eef180828de711fd900bf1e4 (diff)
downloadUXP-98752af13349e2da56b5ed1219cae30008ef250a.tar
UXP-98752af13349e2da56b5ed1219cae30008ef250a.tar.gz
UXP-98752af13349e2da56b5ed1219cae30008ef250a.tar.lz
UXP-98752af13349e2da56b5ed1219cae30008ef250a.tar.xz
UXP-98752af13349e2da56b5ed1219cae30008ef250a.zip
Issue #618 - Add clarifying code comments.
-rw-r--r--dom/script/ModuleLoadRequest.cpp8
-rw-r--r--dom/script/ScriptLoader.cpp4
2 files changed, 12 insertions, 0 deletions
diff --git a/dom/script/ModuleLoadRequest.cpp b/dom/script/ModuleLoadRequest.cpp
index e72edca2e..98106df1b 100644
--- a/dom/script/ModuleLoadRequest.cpp
+++ b/dom/script/ModuleLoadRequest.cpp
@@ -52,6 +52,14 @@ void ModuleLoadRequest::Cancel()
void
ModuleLoadRequest::SetReady()
{
+ // Mark a module as ready to execute. This means that this module and all it
+ // dependencies have had their source loaded, parsed as a module and the
+ // modules instantiated.
+ //
+ // The mReady promise is used to ensure that when all dependencies of a module
+ // have become ready, DependenciesLoaded is called on that module
+ // request. This is set up in StartFetchingModuleDependencies.
+
#ifdef DEBUG
for (size_t i = 0; i < mImports.Length(); i++) {
MOZ_ASSERT(mImports[i]->IsReadyToRun());
diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp
index ffbe37f28..7aca04da5 100644
--- a/dom/script/ScriptLoader.cpp
+++ b/dom/script/ScriptLoader.cpp
@@ -420,6 +420,10 @@ ScriptLoader::SetModuleFetchFinishedAndResumeWaitingRequests(ModuleLoadRequest *
{
// Update module map with the result of fetching a single module script. The
// module script pointer is nullptr on error.
+ //
+ // If any requests for the same URL are waiting on this one to complete, they
+ // will have ModuleLoaded or LoadFailed on them when the promise is
+ // resolved/rejected. This is set up in StartLoad.
MOZ_ASSERT(!aRequest->IsReadyToRun());