Bug 1720692 - Remove all preload requests from the off-thread compiling requests list when the preload request is used r=dpalmeiro

When a preload request is used, it might be being compiled off-thread.
Currently this is handled for defer and async requests in AddDeferRequest and
AddAsyncRequest but not for XSLT or other kinds of requests. The patch handles
this whenever we use a preload request.

I don't know for sure that this is what's causing the crash but it seems likely
given the assertion.

Depends on D120072

Differential Revision: https://phabricator.services.mozilla.com/D120073
This commit is contained in:
Jon Coppeard
2021-07-16 16:46:54 +00:00
parent 16ededf757
commit b87ba9523a

View File

@@ -1950,6 +1950,13 @@ bool ScriptLoader::ProcessExternalScript(nsIScriptElement* aElement,
request->SetScriptMode(aElement->GetScriptDeferred(),
aElement->GetScriptAsync(), false);
// The request will be added to another list or set as
// mParserBlockingRequest below.
if (request->mInCompilingList) {
mOffThreadCompilingRequests.Remove(request);
request->mInCompilingList = false;
}
AccumulateCategorical(LABELS_DOM_SCRIPT_PRELOAD_RESULT::Used);
} else {
// No usable preload found.
@@ -4425,11 +4432,7 @@ void ScriptLoader::PreloadURI(nsIURI* aURI, const nsAString& aCharset,
void ScriptLoader::AddDeferRequest(ScriptLoadRequest* aRequest) {
MOZ_ASSERT(aRequest->IsDeferredScript());
MOZ_ASSERT(!aRequest->mInDeferList && !aRequest->mInAsyncList);
if (aRequest->mInCompilingList) {
mOffThreadCompilingRequests.Remove(aRequest);
aRequest->mInCompilingList = false;
}
MOZ_ASSERT(!aRequest->mInCompilingList);
aRequest->mInDeferList = true;
mDeferRequests.AppendElement(aRequest);
@@ -4444,11 +4447,7 @@ void ScriptLoader::AddDeferRequest(ScriptLoadRequest* aRequest) {
void ScriptLoader::AddAsyncRequest(ScriptLoadRequest* aRequest) {
MOZ_ASSERT(aRequest->IsAsyncScript());
MOZ_ASSERT(!aRequest->mInDeferList && !aRequest->mInAsyncList);
if (aRequest->mInCompilingList) {
mOffThreadCompilingRequests.Remove(aRequest);
aRequest->mInCompilingList = false;
}
MOZ_ASSERT(!aRequest->mInCompilingList);
aRequest->mInAsyncList = true;
if (aRequest->IsReadyToRun()) {