Bug 1423412 P1 Actually mark window/worker ClientSource objects controlled when loaded with a controlling service worker. r=baku r=jld

This commit is contained in:
Ben Kelly
2017-12-05 20:45:22 -05:00
parent 01cf3d8a39
commit 1928345b3c
16 changed files with 213 additions and 3 deletions

View File

@@ -570,6 +570,7 @@ class ScriptLoaderRunnable final : public nsIRunnable,
nsCOMPtr<nsIEventTarget> mSyncLoopTarget;
nsTArray<ScriptLoadInfo> mLoadInfos;
RefPtr<CacheCreator> mCacheCreator;
Maybe<ServiceWorkerDescriptor> mController;
bool mIsMainScript;
WorkerScriptType mWorkerScriptType;
bool mCanceled;
@@ -1216,6 +1217,10 @@ private:
// XHR Params Allowed
mWorkerPrivate->SetXHRParamsAllowed(parent->XHRParamsAllowed());
}
if (chanLoadInfo) {
mController = chanLoadInfo->GetController();
}
}
return NS_OK;
@@ -1982,8 +1987,11 @@ ScriptExecutorRunnable::WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
}
// If this is a top level script that succeeded, then mark the
// Client execution ready.
// Client execution ready and possible controlled by a service worker.
if (mIsWorkerScript) {
if (mScriptLoader.mController.isSome()) {
aWorkerPrivate->Control(mScriptLoader.mController.ref());
}
aWorkerPrivate->ExecutionReady();
}