Index: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
index 867168b7d5ceedaa4be5aa3fd3ec823b5b38112d..723f9803af9b453c862d77f2d32595b2fc4c0e5d 100644 |
--- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
+++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
@@ -151,7 +151,8 @@ void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent( |
void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent( |
int fetchEventID, |
- const WebServiceWorkerRequest& webRequest) { |
+ const WebServiceWorkerRequest& webRequest, |
+ bool navigationPreloadSent) { |
ScriptState::Scope scope( |
workerGlobalScope()->scriptController()->getScriptState()); |
WaitUntilObserver* waitUntilObserver = WaitUntilObserver::create( |
@@ -168,9 +169,17 @@ void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent( |
eventInit.setClientId( |
webRequest.isMainResourceLoad() ? WebString() : webRequest.clientId()); |
eventInit.setIsReload(webRequest.isReload()); |
+ ScriptState* scriptState = |
+ workerGlobalScope()->scriptController()->getScriptState(); |
FetchEvent* fetchEvent = FetchEvent::create( |
- workerGlobalScope()->scriptController()->getScriptState(), |
- EventTypeNames::fetch, eventInit, respondWithObserver, waitUntilObserver); |
+ scriptState, EventTypeNames::fetch, eventInit, respondWithObserver, |
+ waitUntilObserver, navigationPreloadSent); |
+ if (navigationPreloadSent) { |
+ ServiceWorkerGlobalScopeClient::from(workerGlobalScope()) |
+ ->registerPreloadResponseCallback( |
+ fetchEventID, |
+ fetchEvent->createPreloadResponseCallback(scriptState)); |
+ } |
waitUntilObserver->willDispatchEvent(); |
respondWithObserver->willDispatchEvent(); |
DispatchEventResult dispatchResult = |