[DOM] Be more explicit about the WorkerPrivate self-reference.

This commit is contained in:
Jens Stutte 2021-08-12 11:39:07 +00:00 committed by roytam1
commit 04fdc6e681

View file

@ -4339,6 +4339,11 @@ WorkerPrivate::Constructor(JSContext* aCx,
return nullptr;
}
// From this point on (worker thread has been started) we
// must keep ourself alive. We can now only be cleared by
// ClearSelfAndParentEventTargetRef().
worker->mSelfRef = worker;
worker->EnableDebugger();
RefPtr<CompileScriptRunnable> compiler =
@ -4348,8 +4353,6 @@ WorkerPrivate::Constructor(JSContext* aCx,
return nullptr;
}
worker->mSelfRef = worker;
return worker.forget();
}