Bug 1447871 P1 Call DisconnectFromOwner() on service worker binding objects in FreeInnerObjects(). r=asuth

This commit is contained in:
Ben Kelly 2018-03-30 11:25:47 -07:00
Родитель c66f288715
Коммит 5937e67051
1 изменённых файлов: 17 добавлений и 0 удалений

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

@ -1379,6 +1379,23 @@ nsGlobalWindowInner::FreeInnerObjects()
// that the Promises can resolve.
CallDocumentFlushedResolvers();
mObservingDidRefresh = false;
// Disconnect service worker objects in FreeInnerObjects(). This is normally
// done from CleanUp(). In the future we plan to unify CleanUp() and
// FreeInnerObjects(). See bug 1450266.
ForEachEventTargetObject([&] (DOMEventTargetHelper* aTarget, bool* aDoneOut) {
RefPtr<ServiceWorkerRegistration> swr = do_QueryObject(aTarget);
if (swr) {
aTarget->DisconnectFromOwner();
return;
}
RefPtr<ServiceWorker> sw = do_QueryObject(aTarget);
if (sw) {
aTarget->DisconnectFromOwner();
return;
}
});
}
//*****************************************************************************