Index: Source/web/ServiceWorkerGlobalScopeProxy.cpp |
diff --git a/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
index 6b3513a7d5fa1fc44bff93e0b01799d74c2069b7..be40bcbb75ae5e3472a70a11c95b1c3b6878def5 100644 |
--- a/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
+++ b/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
@@ -51,7 +51,9 @@ |
#include "modules/push_messaging/PushMessageData.h" |
#include "modules/serviceworkers/ExtendableEvent.h" |
#include "modules/serviceworkers/FetchEvent.h" |
+#include "modules/serviceworkers/ServiceWorkerClient.h" |
#include "modules/serviceworkers/ServiceWorkerGlobalScope.h" |
+#include "modules/serviceworkers/ServiceWorkerWindowClient.h" |
#include "modules/serviceworkers/WaitUntilObserver.h" |
#include "platform/RuntimeEnabledFeatures.h" |
#include "public/platform/WebCrossOriginServiceWorkerClient.h" |
@@ -103,7 +105,12 @@ void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer |
request->headers()->setGuard(Headers::ImmutableGuard); |
FetchEventInit eventInit; |
eventInit.setRequest(request); |
- eventInit.setIsReload(webRequest.isReload()); |
+ if (webRequest.client().clientType == WebServiceWorkerClientTypeWindow) { |
+ eventInit.setClient(ServiceWorkerWindowClient::create(webRequest.client())); |
+ eventInit.setIsReload(webRequest.isReload()); |
+ } else { |
+ eventInit.setClient(ServiceWorkerClient::create(webRequest.client())); |
+ } |
RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames::fetch, eventInit, observer)); |
defaultPrevented = !m_workerGlobalScope->dispatchEvent(fetchEvent.release()); |
observer->didDispatchEvent(defaultPrevented); |