Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement messageerror event #6654

Merged

Conversation

cdumez
Copy link
Contributor

@cdumez cdumez commented Nov 18, 2022

5e2beb5

Implement messageerror event
https://bugs.webkit.org/show_bug.cgi?id=171216
rdar://96467919

Reviewed by Darin Adler.

Implement messageerror event:
- whatwg/html#2530

Previously, WebKit would fire a `message` event with its `data` being null,
whenever data deserialization would fail. This wasn't as per specification and
did not match other browser engines. We're supposed to fire a `messageerror`
event instead.

This patch addresses the issue.

* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-windowless-body-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/wasm/serialization/module/broadcastchannel-success-and-failure-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/wasm/serialization/module/window-sharedworker-failure-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webmessaging/messageerror-expected.txt:
* Source/WebCore/bindings/js/SerializedScriptValue.cpp:
(WebCore::SerializedScriptValue::deserialize):
* Source/WebCore/bindings/js/SerializedScriptValue.h:
* Source/WebCore/dom/BroadcastChannel.cpp:
(WebCore::BroadcastChannel::dispatchMessage):
* Source/WebCore/dom/MessageEvent.cpp:
(WebCore::MessageEvent::create):
* Source/WebCore/dom/MessageEvent.h:
* Source/WebCore/dom/MessagePort.cpp:
(WebCore::MessagePort::dispatchMessages):
* Source/WebCore/dom/MessagePort.idl:
* Source/WebCore/html/HTMLAttributeNames.in:
* Source/WebCore/page/DOMWindow.cpp:
(WebCore::DOMWindow::postMessage):
* Source/WebCore/page/WindowEventHandlers.idl:
* Source/WebCore/workers/DedicatedWorkerGlobalScope.idl:
* Source/WebCore/workers/Worker.idl:
* Source/WebCore/workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
(WebCore::WorkerMessagingProxy::postMessageToWorkerGlobalScope):
* Source/WebCore/workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::startMessages):
(WebCore::ServiceWorkerContainer::postMessage):
* Source/WebCore/workers/service/ServiceWorkerContainer.h:
* Source/WebCore/workers/service/context/ServiceWorkerThread.cpp:
(WebCore::fireMessageEvent):

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

904a8fd

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe ❌ πŸ›  πŸ§ͺ win
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-debug βœ… πŸ›  gtk βœ… πŸ›  wincairo
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ›  mac-AS-debug ❌ πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-wk1
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch ❌ πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch-sim βœ… πŸ§ͺ mac-wk2-stress

@cdumez cdumez self-assigned this Nov 18, 2022
@cdumez cdumez added the DOM For bugs specific to XML/HTML DOM elements (including parsing). label Nov 18, 2022
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 19, 2022
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Nov 19, 2022
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 19, 2022
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Nov 19, 2022
@webkit-early-warning-system
Copy link
Collaborator

Starting EWS tests for 904a8fd. Live statuses available at the PR page, #6654

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 19, 2022
@cdumez cdumez marked this pull request as ready for review November 19, 2022 23:35
@cdumez cdumez requested a review from rniwa as a code owner November 19, 2022 23:35
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Nov 19, 2022
Copy link
Member

@darinadler darinadler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code seems slightly repetitive. I might suggest some helpers so the different flavors of postMessage and dispatchMessage can share more, but not sure if that would be good in practice.

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 20, 2022
@cdumez cdumez added merge-queue Applied to send a pull request to merge-queue and removed merging-blocked Applied to prevent a change from being merged labels Nov 20, 2022
https://bugs.webkit.org/show_bug.cgi?id=171216
rdar://96467919

Reviewed by Darin Adler.

Implement messageerror event:
- whatwg/html#2530

Previously, WebKit would fire a `message` event with its `data` being null,
whenever data deserialization would fail. This wasn't as per specification and
did not match other browser engines. We're supposed to fire a `messageerror`
event instead.

This patch addresses the issue.

* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-windowless-body-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/wasm/serialization/module/broadcastchannel-success-and-failure-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/wasm/serialization/module/window-sharedworker-failure-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webmessaging/messageerror-expected.txt:
* Source/WebCore/bindings/js/SerializedScriptValue.cpp:
(WebCore::SerializedScriptValue::deserialize):
* Source/WebCore/bindings/js/SerializedScriptValue.h:
* Source/WebCore/dom/BroadcastChannel.cpp:
(WebCore::BroadcastChannel::dispatchMessage):
* Source/WebCore/dom/MessageEvent.cpp:
(WebCore::MessageEvent::create):
* Source/WebCore/dom/MessageEvent.h:
* Source/WebCore/dom/MessagePort.cpp:
(WebCore::MessagePort::dispatchMessages):
* Source/WebCore/dom/MessagePort.idl:
* Source/WebCore/html/HTMLAttributeNames.in:
* Source/WebCore/page/DOMWindow.cpp:
(WebCore::DOMWindow::postMessage):
* Source/WebCore/page/WindowEventHandlers.idl:
* Source/WebCore/workers/DedicatedWorkerGlobalScope.idl:
* Source/WebCore/workers/Worker.idl:
* Source/WebCore/workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
(WebCore::WorkerMessagingProxy::postMessageToWorkerGlobalScope):
* Source/WebCore/workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::startMessages):
(WebCore::ServiceWorkerContainer::postMessage):
* Source/WebCore/workers/service/ServiceWorkerContainer.h:
* Source/WebCore/workers/service/context/ServiceWorkerThread.cpp:
(WebCore::fireMessageEvent):

Canonical link: https://commits.webkit.org/256896@main
@webkit-commit-queue
Copy link
Collaborator

Committed 256896@main (5e2beb5): https://commits.webkit.org/256896@main

Reviewed commits have been landed. Closing PR #6654 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system merged commit 5e2beb5 into WebKit:main Nov 20, 2022
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DOM For bugs specific to XML/HTML DOM elements (including parsing).
Projects
None yet
5 participants