Bug 1425975 P5 Make ServiceWorkerManager::RemoveRegistration assert there is no controlled document. r=asuth

This commit is contained in:
Ben Kelly 2017-12-22 21:09:18 -05:00
Родитель ef72634aa7
Коммит 12e02a611a
1 изменённых файлов: 6 добавлений и 5 удалений

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

@ -2309,17 +2309,18 @@ ServiceWorkerManager::RemoveScopeAndRegistration(ServiceWorkerRegistrationInfo*
entry.Remove();
}
// The registration should generally only be removed if there are no controlled
// documents, but mControlledDocuments can contain references to potentially
// controlled docs. This happens when the service worker is not active yet.
// We must purge these references since we are evicting the registration.
// Verify there are no controlled documents for the purged registration.
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
for (auto iter = swm->mControlledDocuments.Iter(); !iter.Done(); iter.Next()) {
ServiceWorkerRegistrationInfo* reg = iter.UserData();
MOZ_ASSERT(reg);
if (reg->mScope.Equals(aRegistration->mScope)) {
MOZ_DIAGNOSTIC_ASSERT(false,
"controlled document when removing registration");
iter.Remove();
break;
}
}
#endif
RefPtr<ServiceWorkerRegistrationInfo> info;
data->mInfos.Remove(aRegistration->mScope, getter_AddRefs(info));