Changeset 256432 in webkit


Ignore:
Timestamp:
Feb 12, 2020 7:32:51 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

    r256426 r256432  
     12020-02-12  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  Youenn Fablet  <youenn@apple.com>
    215
  • trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp

    r256383 r256432  
    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

    r256395 r256432  
     12020-02-12  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  Rob Buis  <rbuis@igalia.com>
    211
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm

    r256383 r256432  
    16771677    waitUntilServiceWorkerProcessBackgroundActivityState(webView.get(), false);
    16781678    waitUntilServiceWorkerProcessForegroundActivityState(webView.get(), false);
     1679
     1680    auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
     1681
     1682    [webView2 loadRequest:server.request()];
     1683
     1684    [webView _close];
     1685    webView = nullptr;
     1686
     1687    // The service worker process should take activity based on webView2 process.
     1688    [webView2 _setAssertionStateForTesting: 1];
     1689    while (webView2.get()._hasServiceWorkerForegroundActivityForTesting || !webView2.get()._hasServiceWorkerBackgroundActivityForTesting) {
     1690        [webView2 _setAssertionStateForTesting: 1];
     1691        TestWebKitAPI::Util::spinRunLoop(1);
     1692    }
     1693
     1694    while (!webView2.get()._hasServiceWorkerForegroundActivityForTesting || webView2.get()._hasServiceWorkerBackgroundActivityForTesting) {
     1695        [webView2 _setAssertionStateForTesting: 3];
     1696        TestWebKitAPI::Util::spinRunLoop(1);
     1697    }
     1698
     1699    while (webView2.get()._hasServiceWorkerForegroundActivityForTesting || webView2.get()._hasServiceWorkerBackgroundActivityForTesting) {
     1700        [webView2 _setAssertionStateForTesting: 0];
     1701        TestWebKitAPI::Util::spinRunLoop(1);
     1702    }
    16791703}
    16801704
Note: See TracChangeset for help on using the changeset viewer.