Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b58727688abaf30310e8962431b0ce109f083555
      
https://github.com/WebKit/WebKit/commit/b58727688abaf30310e8962431b0ce109f083555
  Author: David Kilzer <[email protected]>
  Date:   2026-08-24 (Mon, 24 Aug 2026)

  Changed paths:
    A LayoutTests/http/tests/web-locks/resources/third-party-service-worker.js
    A 
LayoutTests/http/tests/web-locks/resources/third-party-serviceworker-frame.html
    A 
LayoutTests/http/tests/web-locks/resources/third-party-sharedworker-frame.html
    A 
LayoutTests/http/tests/web-locks/web-lock-in-third-party-serviceworker-expected.txt
    A 
LayoutTests/http/tests/web-locks/web-lock-in-third-party-serviceworker-site-isolation-expected.txt
    A 
LayoutTests/http/tests/web-locks/web-lock-in-third-party-serviceworker-site-isolation.html
    A 
LayoutTests/http/tests/web-locks/web-lock-in-third-party-serviceworker.html
    A 
LayoutTests/http/tests/web-locks/web-lock-in-third-party-sharedworker-expected.txt
    A 
LayoutTests/http/tests/web-locks/web-lock-in-third-party-sharedworker-site-isolation-expected.txt
    A 
LayoutTests/http/tests/web-locks/web-lock-in-third-party-sharedworker-site-isolation.html
    A LayoutTests/http/tests/web-locks/web-lock-in-third-party-sharedworker.html
    M Source/WebKit/UIProcess/WebProcessPool.cpp
    M Source/WebKit/UIProcess/WebProcessProxy.cpp
    M Source/WebKit/UIProcess/WebProcessProxy.h

  Log Message:
  -----------
  MESSAGE_CHECK failure in WebLockRegistryProxy::requestLock for a worker 
registered by a third-party frame
<https://bugs.webkit.org/show_bug.cgi?id=322329>
<rdar://179508210>

Reviewed by Chris Dumez.

`WebLockRegistryProxy` validates the incoming `ClientOrigin` with
`WebProcessProxy::hasCommittedClientOrigin()`. For a WebProcess that
only hosts remote workers there is no committed load, so that predicate
fell back to comparing both halves of the `ClientOrigin` against
`WebProcessProxy::m_site`.

That comparison is wrong. `m_site` of a remote worker process is the
*top* site, because `SWServer` and `WebSharedWorkerServer` ask for a
context connection with `SWServerWorker::topSite()` /
`WebSharedWorker::topSite()`, i.e. with the storage partition rather
than with the worker's own origin. A service worker or a shared worker
registered by a third-party frame has a client origin on a different
site than its partition, so `Site { clientOrigin.clientOrigin }` never
matched `m_site`, the `MESSAGE_CHECK` fired an `EXC_GUARD` fault and the
worker process was killed. Web Locks were therefore unreachable from any
third-party worker, which is legitimate content: the lock registry
itself is keyed by the full `ClientOrigin` and partitions such a worker
correctly.

Use new `WebProcessProxy::m_remoteWorkerSites` to track the storage
partitions for which a process has been made a remote worker host, and
validate the top origin of the incoming `ClientOrigin` against that set.
This is the tightest granularity the UI process actually possesses: it
is never told the origins of the workers running in a context process,
only the partitions the process was established for. A forged
`ClientOrigin` whose top origin is on another site is still rejected, so
`LayoutTests/ipc/weblock-registry-origin.html` keeps failing the check.

The set only ever grows so that a message which was already in flight
when `disableRemoteWorkers()` ran is still considered valid. A
Worker-only process has an empty `m_committedClientOrigins` and would
otherwise fail the check during that teardown window.

Tests: http/tests/web-locks/web-lock-in-third-party-serviceworker.html
       
http/tests/web-locks/web-lock-in-third-party-serviceworker-site-isolation.html
       http/tests/web-locks/web-lock-in-third-party-sharedworker.html
       
http/tests/web-locks/web-lock-in-third-party-sharedworker-site-isolation.html

* LayoutTests/http/tests/web-locks/resources/third-party-service-worker.js: 
Added.
* 
LayoutTests/http/tests/web-locks/resources/third-party-serviceworker-frame.html:
 Added.
* 
LayoutTests/http/tests/web-locks/resources/third-party-sharedworker-frame.html: 
Added.
* 
LayoutTests/http/tests/web-locks/web-lock-in-third-party-serviceworker-expected.txt:
 Added.
* 
LayoutTests/http/tests/web-locks/web-lock-in-third-party-serviceworker-site-isolation-expected.txt:
 Added.
* 
LayoutTests/http/tests/web-locks/web-lock-in-third-party-serviceworker-site-isolation.html:
 Added.
* LayoutTests/http/tests/web-locks/web-lock-in-third-party-serviceworker.html: 
Added.
* 
LayoutTests/http/tests/web-locks/web-lock-in-third-party-sharedworker-expected.txt:
 Added.
* 
LayoutTests/http/tests/web-locks/web-lock-in-third-party-sharedworker-site-isolation-expected.txt:
 Added.
* 
LayoutTests/http/tests/web-locks/web-lock-in-third-party-sharedworker-site-isolation.html:
 Added.
* LayoutTests/http/tests/web-locks/web-lock-in-third-party-sharedworker.html: 
Added.
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::establishRemoteWorkerContextConnectionToNetworkProcess):
- Record the storage partition on a reused remote-worker host process.
* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::createForRemoteWorkers):
(WebKit::WebProcessProxy::hasCommittedClientOrigin const):
(WebKit::WebProcessProxy::didBecomeRemoteWorkerHostForSite):
* Source/WebKit/UIProcess/WebProcessProxy.h:
- Move `m_isEligibleForWebProcessCache` so the new `m_remoteWorkerSites`
  member variable does not grow `WebProcessProxy` into a larger
  allocation bucket: it stays at 1424 bytes.

Canonical link: https://commits.webkit.org/319692@main



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

Reply via email to