Changeset 256314 in webkit


Ignore:
Timestamp:
Feb 11, 2020 9:57:16 AM (4 years ago)
Author:
youenn@apple.com
Message:

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:
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r256312 r256314  
     12020-02-11  Youenn Fablet  <youenn@apple.com>
     2
     3        WebSWServerConnection::registerServiceWorkerClient is not sending IPC message to UIProcess when it should
     4        https://bugs.webkit.org/show_bug.cgi?id=207537
     5
     6        Reviewed by Chris Dumez.
     7
     8        Covered by added API test.
     9
     10        * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
     11        (WebKit::WebSWServerConnection::registerServiceWorkerClient):
     12        Fix use after move so that we can get the context connection and send the IPC message to UIProcess as expected.
     13
    1142020-02-11  Brady Eidson  <beidson@apple.com>
    215
  • trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp

    r255058 r256314  
    314314        return contextOrigin != origin.clientOrigin;
    315315    });
     316    auto* contextConnection = isNewOrigin ? server().contextConnectionForRegistrableDomain(RegistrableDomain { contextOrigin }) : nullptr;
    316317
    317318    auto clientOrigin = ClientOrigin { WTFMove(topOrigin), WTFMove(contextOrigin) };
     
    322323        updateThrottleState();
    323324
    324     if (isNewOrigin) {
    325         if (auto* contextConnection = server().contextConnectionForRegistrableDomain(RegistrableDomain { contextOrigin })) {
    326             auto& connection = static_cast<WebSWServerToContextConnection&>(*contextConnection);
    327             m_networkProcess->parentProcessConnection()->send(Messages::NetworkProcessProxy::RegisterServiceWorkerClientProcess { identifier(), connection.webProcessIdentifier() }, 0);
    328         }
     325    if (contextConnection) {
     326        auto& connection = static_cast<WebSWServerToContextConnection&>(*contextConnection);
     327        m_networkProcess->parentProcessConnection()->send(Messages::NetworkProcessProxy::RegisterServiceWorkerClientProcess { identifier(), connection.webProcessIdentifier() }, 0);
    329328    }
    330329}
  • trunk/Tools/ChangeLog

    r256302 r256314  
     12020-02-11  Youenn Fablet  <youenn@apple.com>
     2
     3        WebSWServerConnection::registerServiceWorkerClient is not sending IPC message to UIProcess when it should
     4        https://bugs.webkit.org/show_bug.cgi?id=207537
     5
     6        Reviewed by Chris Dumez.
     7
     8        * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
     9
    1102020-02-11  Lauro Moura  <lmoura@igalia.com>
    211
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm

    r254345 r256314  
    16771677    waitUntilServiceWorkerProcessBackgroundActivityState(webView.get(), false);
    16781678    waitUntilServiceWorkerProcessForegroundActivityState(webView.get(), false);
     1679
     1680    [webView _setAssertionStateForTesting: 1];
     1681    waitUntilServiceWorkerProcessForegroundActivityState(webView.get(), false);
     1682    waitUntilServiceWorkerProcessBackgroundActivityState(webView.get(), true);
     1683
     1684    auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
     1685
     1686    [webView2 loadRequest:server.request()];
     1687    [webView2 _setAssertionStateForTesting: 3];
     1688
     1689    [webView _close];
     1690    webView = nullptr;
     1691
     1692    // The first webView is closed so the service worker process should take activity based on webView2.
     1693    waitUntilServiceWorkerProcessForegroundActivityState(webView2.get(), true);
     1694    waitUntilServiceWorkerProcessBackgroundActivityState(webView2.get(), false);
    16791695}
    16801696
Note: See TracChangeset for help on using the changeset viewer.