зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1517896 - Fix shell context shutdown ordering, r=jonco
--HG-- extra : rebase_source : 530a05250ed4b02206b62d4499fda8cdb5c5462e extra : amend_source : 7f28a75c5d1abea4bc1076c92fa48fae964ae054
This commit is contained in:
Родитель
48966022b4
Коммит
c16d6182cb
|
@ -3978,8 +3978,9 @@ static void WorkerMain(WorkerInput* input) {
|
|||
auto guard = mozilla::MakeScopeExit([&] {
|
||||
CancelOffThreadJobsForContext(cx);
|
||||
sc->markObservers.reset();
|
||||
JS_DestroyContext(cx);
|
||||
JS_SetContextPrivate(cx, nullptr);
|
||||
js_delete(sc);
|
||||
JS_DestroyContext(cx);
|
||||
js_delete(input);
|
||||
});
|
||||
|
||||
|
@ -10986,6 +10987,8 @@ int main(int argc, char** argv, char** envp) {
|
|||
|
||||
CancelOffThreadJobsForRuntime(cx);
|
||||
|
||||
JS_SetContextPrivate(cx, nullptr);
|
||||
sc.reset();
|
||||
JS_DestroyContext(cx);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -184,15 +184,19 @@ void js::DestroyContext(JSContext* cx) {
|
|||
|
||||
cx->jobQueue = nullptr;
|
||||
cx->internalJobQueue = nullptr;
|
||||
SetContextProfilingStack(cx, nullptr);
|
||||
|
||||
JSRuntime* rt = cx->runtime();
|
||||
|
||||
// Flush promise tasks executing in helper threads early, before any parts
|
||||
// of the JSRuntime that might be visible to helper threads are torn down.
|
||||
cx->runtime()->offThreadPromiseState.ref().shutdown(cx);
|
||||
rt->offThreadPromiseState.ref().shutdown(cx);
|
||||
|
||||
// Destroy the runtime along with its last context.
|
||||
cx->runtime()->destroyRuntime();
|
||||
js_delete(cx->runtime());
|
||||
js::AutoNoteSingleThreadedRegion nochecks;
|
||||
rt->destroyRuntime();
|
||||
js_delete_poison(cx);
|
||||
js_delete_poison(rt);
|
||||
}
|
||||
|
||||
void JS::RootingContext::checkNoGCRooters() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче