Bug 1678774 - Cancel off-thread compilations when destroying a ScriptLoader r=dpalmeiro

There are parse tasks present when the JS engine is being shut down that have
finished but haven't had their results collected by the embedding. This
shouldn't happen, and I think it's happening here because we're leaking a
JSRuntime (we cancel these when we shut down a runtime).

There's a comment that says this isn't necessary but cancelling outstanding
compile requests in ScriptLoader::Destroy fixes this problem on try. I don't
understand well enough to know what's going wrong with the current approach but
this fixes both the crash and the leak.

Differential Revision: https://phabricator.services.mozilla.com/D119315
This commit is contained in:
Jon Coppeard
2021-07-12 16:30:59 +00:00
parent 3d95ad42dc
commit a62fd4d79c
3 changed files with 13 additions and 15 deletions

View File

@@ -150,8 +150,8 @@ void ScriptLoadRequest::SetReady() {
}
void ScriptLoadRequest::Cancel() {
MaybeCancelOffThreadScript();
mIsCanceled = true;
MaybeCancelOffThreadScript();
}
void ScriptLoadRequest::MaybeCancelOffThreadScript() {