Title: [256970] branches/safari-609.1.20.1-branch
Revision
256970
Author
repst...@apple.com
Date
2020-02-19 15:37:28 -0800 (Wed, 19 Feb 2020)

Log Message

Cherry-pick r256314. rdar://problem/59576791

    WebSWServerConnection::registerServiceWorkerClient is not sending IPC message to UIProcess when it should
    https://bugs.webkit.org/show_bug.cgi?id=207537

    Reviewed by Chris Dumez.

    Source/WebKit:

    Covered by added API test.

    * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
    (WebKit::WebSWServerConnection::registerServiceWorkerClient):
    Fix use after move so that we can get the context connection and send the IPC message to UIProcess as expected.

    Tools:

    * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:

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

Modified Paths

Diff

Modified: branches/safari-609.1.20.1-branch/Source/WebKit/ChangeLog (256969 => 256970)


--- branches/safari-609.1.20.1-branch/Source/WebKit/ChangeLog	2020-02-19 23:37:22 UTC (rev 256969)
+++ branches/safari-609.1.20.1-branch/Source/WebKit/ChangeLog	2020-02-19 23:37:28 UTC (rev 256970)
@@ -1,5 +1,42 @@
 2020-02-19  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r256314. rdar://problem/59576791
+
+    WebSWServerConnection::registerServiceWorkerClient is not sending IPC message to UIProcess when it should
+    https://bugs.webkit.org/show_bug.cgi?id=207537
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebKit:
+    
+    Covered by added API test.
+    
+    * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
+    (WebKit::WebSWServerConnection::registerServiceWorkerClient):
+    Fix use after move so that we can get the context connection and send the IPC message to UIProcess as expected.
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256314 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-02-11  Youenn Fablet  <you...@apple.com>
+
+            WebSWServerConnection::registerServiceWorkerClient is not sending IPC message to UIProcess when it should
+            https://bugs.webkit.org/show_bug.cgi?id=207537
+
+            Reviewed by Chris Dumez.
+
+            Covered by added API test.
+
+            * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
+            (WebKit::WebSWServerConnection::registerServiceWorkerClient):
+            Fix use after move so that we can get the context connection and send the IPC message to UIProcess as expected.
+
+2020-02-19  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r256191. rdar://problem/59576820
 
     Disallow setting base URL to a data or _javascript_ URL

Modified: branches/safari-609.1.20.1-branch/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp (256969 => 256970)


--- branches/safari-609.1.20.1-branch/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp	2020-02-19 23:37:22 UTC (rev 256969)
+++ branches/safari-609.1.20.1-branch/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp	2020-02-19 23:37:28 UTC (rev 256970)
@@ -319,6 +319,7 @@
     bool isNewOrigin = WTF::allOf(m_clientOrigins.values(), [&contextOrigin](auto& origin) {
         return contextOrigin != origin.clientOrigin;
     });
+    auto* contextConnection = isNewOrigin ? server().contextConnectionForRegistrableDomain(RegistrableDomain { contextOrigin }) : nullptr;
 
     auto clientOrigin = ClientOrigin { WTFMove(topOrigin), WTFMove(contextOrigin) };
     m_clientOrigins.add(data.identifier, clientOrigin);
@@ -327,11 +328,9 @@
     if (!m_isThrottleable)
         updateThrottleState();
 
-    if (isNewOrigin) {
-        if (auto* contextConnection = server().contextConnectionForRegistrableDomain(RegistrableDomain { contextOrigin })) {
-            auto& connection = static_cast<WebSWServerToContextConnection&>(*contextConnection);
-            m_networkProcess->parentProcessConnection()->send(Messages::NetworkProcessProxy::RegisterServiceWorkerClientProcess { identifier(), connection.webProcessIdentifier() }, 0);
-        }
+    if (contextConnection) {
+        auto& connection = static_cast<WebSWServerToContextConnection&>(*contextConnection);
+        m_networkProcess->parentProcessConnection()->send(Messages::NetworkProcessProxy::RegisterServiceWorkerClientProcess { identifier(), connection.webProcessIdentifier() }, 0);
     }
 }
 

Modified: branches/safari-609.1.20.1-branch/Tools/ChangeLog (256969 => 256970)


--- branches/safari-609.1.20.1-branch/Tools/ChangeLog	2020-02-19 23:37:22 UTC (rev 256969)
+++ branches/safari-609.1.20.1-branch/Tools/ChangeLog	2020-02-19 23:37:28 UTC (rev 256970)
@@ -1,3 +1,36 @@
+2020-02-19  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r256314. rdar://problem/59576791
+
+    WebSWServerConnection::registerServiceWorkerClient is not sending IPC message to UIProcess when it should
+    https://bugs.webkit.org/show_bug.cgi?id=207537
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebKit:
+    
+    Covered by added API test.
+    
+    * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
+    (WebKit::WebSWServerConnection::registerServiceWorkerClient):
+    Fix use after move so that we can get the context connection and send the IPC message to UIProcess as expected.
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256314 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-02-11  Youenn Fablet  <you...@apple.com>
+
+            WebSWServerConnection::registerServiceWorkerClient is not sending IPC message to UIProcess when it should
+            https://bugs.webkit.org/show_bug.cgi?id=207537
+
+            Reviewed by Chris Dumez.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
+
 2020-02-17  Ryan Haddad  <ryanhad...@apple.com>
 
         Cherry-pick r255566. rdar://problem/59524417

Modified: branches/safari-609.1.20.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm (256969 => 256970)


--- branches/safari-609.1.20.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm	2020-02-19 23:37:22 UTC (rev 256969)
+++ branches/safari-609.1.20.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm	2020-02-19 23:37:28 UTC (rev 256970)
@@ -1677,6 +1677,22 @@
     [webView _setAssertionStateForTesting: 0];
     waitUntilServiceWorkerProcessBackgroundActivityState(webView.get(), false);
     waitUntilServiceWorkerProcessForegroundActivityState(webView.get(), false);
+
+    [webView _setAssertionStateForTesting: 1];
+    waitUntilServiceWorkerProcessForegroundActivityState(webView.get(), false);
+    waitUntilServiceWorkerProcessBackgroundActivityState(webView.get(), true);
+
+    auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+
+    [webView2 loadRequest:server.request()];
+    [webView2 _setAssertionStateForTesting: 3];
+
+    [webView _close];
+    webView = nullptr;
+
+    // The first webView is closed so the service worker process should take activity based on webView2.
+    waitUntilServiceWorkerProcessForegroundActivityState(webView2.get(), true);
+    waitUntilServiceWorkerProcessBackgroundActivityState(webView2.get(), false);
 }
 
 TEST(ServiceWorkers, SuspendServiceWorkerProcessBasedOnClientProcesses)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to