Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 89f18277fe742a66605ffb4401a3732ae4bff55b
      
https://github.com/WebKit/WebKit/commit/89f18277fe742a66605ffb4401a3732ae4bff55b
  Author: Rupin Mittal <[email protected]>
  Date:   2026-06-05 (Fri, 05 Jun 2026)

  Changed paths:
    M Source/WebKit/UIProcess/WebProcessProxy.cpp
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebLocks.mm

  Log Message:
  -----------
  Cherry pick 305413.913@safari-7624-branch (58357344684a)
https://bugs.webkit.org/show_bug.cgi?id=316377
rdar://178787581

    Webpage reloaded because a problem occurred (Invalid message 
WebLockRegistryProxy::clientIsGoingAway)
    https://bugs.webkit.org/show_bug.cgi?id=314863
    rdar://177020691

    Reviewed by Chris Dumez.

    In https://bugs.webkit.org/show_bug.cgi?id=310289, we added message checks 
to
    various WebLock IPCs in the UI process to validate the ClientOrigin sent by
    the web process. Now, on various sites, the web page is often being reloaded
    because "an error occurred". We are hitting this message check:

    MESSAGE_CHECK(m_process->hasCommittedClientOrigin(clientOrigin));
    in WebLockRegistryProxy::clientIsGoingAway().

    Suppose we have a web process in which the main frame (mainframe.com) has a
    service or shared worker in the same process and also a cross-site iframe
    (iframe.com). Then the iframe is torn down resulting in the
    WebLockRegistryProxy::clientIsGoingAway() IPC being sent. In this IPC, we
    have a message check that calls WebProcessProxy::hasCommittedClientOrigin()
    to confirm if this web process has committed a load of this ClientOrigin
    before (in this case, the iframe's ClientOrigin).

    We have indeed committed a load for this iframe's ClientOrigin and it will
    indeed show up in m_committedClientOrigins. But currently, since the web
    process has a running worker, we don't check m_committedClientOrigins at 
all.
    This web process has m_site (the main frame's site mainframe.com), So we 
simply
    check if this iframe's ClientOrigin's topOrigin (mainframe.com) and 
clientOrigin
    (iframe.com) both match m_site. Since the clientOrigin does not,
    hasCommittedClientOrigin() returns false, and the message check terminates 
the
    web process.

    We fix this by ensuring that hasCommittedClientOrigin() first checks
    m_committedClientOrigins. Only if it does not find the ClientOrigin there, 
will
    it check the isRunningWorkers() case.

    This same message check appears in another WebLock IPC (requestLock). This 
new
    test checks that the message check there passes as well:
    TEST(WebLocks, CrossSiteIframeUsingLocksInServiceWorkerHostingProcess).

    * Source/WebKit/UIProcess/WebProcessProxy.cpp:
    (WebKit::WebProcessProxy::hasCommittedClientOrigin const):
    * Tools/TestWebKitAPI/Tests/WebKitCocoa/WebLocks.mm:
    (TestWebKitAPI::TEST(WebLocks, 
CrossSiteIframeUsingLocksInServiceWorkerHostingProcess)):

Originally-landed-as: 305413.913@safari-7624-branch (58357344684a). 
rdar://177020691
Canonical link: https://commits.webkit.org/314641@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to