[webkit-changes] [WebKit/WebKit] a9d61c: Unable to postMessage a WebAssembly module to a wo...

Chris Dumez noreply at github.com
Fri Nov 18 13:32:01 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a9d61c9d9e2e1e146eb0165e25df76a326997790
      https://github.com/WebKit/WebKit/commit/a9d61c9d9e2e1e146eb0165e25df76a326997790
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2022-11-18 (Fri, 18 Nov 2022)

  Changed paths:
    M LayoutTests/fast/storage/serialized-script-value.html
    A LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-postmessage-wasm-module.https-expected.txt
    A LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-postmessage-wasm-module.https.html
    A LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/processors/wasm-module-processor.js
    M LayoutTests/imported/w3c/web-platform-tests/wasm/serialization/module/broadcastchannel-success-and-failure-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/wasm/serialization/module/broadcastchannel-success-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/wasm/serialization/module/window-messagechannel-success-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/wasm/serialization/module/window-sharedworker-failure-expected.txt
    M Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
    M Source/WebCore/bindings/js/JSDOMGlobalObject.h
    M Source/WebCore/bindings/js/SerializedScriptValue.cpp
    M Source/WebCore/dom/BroadcastChannel.cpp
    M Source/WebCore/dom/MessagePort.cpp
    M Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp
    M Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp
    M Source/WebKit/WebProcess/Storage/WebSharedWorkerObjectConnection.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebMessagePortChannelProvider.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebMessagePortChannelProvider.h

  Log Message:
  -----------
  Unable to postMessage a WebAssembly module to a worklet
https://bugs.webkit.org/show_bug.cgi?id=220038
rdar://72596556

Reviewed by Darin Adler.

We were previously unable to send WASM modules (and WASM memory) via message
ports, even if the destination was in the same process (e.g. another window on
the same page or a dedicated worker).

There were two reasons for this:
- MessagePort::postMessage() was using the default SerializationContext, which
  doesn't allow encoding on WASM types. I updated the serialization context to
  address that.
- Such WASM types are not serializable over IPC and despite the changes in
  255948 at main, messages would often still go over IPC, even when the
  destination is in the same process. To address this, I now mark MessagePorts
  as out-of-process when they get sent over IPC, instead of doing it when they
  get disentangled (which can happen when sending the port to an in-process
  dedicated worker)

* LayoutTests/fast/storage/serialized-script-value.html:
* LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-postmessage-wasm-module.https-expected.txt: Added.
* LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-postmessage-wasm-module.https.html: Added.
* LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/processors/wasm-module-processor.js: Added.
(WASMModuleProcessor):
(WASMModuleProcessor.prototype.testModule):
(WASMModuleProcessor.prototype.handleMessage):
(WASMModuleProcessor.prototype.handleMessageError):
(WASMModuleProcessor.prototype.process):
* LayoutTests/imported/w3c/web-platform-tests/wasm/serialization/module/window-messagechannel-success-expected.txt:
* Source/WebCore/bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::defaultAgentClusterID):
(WebCore::JSDOMGlobalObject::agentClusterID const):
* Source/WebCore/bindings/js/JSDOMGlobalObject.h:
* Source/WebCore/bindings/js/SerializedScriptValue.cpp:
(WebCore::agentClusterIDFromGlobalObject):
(WebCore::CloneSerializer::dumpIfTerminal):
(WebCore::CloneDeserializer::readTerminal):
* Source/WebCore/dom/MessagePort.cpp:
(WebCore::MessagePort::postMessage):
* Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::postMessageToServiceWorker):
* Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient):
* Source/WebKit/WebProcess/WebCoreSupport/WebMessagePortChannelProvider.cpp:
(WebKit::WebMessagePortChannelProvider::entangleLocalPortInThisProcessToRemote):
(WebKit::WebMessagePortChannelProvider::messagePortDisentangled):
(WebKit::WebMessagePortChannelProvider::messagePortSentToRemote):
(WebKit::WebMessagePortChannelProvider::postMessageToRemote):
* Source/WebKit/WebProcess/WebCoreSupport/WebMessagePortChannelProvider.h:

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




More information about the webkit-changes mailing list