Bug 1425975 P9 Refactor MaybeCheckNavigationUpdate() to take a ClientInfo instead of a document. r=asuth

This commit is contained in:
Ben Kelly 2017-12-22 21:09:19 -05:00
Родитель f659aa7de9
Коммит ae22e882e6
3 изменённых файлов: 9 добавлений и 8 удалений

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

@ -5599,7 +5599,10 @@ nsDocument::DispatchContentLoadedEvents()
using mozilla::dom::workers::ServiceWorkerManager;
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
if (swm) {
swm->MaybeCheckNavigationUpdate(this);
Maybe<ClientInfo> clientInfo = GetClientInfo();
if (clientInfo.isSome()) {
swm->MaybeCheckNavigationUpdate(clientInfo.ref());
}
}
}

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

@ -2432,10 +2432,9 @@ ServiceWorkerManager::MaybeStopControlling(nsIDocument* aDoc)
}
void
ServiceWorkerManager::MaybeCheckNavigationUpdate(nsIDocument* aDoc)
ServiceWorkerManager::MaybeCheckNavigationUpdate(const ClientInfo& aClientInfo)
{
AssertIsOnMainThread();
MOZ_ASSERT(aDoc);
// We perform these success path navigation update steps when the
// document tells us its more or less done loading. This avoids
// slowing down page load and also lets pages consistently get
@ -2445,10 +2444,9 @@ ServiceWorkerManager::MaybeCheckNavigationUpdate(nsIDocument* aDoc)
// 9.8.22 Else: (respondWith was entered and succeeded)
// If request is a non-subresource request, then: Invoke Soft Update
// algorithm.
RefPtr<ServiceWorkerRegistrationInfo> registration;
mControlledDocuments.Get(aDoc, getter_AddRefs(registration));
if (registration) {
registration->MaybeScheduleUpdate();
ControlledClientData* data = mControlledClients.Get(aClientInfo.Id());
if (data && data->mRegistrationInfo) {
data->mRegistrationInfo->MaybeScheduleUpdate();
}
}

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

@ -320,7 +320,7 @@ public:
ServiceWorkerRegistrationListener* aListener);
void
MaybeCheckNavigationUpdate(nsIDocument* aDoc);
MaybeCheckNavigationUpdate(const ClientInfo& aClientInfo);
nsresult
SendPushEvent(const nsACString& aOriginAttributes,