summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Stutte <jstutte@mozilla.com>2021-08-12 11:39:07 +0000
committerMoonchild <moonchild@palemoon.org>2021-08-12 11:39:07 +0000
commitfe2ea0ce886c6f7601d2eb27d508ecb9cb991e12 (patch)
treefe9fde44aeacfd1b81462d9ed3fee830c594c529
parentfa49002626ffa4894fc685536ae23251400481be (diff)
downloaduxp-fe2ea0ce886c6f7601d2eb27d508ecb9cb991e12.tar.gz
[DOM] Be more explicit about the WorkerPrivate self-reference.
-rw-r--r--dom/workers/WorkerPrivate.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
index f33ded1c5f..5edf7dc4a5 100644
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -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();
}