Created attachment 467080 [details] Test app Using postMessage with an OffscreenCanvas breaks when there is a `message` event listener in an isolated world, even for main-world event listeners. In practice, this bug causes web-exposed breakage on Chrome for iOS, which injects a `message` event listener into an isolated world as part of implementing browser features. Steps to reproduce (also see the attached test app): 1) In an isolated world (e.g., WKContentWorld.defaultClientWorld) add a trivial `message` event listener that does anything at all with message.data. 2) In the page world, in an iframe, add a `message` event listener 3) In the page world, in the main frame, using a handle to the iframe's contentWindow, call postMessage with an OffscreenCanvas object. Expect result: The iframe's page world event listener successfully receives the message sent in (3). Actual result: The iframe's page world event listener receives `null`. The attached test app demonstrates this bug, using four different message types to better illustrate the expected behavior, showing that postMessage works with Object, ArrayBuffer, and MessagePort, but not with OffscreenCanvas. Bug 254777 fixed the MessagePort case.
<rdar://problem/112618195>
Pull request: https://github.com/WebKit/WebKit/pull/16003
Committed 266465@main (acece69bd261): <https://commits.webkit.org/266465@main> Reviewed commits have been landed. Closing PR #16003 and removing active labels.