summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Coppeard <jcoppeard@mozilla.com>2020-08-22 18:35:57 +0000
committerMoonchild <moonchild@palemoon.org>2020-08-30 09:39:45 +0000
commitc5833155583739be9335a036a4d72bcdc1ad19c4 (patch)
tree57de72eecabb6f7627462659dfd07ec95308e881
parent834ecdc59a084d0ccafa17ccc0e4801115935295 (diff)
downloadUXP-c5833155583739be9335a036a4d72bcdc1ad19c4.tar
UXP-c5833155583739be9335a036a4d72bcdc1ad19c4.tar.gz
UXP-c5833155583739be9335a036a4d72bcdc1ad19c4.tar.lz
UXP-c5833155583739be9335a036a4d72bcdc1ad19c4.tar.xz
UXP-c5833155583739be9335a036a4d72bcdc1ad19c4.zip
Issue #618 - Fix processing of non-parser-generated module scripts.
-rw-r--r--dom/script/ScriptLoader.cpp55
1 files changed, 32 insertions, 23 deletions
diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp
index 1ee50ccfc..d994acc22 100644
--- a/dom/script/ScriptLoader.cpp
+++ b/dom/script/ScriptLoader.cpp
@@ -856,6 +856,23 @@ ScriptLoader::CheckModuleDependenciesLoaded(ModuleLoadRequest* aRequest)
}
}
+class ScriptRequestProcessor : public Runnable
+{
+private:
+ RefPtr<ScriptLoader> mLoader;
+ RefPtr<ScriptLoadRequest> mRequest;
+public:
+ ScriptRequestProcessor(ScriptLoader* aLoader,
+ ScriptLoadRequest* aRequest)
+ : mLoader(aLoader)
+ , mRequest(aRequest)
+ {}
+ NS_IMETHOD Run() override
+ {
+ return mLoader->ProcessRequest(mRequest);
+ }
+};
+
void
ScriptLoader::ProcessLoadedModuleTree(ModuleLoadRequest* aRequest)
{
@@ -866,8 +883,17 @@ ScriptLoader::ProcessLoadedModuleTree(ModuleLoadRequest* aRequest)
aRequest->mModuleScript = nullptr;
}
}
- MaybeMoveToLoadedList(aRequest);
- ProcessPendingRequests();
+
+ if (aRequest->mIsInline &&
+ aRequest->mElement->GetParserCreated() == NOT_FROM_PARSER)
+ {
+ MOZ_ASSERT(!aRequest->isInList());
+ nsContentUtils::AddScriptRunner(
+ new ScriptRequestProcessor(this, aRequest));
+ } else {
+ MaybeMoveToLoadedList(aRequest);
+ ProcessPendingRequests();
+ }
}
if (aRequest->mWasCompiledOMT) {
@@ -1093,23 +1119,6 @@ ScriptLoader::PreloadURIComparator::Equals(const PreloadInfo &aPi,
same;
}
-class ScriptRequestProcessor : public Runnable
-{
-private:
- RefPtr<ScriptLoader> mLoader;
- RefPtr<ScriptLoadRequest> mRequest;
-public:
- ScriptRequestProcessor(ScriptLoader* aLoader,
- ScriptLoadRequest* aRequest)
- : mLoader(aLoader)
- , mRequest(aRequest)
- {}
- NS_IMETHOD Run() override
- {
- return mLoader->ProcessRequest(mRequest);
- }
-};
-
static inline bool
ParseTypeAttribute(const nsAString& aType, JSVersion* aVersion)
{
@@ -2325,10 +2334,10 @@ ScriptLoader::HandleLoadError(ScriptLoadRequest *aRequest, nsresult aResult) {
mDocument->AddBlockedTrackingNode(cont);
}
- if (aRequest->IsModuleRequest() && !aRequest->mIsInline) {
- auto request = aRequest->AsModuleRequest();
- SetModuleFetchFinishedAndResumeWaitingRequests(request, aResult);
- }
+ if (aRequest->IsModuleRequest() && !aRequest->mIsInline) {
+ auto request = aRequest->AsModuleRequest();
+ SetModuleFetchFinishedAndResumeWaitingRequests(request, aResult);
+ }
if (aRequest->mIsDefer) {
MOZ_ASSERT_IF(aRequest->IsModuleRequest(),