mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 20:30:41 +00:00
Bug 1787529 - Align the conditions in ScriptLoadContext::MaybeCancelOffThreadScript to ScriptLoader::AttemptAsyncScriptCompile. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D155740
This commit is contained in:
parent
998208305e
commit
a927c643ec
@ -105,14 +105,15 @@ void ScriptLoadContext::MaybeCancelOffThreadScript() {
|
||||
}
|
||||
|
||||
JSContext* cx = danger::GetJSContext();
|
||||
// Follow the same conditions as ScriptLoader::AttemptAsyncScriptCompile
|
||||
if (mRequest->IsModuleRequest()) {
|
||||
JS::CancelCompileModuleToStencilOffThread(cx, mOffThreadToken);
|
||||
} else if (mRequest->IsSource()) {
|
||||
JS::CancelCompileToStencilOffThread(cx, mOffThreadToken);
|
||||
} else {
|
||||
MOZ_ASSERT(mRequest->IsBytecode());
|
||||
// The conditions should match ScriptLoader::AttemptAsyncScriptCompile.
|
||||
if (mRequest->IsBytecode()) {
|
||||
JS::CancelDecodeStencilOffThread(cx, mOffThreadToken);
|
||||
} else if (mRequest->IsModuleRequest()) {
|
||||
MOZ_ASSERT(mRequest->IsTextSource());
|
||||
JS::CancelCompileModuleToStencilOffThread(cx, mOffThreadToken);
|
||||
} else {
|
||||
MOZ_ASSERT(mRequest->IsTextSource());
|
||||
JS::CancelCompileToStencilOffThread(cx, mOffThreadToken);
|
||||
}
|
||||
|
||||
// Cancellation request above should guarantee removal of the parse task, so
|
||||
|
@ -1646,6 +1646,7 @@ nsresult ScriptLoader::AttemptAsyncScriptCompile(ScriptLoadRequest* aRequest,
|
||||
auto signalOOM = mozilla::MakeScopeExit(
|
||||
[&aRequest]() { aRequest->GetScriptLoadContext()->mRunnable = nullptr; });
|
||||
|
||||
// The conditions should match ScriptLoadContext::MaybeCancelOffThreadScript.
|
||||
if (aRequest->IsBytecode()) {
|
||||
JS::DecodeOptions decodeOptions(options);
|
||||
aRequest->GetScriptLoadContext()->mOffThreadToken =
|
||||
|
Loading…
x
Reference in New Issue
Block a user