зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1465670 P8 Convert WorkerPrivate::LoadScriptAsPartOfLoadingServiceWorkerScript() to simply IsLoadWorkerScript(). r=asuth
This commit is contained in:
Родитель
81094133b3
Коммит
4f4a0da820
|
@ -731,7 +731,7 @@ ServiceWorkerRegistrationWorkerThread::Update()
|
|||
// Avoid infinite update loops by ignoring update() calls during top
|
||||
// level script evaluation. See:
|
||||
// https://github.com/slightlyoff/ServiceWorker/issues/800
|
||||
if (workerRef->Private()->LoadScriptAsPartOfLoadingServiceWorkerScript()) {
|
||||
if (workerRef->Private()->IsLoadingWorkerScript()) {
|
||||
return ServiceWorkerRegistrationPromise::CreateAndResolve(mDescriptor,
|
||||
__func__);
|
||||
}
|
||||
|
|
|
@ -913,7 +913,7 @@ private:
|
|||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
if (IsMainWorkerScript() && mWorkerPrivate->IsServiceWorker()) {
|
||||
if (IsMainWorkerScript()) {
|
||||
mWorkerPrivate->SetLoadingWorkerScript(true);
|
||||
}
|
||||
|
||||
|
@ -2186,7 +2186,7 @@ ScriptExecutorRunnable::ShutdownScriptLoader(JSContext* aCx,
|
|||
|
||||
MOZ_ASSERT(mLastIndex == mScriptLoader.mLoadInfos.Length() - 1);
|
||||
|
||||
if (mIsWorkerScript && aWorkerPrivate->IsServiceWorker()) {
|
||||
if (mIsWorkerScript) {
|
||||
aWorkerPrivate->SetLoadingWorkerScript(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -1043,26 +1043,19 @@ public:
|
|||
return mLoadInfo.mServiceWorkersTestingInWindow;
|
||||
}
|
||||
|
||||
// This is used to handle importScripts(). When the worker is first loaded
|
||||
// and executed, it happens in a sync loop. At this point it sets
|
||||
// mLoadingWorkerScript to true. importScripts() calls that occur during the
|
||||
// execution run in nested sync loops and so this continues to return true,
|
||||
// leading to these scripts being cached offline.
|
||||
// mLoadingWorkerScript is set to false when the top level loop ends.
|
||||
// importScripts() in function calls or event handlers are always fetched
|
||||
// from the network.
|
||||
// Determine if the worker is currently loading its top level script.
|
||||
bool
|
||||
LoadScriptAsPartOfLoadingServiceWorkerScript()
|
||||
IsLoadingWorkerScript() const
|
||||
{
|
||||
MOZ_ASSERT(IsServiceWorker());
|
||||
return mLoadingWorkerScript;
|
||||
}
|
||||
|
||||
// Called by ScriptLoader to track when this worker is loading its
|
||||
// top level script.
|
||||
void
|
||||
SetLoadingWorkerScript(bool aLoadingWorkerScript)
|
||||
{
|
||||
// any thread
|
||||
MOZ_ASSERT(IsServiceWorker());
|
||||
mLoadingWorkerScript = aLoadingWorkerScript;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче