WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
313692
[Site Isolation] postMessage of SharedArrayBuffer doesn't work in the same process
https://bugs.webkit.org/show_bug.cgi?id=313692
Summary
[Site Isolation] postMessage of SharedArrayBuffer doesn't work in the same pr...
Anthony Tarbinian
Reported
2026-04-29 15:38:34 PDT
The following tests are failing with site isolation enabled: imported/w3c/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/messagechannel.any.html imported/w3c/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/messagechannel.any.serviceworker.html imported/w3c/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/messagechannel.any.sharedworker.html imported/w3c/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/messagechannel.any.worker.html imported/w3c/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-messagechannel-success.https.html These test failures involve when postMessage is called to pass a SharedArrayBuffer, to another context (i.e. another frame, window, worker). See the example JS below: const channel = new MessageChannel(); const sab = new SharedArrayBuffer(16); channel.port1.postMessage(sab); There is an optimization in WebKit to keep the MessagePorts in a local HashMap (WebMessagePortChannelProvider::m_inProcessPortMessages) to avoid performing unecessary IPC if the sender and receiver are in the same process. See
https://commits.webkit.org/255948@main
This optimization caused issues with site isolation enabled since it's possible for the target to be in a different process. The optimization was undone in
https://commits.webkit.org/295627@main
Without the optimization, all messages sent over a MessageChannel are sent over IPC with site isolation enabled. See the following code in WebMessagePortChannelProvider::postMessageToRemote which falls back to IPC when the port is not found in m_inProcessPortMessages. Remote here doesn't mean a different process, its just the receiver of postMessage. void WebMessagePortChannelProvider::postMessageToRemote(MessageWithMessagePorts&& message, const MessagePortIdentifier& remoteTarget) { auto iterator = m_inProcessPortMessages.find(remoteTarget); if (iterator != m_inProcessPortMessages.end()) { iterator->value.append(WTF::move(message)); WebProcess::singleton().messagesAvailableForPort(remoteTarget); return; } for (auto& port : message.transferredPorts) messagePortSentToRemote(port.first); protect(networkProcessConnection())->send(Messages::NetworkConnectionToWebProcess::PostMessageToRemote { message, remoteTarget }, 0); } However, this causes issues for messages which are not serializable over IPC, such as SharedArrayBuffer which are marked as [NotSerialized]
https://searchfox.org/wubkat/source/Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in#8013
This means that sending a SharedArrayBuffer will fail even when the sender and receiver are in the same process and there is no need to cross IPC.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2026-04-29 15:38:39 PDT
<
rdar://problem/175890575
>
Anthony Tarbinian
Comment 2
2026-04-29 15:56:34 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/63933
EWS
Comment 3
2026-05-05 15:02:15 PDT
Committed
312641@main
(e2355e43e2ef): <
https://commits.webkit.org/312641@main
> Reviewed commits have been landed. Closing PR #63933 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug