Bug 1232444 Only store service worker registrations after install is successful. r=baku

This commit is contained in:
Ben Kelly 2015-12-15 09:50:02 -05:00
parent beda3fab62
commit fcd1d099bd

View File

@ -1182,6 +1182,7 @@ public:
mRegistration->mWaitingWorker = mRegistration->mInstallingWorker.forget();
mRegistration->mWaitingWorker->UpdateState(ServiceWorkerState::Installed);
mRegistration->NotifyListenersOnChange();
swm->StoreRegistration(mPrincipal, mRegistration);
swm->InvalidateServiceWorkerRegistrationWorker(mRegistration,
WhichServiceWorker::INSTALLING_WORKER | WhichServiceWorker::WAITING_WORKER);
@ -1261,7 +1262,6 @@ public:
mRegistration->mPendingUninstall = false;
RefPtr<ServiceWorkerInfo> newest = mRegistration->Newest();
if (newest && mScriptSpec.Equals(newest->ScriptSpec())) {
swm->StoreRegistration(mPrincipal, mRegistration);
Succeed();
// Done() must always be called async from Start()
@ -1277,8 +1277,6 @@ public:
} else {
mRegistration = swm->CreateNewRegistration(mScope, mPrincipal);
}
swm->StoreRegistration(mPrincipal, mRegistration);
} else {
MOZ_ASSERT(mJobType == UpdateJob);