Bug 1402085 P1 Maybe fire ServiceWorkerContainer.ready promise when a registration is resurrected. r=asuth

This commit is contained in:
Ben Kelly 2017-09-22 12:38:09 -07:00
Родитель 78a3e1848f
Коммит c5df01040e
2 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@ -336,6 +336,9 @@ public:
void
WorkerIsIdle(ServiceWorkerInfo* aWorker);
void
CheckPendingReadyPromises();
private:
ServiceWorkerManager();
~ServiceWorkerManager();
@ -446,9 +449,6 @@ private:
StorePendingReadyPromise(nsPIDOMWindowInner* aWindow, nsIURI* aURI,
Promise* aPromise);
void
CheckPendingReadyPromises();
bool
CheckReadyPromise(nsPIDOMWindowInner* aWindow, nsIURI* aURI,
Promise* aPromise);

Просмотреть файл

@ -46,9 +46,14 @@ ServiceWorkerRegisterJob::AsyncExecute()
// unregister so that closing the window by shutting down the browser
// results in the registration being gone on restart.
if (registration->mPendingUninstall) {
registration->mPendingUninstall = false;
swm->StoreRegistration(mPrincipal, registration);
// Its possible that a ready promise is created between when the
// uninstalling flag is set and when we resurrect the registration
// here. In that case we might need to fire the ready promise
// now.
swm->CheckPendingReadyPromises();
}
registration->mPendingUninstall = false;
RefPtr<ServiceWorkerInfo> newest = registration->Newest();
if (newest && mScriptSpec.Equals(newest->ScriptSpec()) && sameUVC) {
SetRegistration(registration);