diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index a1a6fe039fe3..04d7be459298 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -4143,6 +4143,7 @@ WorkerPrivate::WorkerPrivate(WorkerPrivate* aParent, , mPRThread(nullptr) , mDebuggerEventLoopLevel(0) , mMainThreadEventTarget(do_GetMainThread()) + , mWorkerControlEventTarget(new WorkerControlEventTarget(this)) , mErrorHandlerRecursionCount(0) , mNextTimeoutId(1) , mStatus(Pending) @@ -4209,6 +4210,7 @@ WorkerPrivate::WorkerPrivate(WorkerPrivate* aParent, WorkerPrivate::~WorkerPrivate() { + mWorkerControlEventTarget->ForgetWorkerPrivate(this); } // static diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h index 3a250ce4e24b..5eade636ce87 100644 --- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -937,6 +937,7 @@ class WorkerPrivate : public WorkerPrivateParent uint32_t mDebuggerEventLoopLevel; RefPtr mMainThreadThrottledEventQueue; nsCOMPtr mMainThreadEventTarget; + RefPtr mWorkerControlEventTarget; struct SyncLoopInfo {