summaryrefslogtreecommitdiffstats
path: root/dom/workers/ScriptLoader.cpp
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-07-05 13:04:44 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-07-05 13:04:44 +0200
commita80267e9e88b3dcebf7f8f1f6f10931a99ddf2ca (patch)
tree24d69034f60ed1f6bf79cccfbbe05f10c26238ff /dom/workers/ScriptLoader.cpp
parentc3916ca1a0164dcb7742360a43d7ab36a80907fc (diff)
downloadUXP-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/ScriptLoader.cpp')
-rw-r--r--dom/workers/ScriptLoader.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp
index 46545e737..56b18441e 100644
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -2118,12 +2118,16 @@ LoadAllScripts(WorkerPrivate* aWorkerPrivate,
aWorkerPrivate->AssertIsOnWorkerThread();
NS_ASSERTION(!aLoadInfos.IsEmpty(), "Bad arguments!");
- AutoSyncLoopHolder syncLoop(aWorkerPrivate);
+ AutoSyncLoopHolder syncLoop(aWorkerPrivate, Terminating);
+ nsCOMPtr<nsIEventTarget> syncLoopTarget = syncLoop.GetEventTarget();
+ if (!syncLoopTarget) {
+ aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
+ return;
+ }
RefPtr<ScriptLoaderRunnable> loader =
- new ScriptLoaderRunnable(aWorkerPrivate, syncLoop.EventTarget(),
- aLoadInfos, aIsMainScript, aWorkerScriptType,
- aRv);
+ new ScriptLoaderRunnable(aWorkerPrivate, syncLoopTarget, aLoadInfos,
+ aIsMainScript, aWorkerScriptType, aRv);
NS_ASSERTION(aLoadInfos.IsEmpty(), "Should have swapped!");
@@ -2184,7 +2188,7 @@ ChannelFromScriptURLWorkerThread(JSContext* aCx,
new ChannelGetterRunnable(aParent, aScriptURL, aChannel);
ErrorResult rv;
- getter->Dispatch(rv);
+ getter->Dispatch(Terminating, rv);
if (rv.Failed()) {
NS_ERROR("Failed to dispatch!");
return rv.StealNSResult();