summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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();
}