diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-07-05 13:04:44 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-07-05 13:04:44 +0200 |
commit | a80267e9e88b3dcebf7f8f1f6f10931a99ddf2ca (patch) | |
tree | 24d69034f60ed1f6bf79cccfbbe05f10c26238ff /dom/workers/WorkerRunnable.cpp | |
parent | c3916ca1a0164dcb7742360a43d7ab36a80907fc (diff) | |
download | UXP-a80267e9e88b3dcebf7f8f1f6f10931a99ddf2ca.tar UXP-a80267e9e88b3dcebf7f8f1f6f10931a99ddf2ca.tar.gz UXP-a80267e9e88b3dcebf7f8f1f6f10931a99ddf2ca.tar.lz UXP-a80267e9e88b3dcebf7f8f1f6f10931a99ddf2ca.tar.xz UXP-a80267e9e88b3dcebf7f8f1f6f10931a99ddf2ca.zip |
Bug 604026 - Sync event loops in workers should be created only if compatible with the worker shutdown status
Diffstat (limited to 'dom/workers/WorkerRunnable.cpp')
-rw-r--r-- | dom/workers/WorkerRunnable.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/dom/workers/WorkerRunnable.cpp b/dom/workers/WorkerRunnable.cpp index 1e16d7254..6bbe40f66 100644 --- a/dom/workers/WorkerRunnable.cpp +++ b/dom/workers/WorkerRunnable.cpp @@ -568,15 +568,20 @@ WorkerMainThreadRunnable::WorkerMainThreadRunnable(WorkerPrivate* aWorkerPrivate } void -WorkerMainThreadRunnable::Dispatch(ErrorResult& aRv) +WorkerMainThreadRunnable::Dispatch(Status aFailStatus, ErrorResult& aRv) { mWorkerPrivate->AssertIsOnWorkerThread(); TimeStamp startTime = TimeStamp::NowLoRes(); - AutoSyncLoopHolder syncLoop(mWorkerPrivate); + AutoSyncLoopHolder syncLoop(mWorkerPrivate, aFailStatus); - mSyncLoopTarget = syncLoop.EventTarget(); + mSyncLoopTarget = syncLoop.GetEventTarget(); + if (!mSyncLoopTarget) { + // SyncLoop creation can fail if the worker is shutting down. + aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); + return; + } DebugOnly<nsresult> rv = mWorkerPrivate->DispatchToMainThread(this); MOZ_ASSERT(NS_SUCCEEDED(rv), @@ -621,7 +626,7 @@ bool WorkerCheckAPIExposureOnMainThreadRunnable::Dispatch() { ErrorResult rv; - WorkerMainThreadRunnable::Dispatch(rv); + WorkerMainThreadRunnable::Dispatch(Terminating, rv); bool ok = !rv.Failed(); rv.SuppressException(); return ok; |