diff options
author | Jon Coppeard <jcoppeard@mozilla.com> | 2020-08-22 18:35:57 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-08-22 18:35:57 +0000 |
commit | 76e5f863aa265af843e4075175703e43aa2266fc (patch) | |
tree | af1c39f1d6b99a214f116aaa1fb83674db0b60f4 /dom/script | |
parent | f0175ebc761db79687195c5c9f8a66056ea49363 (diff) | |
download | UXP-76e5f863aa265af843e4075175703e43aa2266fc.tar UXP-76e5f863aa265af843e4075175703e43aa2266fc.tar.gz UXP-76e5f863aa265af843e4075175703e43aa2266fc.tar.lz UXP-76e5f863aa265af843e4075175703e43aa2266fc.tar.xz UXP-76e5f863aa265af843e4075175703e43aa2266fc.zip |
Issue #618 - Fix processing of non-parser-generated module scripts.
Diffstat (limited to 'dom/script')
-rw-r--r-- | dom/script/ScriptLoader.cpp | 55 |
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(), |