WebProcess should pass the registration identifier and not the worker identifier...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Jan 2018 19:43:35 +0000 (19:43 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Jan 2018 19:43:35 +0000 (19:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=181591

Patch by Youenn Fablet <youenn@apple.com> on 2018-01-12
Reviewed by Chris Dumez.

Source/WebCore:

Test: http/wpt/service-workers/update-service-worker.https.html

Store service worker registration identifier in ResourceLoaderOptions instead of service worker identifier.

* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
(WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
* loader/ResourceLoaderOptions.h:
* loader/WorkerThreadableLoader.cpp:
(WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::prepareFetch):
(WebCore::CachedResourceLoader::determineRevalidationPolicy const):
* loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::setSelectedServiceWorkerRegistrationIdentifierIfNeeded):
(WebCore::CachedResourceRequest::setNavigationServiceWorkerRegistrationData):
(WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded): Deleted.
* loader/cache/CachedResourceRequest.h:
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::loadSynchronously):
(WebCore::WorkerScriptLoader::loadAsynchronously):
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::activeWorkerFromRegistrationID):
* workers/service/server/SWServer.h:

Source/WebKit:

Use service worker registration identifier to compute the active service worker identifier responsible to handle the fetch event.

* StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::startFetch):
* StorageProcess/ServiceWorker/WebSWServerConnection.h:
* StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
* WebProcess/Storage/ServiceWorkerClientFetch.cpp:
(WebKit::ServiceWorkerClientFetch::start):
* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::startFetch):
* WebProcess/Storage/WebSWClientConnection.h:
* WebProcess/Storage/WebServiceWorkerProvider.cpp:
(WebKit::shouldHandleFetch):

LayoutTests:

* http/wpt/service-workers/resources/empty.html: Added.
* http/wpt/service-workers/update-service-worker.https-expected.txt: Added.
* http/wpt/service-workers/update-service-worker.https.html: Added.
* http/wpt/service-workers/update-worker.py: Added.
(main):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226904 268f45cc-cd09-0410-ab3c-d52691b4dbfc

23 files changed:
LayoutTests/ChangeLog
LayoutTests/http/wpt/service-workers/resources/empty.html [new file with mode: 0644]
LayoutTests/http/wpt/service-workers/update-service-worker.https-expected.txt [new file with mode: 0644]
LayoutTests/http/wpt/service-workers/update-service-worker.https.html [new file with mode: 0644]
LayoutTests/http/wpt/service-workers/update-worker.py [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/loader/DocumentThreadableLoader.cpp
Source/WebCore/loader/ResourceLoaderOptions.h
Source/WebCore/loader/WorkerThreadableLoader.cpp
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebCore/loader/cache/CachedResourceRequest.cpp
Source/WebCore/loader/cache/CachedResourceRequest.h
Source/WebCore/workers/WorkerScriptLoader.cpp
Source/WebCore/workers/service/server/SWServer.cpp
Source/WebCore/workers/service/server/SWServer.h
Source/WebKit/ChangeLog
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in
Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp
Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp
Source/WebKit/WebProcess/Storage/WebSWClientConnection.h
Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp

index 99186b8..7bdbe26 100644 (file)
@@ -1,3 +1,16 @@
+2018-01-12  Youenn Fablet  <youenn@apple.com>
+
+        WebProcess should pass the registration identifier and not the worker identifier for fetch events
+        https://bugs.webkit.org/show_bug.cgi?id=181591
+
+        Reviewed by Chris Dumez.
+
+        * http/wpt/service-workers/resources/empty.html: Added.
+        * http/wpt/service-workers/update-service-worker.https-expected.txt: Added.
+        * http/wpt/service-workers/update-service-worker.https.html: Added.
+        * http/wpt/service-workers/update-worker.py: Added.
+        (main):
+
 2018-01-11  Simon Fraser  <simon.fraser@apple.com>
 
         fast/events/ios/rotation/layout-viewport-during-safari-type-rotation.html is flakey
diff --git a/LayoutTests/http/wpt/service-workers/resources/empty.html b/LayoutTests/http/wpt/service-workers/resources/empty.html
new file mode 100644 (file)
index 0000000..7879e1c
--- /dev/null
@@ -0,0 +1,4 @@
+<html>
+<body>
+</body>
+</html>
diff --git a/LayoutTests/http/wpt/service-workers/update-service-worker.https-expected.txt b/LayoutTests/http/wpt/service-workers/update-service-worker.https-expected.txt
new file mode 100644 (file)
index 0000000..fb0f5ae
--- /dev/null
@@ -0,0 +1,4 @@
+
+PASS Setup worker 
+PASS Ensure all fetches are intercepted 
+
diff --git a/LayoutTests/http/wpt/service-workers/update-service-worker.https.html b/LayoutTests/http/wpt/service-workers/update-service-worker.https.html
new file mode 100644 (file)
index 0000000..7d59b14
--- /dev/null
@@ -0,0 +1,46 @@
+<html>
+<head>
+<title>Service Worker update and interception</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
+</head>
+<body>
+<script>
+var registration;
+var iframe;
+promise_test(async (test) => {
+    registration = await navigator.serviceWorker.getRegistration("resources");
+    if (registration)
+        await registration.unregister();
+    registration = await navigator.serviceWorker.register("update-worker.py", { scope : "resources" });
+    activeWorker = registration.active;
+    if (activeWorker)
+        return;
+    activeWorker = registration.installing;
+    await new Promise(resolve => {
+        activeWorker.addEventListener('statechange', () => {
+            if (activeWorker.state === "activated")
+                resolve();
+        });
+    });
+}, "Setup worker");
+
+promise_test(async (test) => {
+    var promises = [];
+    for (var cptr = 0; cptr < 10; cptr++) {
+         if (registration.active) {
+            registration.update();
+            var iframe = await with_iframe("resources/empty.html");
+            await iframe.contentWindow.fetch("mouse").then(async (response) => {
+                if (await response.text() !== "cat")
+                    return Promise.reject("not cat");
+            });
+            iframe.remove();
+        }
+    }
+    await Promise.all(promises);
+}, "Ensure all fetches are intercepted");
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/wpt/service-workers/update-worker.py b/LayoutTests/http/wpt/service-workers/update-worker.py
new file mode 100644 (file)
index 0000000..0315bde
--- /dev/null
@@ -0,0 +1,15 @@
+import time
+
+script = '''
+// Time stamp: %s
+// (This ensures the source text is *not* a byte-for-byte match with any
+// previously-fetched version of this script.)
+
+self.addEventListener("fetch", async (event) => {
+    if (event.request.url.indexOf("mouse") !== -1)
+        event.respondWith(new Response("cat"));
+});'''
+
+
+def main(request, response):
+  return [('Content-Type', 'application/javascript'), ('Cache-Control', 'np-cache, no-store')], script % time.time()
index 1efd47a..8545481 100644 (file)
@@ -1,3 +1,35 @@
+2018-01-12  Youenn Fablet  <youenn@apple.com>
+
+        WebProcess should pass the registration identifier and not the worker identifier for fetch events
+        https://bugs.webkit.org/show_bug.cgi?id=181591
+
+        Reviewed by Chris Dumez.
+
+        Test: http/wpt/service-workers/update-service-worker.https.html
+
+        Store service worker registration identifier in ResourceLoaderOptions instead of service worker identifier.
+
+        * loader/DocumentThreadableLoader.cpp:
+        (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
+        (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
+        * loader/ResourceLoaderOptions.h:
+        * loader/WorkerThreadableLoader.cpp:
+        (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::prepareFetch):
+        (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
+        * loader/cache/CachedResourceRequest.cpp:
+        (WebCore::CachedResourceRequest::setSelectedServiceWorkerRegistrationIdentifierIfNeeded):
+        (WebCore::CachedResourceRequest::setNavigationServiceWorkerRegistrationData):
+        (WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded): Deleted.
+        * loader/cache/CachedResourceRequest.h:
+        * workers/WorkerScriptLoader.cpp:
+        (WebCore::WorkerScriptLoader::loadSynchronously):
+        (WebCore::WorkerScriptLoader::loadAsynchronously):
+        * workers/service/server/SWServer.cpp:
+        (WebCore::SWServer::activeWorkerFromRegistrationID):
+        * workers/service/server/SWServer.h:
+
 2018-01-12  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         [Win][CMake] Remove all-in-one file for WebCore DerivedSources
index 345bdb5..4728da6 100644 (file)
@@ -120,7 +120,7 @@ DocumentThreadableLoader::DocumentThreadableLoader(Document& document, Threadabl
         m_originalHeaders = request.httpHeaderFields();
 
 #if ENABLE(SERVICE_WORKER)
-    if (m_options.serviceWorkersMode == ServiceWorkersMode::All && m_async && (m_options.serviceWorkerIdentifier || document.activeServiceWorker()))
+    if (m_options.serviceWorkersMode == ServiceWorkersMode::All && m_async && (m_options.serviceWorkerRegistrationIdentifier || document.activeServiceWorker()))
         m_options.httpHeadersToKeep = httpHeadersToKeepFromCleaning(request.httpHeaderFields());
 #endif
 
@@ -155,7 +155,7 @@ void DocumentThreadableLoader::makeCrossOriginAccessRequest(ResourceRequest&& re
     else {
 #if ENABLE(SERVICE_WORKER)
         if (m_options.serviceWorkersMode == ServiceWorkersMode::All && m_async) {
-            if (m_options.serviceWorkerIdentifier || document().activeServiceWorker()) {
+            if (m_options.serviceWorkerRegistrationIdentifier || document().activeServiceWorker()) {
                 ASSERT(!m_bypassingPreflightForServiceWorkerRequest);
                 m_bypassingPreflightForServiceWorkerRequest = WTFMove(request);
                 m_options.serviceWorkersMode = ServiceWorkersMode::Only;
index a50439a..18bfdf7 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "FetchOptions.h"
 #include "HTTPHeaderNames.h"
-#include "ServiceWorkerIdentifier.h"
+#include "ServiceWorkerTypes.h"
 #include "StoredCredentialsPolicy.h"
 #include <wtf/HashSet.h>
 #include <wtf/Vector.h>
@@ -141,7 +141,7 @@ struct ResourceLoaderOptions : public FetchOptions {
     InitiatorContext initiatorContext { InitiatorContext::Document };
     ServiceWorkersMode serviceWorkersMode { ServiceWorkersMode::All };
 #if ENABLE(SERVICE_WORKER)
-    std::optional<ServiceWorkerIdentifier> serviceWorkerIdentifier;
+    std::optional<ServiceWorkerRegistrationIdentifier> serviceWorkerRegistrationIdentifier;
     // WebKit loading code is adding some HTTP headers between the application and the time service worker intercepts the fetch.
     // We keep a list of these headers so that we only remove the ones that are set by the loading code and not by the application.
     // FIXME: Remove this when service worker fetch interception happens before the setting of these headers in the loading code.
index b29ee32..d6f5dc9 100644 (file)
@@ -129,7 +129,7 @@ WorkerThreadableLoader::MainThreadBridge::MainThreadBridge(ThreadableLoaderClien
 #if ENABLE(SERVICE_WORKER)
     optionsCopy->options.serviceWorkersMode = globalScope.isServiceWorkerGlobalScope() ? ServiceWorkersMode::None : ServiceWorkersMode::All;
     if (auto* activeServiceWorker = globalScope.activeServiceWorker())
-        optionsCopy->options.serviceWorkerIdentifier = activeServiceWorker->identifier();
+        optionsCopy->options.serviceWorkerRegistrationIdentifier = activeServiceWorker->registrationIdentifier();
 #endif
 
     InspectorInstrumentation::willSendRequest(globalScope, m_workerRequestIdentifier, request);
index ac086da..ce3b915 100644 (file)
@@ -723,7 +723,7 @@ void CachedResourceLoader::prepareFetch(CachedResource::Type type, CachedResourc
 #if ENABLE(SERVICE_WORKER)
         request.setClientIdentifierIfNeeded(document->identifier());
         if (auto* activeServiceWorker = document->activeServiceWorker())
-            request.setSelectedServiceWorkerIdentifierIfNeeded(activeServiceWorker->identifier());
+            request.setSelectedServiceWorkerRegistrationIdentifierIfNeeded(activeServiceWorker->registrationIdentifier());
 #endif
     }
 
@@ -1028,7 +1028,7 @@ CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalida
 
 #if ENABLE(SERVICE_WORKER)
     // FIXME: We should validate/specify this behavior.
-    if (cachedResourceRequest.options().serviceWorkerIdentifier != existingResource->options().serviceWorkerIdentifier) {
+    if (cachedResourceRequest.options().serviceWorkerRegistrationIdentifier != existingResource->options().serviceWorkerRegistrationIdentifier) {
         LOG(ResourceLoading, "CachedResourceLoader::determineRevalidationPolicy reloading because selected service worker differs");
         return Reload;
     }
index 95e668c..1e3f044 100644 (file)
@@ -282,7 +282,7 @@ void CachedResourceRequest::setClientIdentifierIfNeeded(DocumentIdentifier clien
         m_options.clientIdentifier = clientIdentifier;
 }
 
-void CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded(ServiceWorkerIdentifier identifier)
+void CachedResourceRequest::setSelectedServiceWorkerRegistrationIdentifierIfNeeded(ServiceWorkerRegistrationIdentifier identifier)
 {
     if (isNonSubresourceRequest(m_options.destination))
         return;
@@ -291,10 +291,10 @@ void CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded(ServiceWo
 
     if (m_options.serviceWorkersMode == ServiceWorkersMode::None)
         return;
-    if (m_options.serviceWorkerIdentifier)
+    if (m_options.serviceWorkerRegistrationIdentifier)
         return;
 
-    m_options.serviceWorkerIdentifier = identifier;
+    m_options.serviceWorkerRegistrationIdentifier = identifier;
 }
 
 void CachedResourceRequest::setNavigationServiceWorkerRegistrationData(const std::optional<ServiceWorkerRegistrationData>& data)
@@ -303,7 +303,7 @@ void CachedResourceRequest::setNavigationServiceWorkerRegistrationData(const std
         m_options.serviceWorkersMode = ServiceWorkersMode::None;
         return;
     }
-    m_options.serviceWorkerIdentifier = data->activeWorker->identifier;
+    m_options.serviceWorkerRegistrationIdentifier = data->identifier;
 }
 #endif
 
index 122a28a..90e96c2 100644 (file)
@@ -100,7 +100,7 @@ public:
 
 #if ENABLE(SERVICE_WORKER)
     void setClientIdentifierIfNeeded(DocumentIdentifier);
-    void setSelectedServiceWorkerIdentifierIfNeeded(ServiceWorkerIdentifier);
+    void setSelectedServiceWorkerRegistrationIdentifierIfNeeded(ServiceWorkerRegistrationIdentifier);
     void setNavigationServiceWorkerRegistrationData(const std::optional<ServiceWorkerRegistrationData>&);
 #endif
 
index de88423..1e188bf 100644 (file)
@@ -68,7 +68,7 @@ void WorkerScriptLoader::loadSynchronously(ScriptExecutionContext* scriptExecuti
 #if ENABLE(SERVICE_WORKER)
     options.serviceWorkersMode = workerGlobalScope.isServiceWorkerGlobalScope() ? ServiceWorkersMode::None : ServiceWorkersMode::All;
     if (auto* activeServiceWorker = workerGlobalScope.activeServiceWorker())
-        options.serviceWorkerIdentifier = activeServiceWorker->identifier();
+        options.serviceWorkerRegistrationIdentifier = activeServiceWorker->registrationIdentifier();
 #endif
     WorkerThreadableLoader::loadResourceSynchronously(workerGlobalScope, WTFMove(*request), *this, options);
 }
@@ -98,7 +98,7 @@ void WorkerScriptLoader::loadAsynchronously(ScriptExecutionContext& scriptExecut
 #if ENABLE(SERVICE_WORKER)
     options.serviceWorkersMode = m_client->isServiceWorkerClient() ? ServiceWorkersMode::None : ServiceWorkersMode::All;
     if (auto* activeServiceWorker = scriptExecutionContext.activeServiceWorker())
-        options.serviceWorkerIdentifier = activeServiceWorker->identifier();
+        options.serviceWorkerRegistrationIdentifier = activeServiceWorker->registrationIdentifier();
 #endif
     // During create, callbacks may happen which remove the last reference to this object.
     Ref<WorkerScriptLoader> protectedThis(*this);
index a22e59a..a430acf 100644 (file)
@@ -101,6 +101,12 @@ std::optional<ServiceWorkerClientData> SWServer::serviceWorkerClientByID(const S
     return iterator->value;
 }
 
+SWServerWorker* SWServer::activeWorkerFromRegistrationID(ServiceWorkerRegistrationIdentifier identifier)
+{
+    auto* registration = m_registrationsByID.get(identifier);
+    return registration ? registration->activeWorker() : nullptr;
+}
+
 SWServerRegistration* SWServer::getRegistration(const ServiceWorkerRegistrationKey& registrationKey)
 {
     return m_registrations.get(registrationKey);
index 6483ed2..8b9ad1e 100644 (file)
@@ -148,6 +148,7 @@ public:
 
     WEBCORE_EXPORT SWServerWorker* workerByID(ServiceWorkerIdentifier) const;
     WEBCORE_EXPORT std::optional<ServiceWorkerClientData> serviceWorkerClientByID(const ServiceWorkerClientIdentifier&) const;
+    WEBCORE_EXPORT SWServerWorker* activeWorkerFromRegistrationID(ServiceWorkerRegistrationIdentifier);
 
     WEBCORE_EXPORT void markAllWorkersAsTerminated();
     
index ca5dba6..f759066 100644 (file)
@@ -1,3 +1,24 @@
+2018-01-12  Youenn Fablet  <youenn@apple.com>
+
+        WebProcess should pass the registration identifier and not the worker identifier for fetch events
+        https://bugs.webkit.org/show_bug.cgi?id=181591
+
+        Reviewed by Chris Dumez.
+
+        Use service worker registration identifier to compute the active service worker identifier responsible to handle the fetch event.
+
+        * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
+        (WebKit::WebSWServerConnection::startFetch):
+        * StorageProcess/ServiceWorker/WebSWServerConnection.h:
+        * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
+        * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
+        (WebKit::ServiceWorkerClientFetch::start):
+        * WebProcess/Storage/WebSWClientConnection.cpp:
+        (WebKit::WebSWClientConnection::startFetch):
+        * WebProcess/Storage/WebSWClientConnection.h:
+        * WebProcess/Storage/WebServiceWorkerProvider.cpp:
+        (WebKit::shouldHandleFetch):
+
 2018-01-12  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, rolling out r226826.
index 47218d2..18d841d 100644 (file)
@@ -126,13 +126,14 @@ void WebSWServerConnection::updateWorkerStateInClient(ServiceWorkerIdentifier wo
     send(Messages::WebSWClientConnection::UpdateWorkerState(worker, state));
 }
 
-void WebSWServerConnection::startFetch(uint64_t fetchIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, ResourceRequest&& request, FetchOptions&& options, IPC::FormDataReference&& formData, String&& referrer)
+void WebSWServerConnection::startFetch(uint64_t fetchIdentifier, ServiceWorkerRegistrationIdentifier serviceWorkerRegistrationIdentifier, ResourceRequest&& request, FetchOptions&& options, IPC::FormDataReference&& formData, String&& referrer)
 {
-    auto* worker = server().workerByID(serviceWorkerIdentifier);
+    auto* worker = server().activeWorkerFromRegistrationID(serviceWorkerRegistrationIdentifier);
     if (!worker) {
         m_contentConnection->send(Messages::ServiceWorkerClientFetch::DidNotHandle { }, fetchIdentifier);
         return;
     }
+    auto serviceWorkerIdentifier = worker->identifier();
 
     auto runServerWorkerAndStartFetch = [weakThis = makeWeakPtr(this), this, fetchIdentifier, serviceWorkerIdentifier, request = WTFMove(request), options = WTFMove(options), formData = WTFMove(formData), referrer = WTFMove(referrer)](bool success) mutable {
         if (!weakThis)
@@ -154,10 +155,12 @@ void WebSWServerConnection::startFetch(uint64_t fetchIdentifier, ServiceWorkerId
         });
     };
 
-    if (worker->state() == ServiceWorkerState::Activating)
+    if (worker->state() == ServiceWorkerState::Activating) {
         worker->whenActivated(WTFMove(runServerWorkerAndStartFetch));
-    else
-        runServerWorkerAndStartFetch(true);
+        return;
+    }
+    ASSERT(worker->state() == ServiceWorkerState::Activated);
+    runServerWorkerAndStartFetch(true);
 }
 
 void WebSWServerConnection::postMessageToServiceWorker(ServiceWorkerIdentifier destinationIdentifier, IPC::DataReference&& message, const ServiceWorkerOrClientIdentifier& sourceIdentifier)
index e244cdc..495845b 100644 (file)
@@ -83,7 +83,7 @@ private:
     void notifyClientsOfControllerChange(const HashSet<WebCore::DocumentIdentifier>& contextIdentifiers, const WebCore::ServiceWorkerData& newController);
     void registrationReady(uint64_t registrationReadyRequestIdentifier, WebCore::ServiceWorkerRegistrationData&&) final;
 
-    void startFetch(uint64_t fetchIdentifier, WebCore::ServiceWorkerIdentifier, WebCore::ResourceRequest&&, WebCore::FetchOptions&&, IPC::FormDataReference&&, String&& referrer);
+    void startFetch(uint64_t fetchIdentifier, WebCore::ServiceWorkerRegistrationIdentifier, WebCore::ResourceRequest&&, WebCore::FetchOptions&&, IPC::FormDataReference&&, String&& referrer);
 
     void postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destination, IPC::DataReference&& message, const WebCore::ServiceWorkerOrClientIdentifier& source);
 
index 493a8f2..c7cbc2e 100644 (file)
@@ -29,7 +29,7 @@ messages -> WebSWServerConnection {
     AddServiceWorkerRegistrationInServer(WebCore::ServiceWorkerRegistrationIdentifier identifier)
     RemoveServiceWorkerRegistrationInServer(WebCore::ServiceWorkerRegistrationIdentifier identifier)
 
-    StartFetch(uint64_t identifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, WebCore::ResourceRequest request, struct WebCore::FetchOptions options, IPC::FormDataReference requestBody, String referrer)
+    StartFetch(uint64_t identifier, WebCore::ServiceWorkerRegistrationIdentifier serviceWorkerRegistrationIdentifier, WebCore::ResourceRequest request, struct WebCore::FetchOptions options, IPC::FormDataReference requestBody, String referrer)
 
     PostMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destination, IPC::DataReference message, WebCore::ServiceWorkerOrClientIdentifier source)
 
index 83b2ade..7e8a405 100644 (file)
@@ -72,7 +72,7 @@ void ServiceWorkerClientFetch::start()
     cleanHTTPRequestHeadersForAccessControl(request, options.httpHeadersToKeep);
 
     ASSERT(options.serviceWorkersMode != ServiceWorkersMode::None);
-    m_connection->startFetch(m_loader->identifier(), options.serviceWorkerIdentifier.value(), request, options, referrer);
+    m_connection->startFetch(m_loader->identifier(), options.serviceWorkerRegistrationIdentifier.value(), request, options, referrer);
 }
 
 // https://fetch.spec.whatwg.org/#http-fetch step 3.3
index a8b61b5..2561af7 100644 (file)
@@ -192,9 +192,9 @@ void WebSWClientConnection::getRegistrations(const SecurityOrigin& topOrigin, co
     });
 }
 
-void WebSWClientConnection::startFetch(uint64_t fetchIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, const WebCore::ResourceRequest& request, const WebCore::FetchOptions& options, const String& referrer)
+void WebSWClientConnection::startFetch(uint64_t fetchIdentifier, WebCore::ServiceWorkerRegistrationIdentifier serviceWorkerRegistrationIdentifier, const WebCore::ResourceRequest& request, const WebCore::FetchOptions& options, const String& referrer)
 {
-    send(Messages::WebSWServerConnection::StartFetch { fetchIdentifier, serviceWorkerIdentifier, request, options, IPC::FormDataReference { request.httpBody() }, referrer });
+    send(Messages::WebSWServerConnection::StartFetch { fetchIdentifier, serviceWorkerRegistrationIdentifier, request, options, IPC::FormDataReference { request.httpBody() }, referrer });
 }
 
 void WebSWClientConnection::postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, const IPC::DataReference& message, ServiceWorkerData&& source, const String& sourceOrigin)
index 8b6d98f..fa9581b 100644 (file)
@@ -60,7 +60,7 @@ public:
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
 
     bool mayHaveServiceWorkerRegisteredForOrigin(const WebCore::SecurityOrigin&) const final;
-    void startFetch(uint64_t fetchIdentifier, WebCore::ServiceWorkerIdentifier, const WebCore::ResourceRequest&, const WebCore::FetchOptions&, const String& referrer);
+    void startFetch(uint64_t fetchIdentifier, WebCore::ServiceWorkerRegistrationIdentifier, const WebCore::ResourceRequest&, const WebCore::FetchOptions&, const String& referrer);
 
     void postMessageToServiceWorkerClient(WebCore::DocumentIdentifier destinationContextIdentifier, const IPC::DataReference& message, WebCore::ServiceWorkerData&& source, const String& sourceOrigin);
 
index aff8c2b..d6831ec 100644 (file)
@@ -67,7 +67,7 @@ static inline bool shouldHandleFetch(const ResourceLoaderOptions& options)
     if (isPotentialNavigationOrSubresourceRequest(options.destination))
         return false;
 
-    return !!options.serviceWorkerIdentifier;
+    return !!options.serviceWorkerRegistrationIdentifier;
 }
 
 void WebServiceWorkerProvider::handleFetch(ResourceLoader& loader, CachedResource* resource, PAL::SessionID sessionID, bool shouldClearReferrerOnHTTPSToHTTPRedirect, ServiceWorkerClientFetch::Callback&& callback)