Creation of a service worker connection for a service worker job should be based...
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Sep 2019 16:23:58 +0000 (16:23 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Sep 2019 16:23:58 +0000 (16:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=202185

Reviewed by Alex Christensen.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::swServerForSession):
Assert that registrable domain is not empty.
* NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::scheduleJobInServer):
Use the scope URL instead of the script URL which may be empty in case of an unregister job.

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

Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp

index 249c5fd..922c9ca 100644 (file)
@@ -1,3 +1,17 @@
+2019-09-25  Youenn Fablet  <youenn@apple.com>
+
+        Creation of a service worker connection for a service worker job should be based on the job scope
+        https://bugs.webkit.org/show_bug.cgi?id=202185
+
+        Reviewed by Alex Christensen.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::swServerForSession):
+        Assert that registrable domain is not empty.
+        * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
+        (WebKit::WebSWServerConnection::scheduleJobInServer):
+        Use the scope URL instead of the script URL which may be empty in case of an unregister job.
+
 2019-09-25  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iPadOS] [DataActivation] Focus moves away after focusing input fields on www.att.com
index c290c5d..4d3e19c 100644 (file)
@@ -2383,6 +2383,7 @@ SWServer& NetworkProcess::swServerForSession(PAL::SessionID sessionID)
         ASSERT(sessionID.isEphemeral() || !path.isEmpty());
         
         auto value = makeUnique<SWServer>(makeUniqueRef<WebSWOriginStore>(), WTFMove(path), sessionID, [this, sessionID](auto& registrableDomain) {
+            ASSERT(!registrableDomain.isEmpty());
             parentProcessConnection()->send(Messages::NetworkProcessProxy::EstablishWorkerContextConnectionToNetworkProcess { registrableDomain, sessionID }, 0);
         });
         if (m_shouldDisableServiceWorkerProcessTerminationDelay)
index 572d271..7674140 100644 (file)
@@ -242,7 +242,7 @@ void WebSWServerConnection::postMessageToServiceWorker(ServiceWorkerIdentifier d
 
 void WebSWServerConnection::scheduleJobInServer(ServiceWorkerJobData&& jobData)
 {
-    RegistrableDomain registrableDomain(jobData.scriptURL);
+    RegistrableDomain registrableDomain(jobData.scopeURL);
     if (!server().contextConnectionForRegistrableDomain(registrableDomain))
         server().createContextConnection(registrableDomain);