Bug 1226443 P6 Ignore update() called during top level service worker script evaluation. r=ehsan

This commit is contained in:
Ben Kelly 2015-12-11 14:53:11 -05:00
parent da61400d46
commit b0f1420e24

View File

@ -1000,6 +1000,14 @@ ServiceWorkerRegistrationWorkerThread::Update(ErrorResult& aRv)
return nullptr;
}
// Avoid infinite update loops by ignoring update() calls during top
// level script evaluation. See:
// https://github.com/slightlyoff/ServiceWorker/issues/800
if (worker->LoadScriptAsPartOfLoadingServiceWorkerScript()) {
promise->MaybeResolve(JS::UndefinedHandleValue);
return promise.forget();
}
RefPtr<PromiseWorkerProxy> proxy = PromiseWorkerProxy::Create(worker, promise);
if (!proxy) {
aRv.Throw(NS_ERROR_DOM_ABORT_ERR);