Title: [256954] branches/safari-609.1.20.0-branch
Revision
256954
Author
alanc...@apple.com
Date
2020-02-19 15:07:39 -0800 (Wed, 19 Feb 2020)

Log Message

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

    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.0-branch/Source/WebKit/ChangeLog (256953 => 256954)


--- branches/safari-609.1.20.0-branch/Source/WebKit/ChangeLog	2020-02-19 23:07:36 UTC (rev 256953)
+++ branches/safari-609.1.20.0-branch/Source/WebKit/ChangeLog	2020-02-19 23:07:39 UTC (rev 256954)
@@ -1,3 +1,40 @@
+2020-02-19  Russell Epstein  <repst...@apple.com>
+
+        Cherry-pick r256314. rdar://problem/59446974
+
+    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-14  Russell Epstein  <repst...@apple.com>
 
         Cherry-pick r252849. rdar://problem/59446998

Modified: branches/safari-609.1.20.0-branch/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp (256953 => 256954)


--- branches/safari-609.1.20.0-branch/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp	2020-02-19 23:07:36 UTC (rev 256953)
+++ branches/safari-609.1.20.0-branch/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp	2020-02-19 23:07:39 UTC (rev 256954)
@@ -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.0-branch/Tools/ChangeLog (256953 => 256954)


--- branches/safari-609.1.20.0-branch/Tools/ChangeLog	2020-02-19 23:07:36 UTC (rev 256953)
+++ branches/safari-609.1.20.0-branch/Tools/ChangeLog	2020-02-19 23:07:39 UTC (rev 256954)
@@ -1,3 +1,36 @@
+2020-02-19  Russell Epstein  <repst...@apple.com>
+
+        Cherry-pick r256314. rdar://problem/59446974
+
+    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.0-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm (256953 => 256954)


--- branches/safari-609.1.20.0-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm	2020-02-19 23:07:36 UTC (rev 256953)
+++ branches/safari-609.1.20.0-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm	2020-02-19 23:07:39 UTC (rev 256954)
@@ -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