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

Log Message

Cherry-pick r256432. 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@256432 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-609.1.20.0-branch/Source/WebKit/ChangeLog (256956 => 256957)


--- branches/safari-609.1.20.0-branch/Source/WebKit/ChangeLog	2020-02-19 23:07:45 UTC (rev 256956)
+++ branches/safari-609.1.20.0-branch/Source/WebKit/ChangeLog	2020-02-19 23:07:48 UTC (rev 256957)
@@ -1,5 +1,42 @@
 2020-02-19  Russell Epstein  <repst...@apple.com>
 
+        Cherry-pick r256432. 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@256432 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-02-12  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  Russell Epstein  <repst...@apple.com>
+
         Cherry-pick r256426. rdar://problem/59447008
 
     [ Mac Debug wk2 ] ASSERTION FAILED: m_wasConstructedOnMainThread == isMainThread()

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


--- branches/safari-609.1.20.0-branch/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp	2020-02-19 23:07:45 UTC (rev 256956)
+++ branches/safari-609.1.20.0-branch/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp	2020-02-19 23:07:48 UTC (rev 256957)
@@ -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 (256956 => 256957)


--- branches/safari-609.1.20.0-branch/Tools/ChangeLog	2020-02-19 23:07:45 UTC (rev 256956)
+++ branches/safari-609.1.20.0-branch/Tools/ChangeLog	2020-02-19 23:07:48 UTC (rev 256957)
@@ -1,5 +1,38 @@
 2020-02-19  Russell Epstein  <repst...@apple.com>
 
+        Cherry-pick r256432. 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@256432 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-02-12  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-19  Russell Epstein  <repst...@apple.com>
+
         Cherry-pick r256383. rdar://problem/59446974
 
     Unreviewed, rolling out r256314.

Modified: branches/safari-609.1.20.0-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm (256956 => 256957)


--- branches/safari-609.1.20.0-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm	2020-02-19 23:07:45 UTC (rev 256956)
+++ branches/safari-609.1.20.0-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm	2020-02-19 23:07:48 UTC (rev 256957)
@@ -1677,6 +1677,30 @@
     [webView _setAssertionStateForTesting: 0];
     waitUntilServiceWorkerProcessBackgroundActivityState(webView.get(), false);
     waitUntilServiceWorkerProcessForegroundActivityState(webView.get(), false);
+
+    auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+
+    [webView2 loadRequest:server.request()];
+
+    [webView _close];
+    webView = nullptr;
+
+    // The service worker process should take activity based on webView2 process.
+    [webView2 _setAssertionStateForTesting: 1];
+    while (webView2.get()._hasServiceWorkerForegroundActivityForTesting || !webView2.get()._hasServiceWorkerBackgroundActivityForTesting) {
+        [webView2 _setAssertionStateForTesting: 1];
+        TestWebKitAPI::Util::spinRunLoop(1);
+    }
+
+    while (!webView2.get()._hasServiceWorkerForegroundActivityForTesting || webView2.get()._hasServiceWorkerBackgroundActivityForTesting) {
+        [webView2 _setAssertionStateForTesting: 3];
+        TestWebKitAPI::Util::spinRunLoop(1);
+    }
+
+    while (webView2.get()._hasServiceWorkerForegroundActivityForTesting || webView2.get()._hasServiceWorkerBackgroundActivityForTesting) {
+        [webView2 _setAssertionStateForTesting: 0];
+        TestWebKitAPI::Util::spinRunLoop(1);
+    }
 }
 
 TEST(ServiceWorkers, SuspendServiceWorkerProcessBasedOnClientProcesses)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to