This was recently spec'd here: https://github.com/whatwg/html/pull/2530 See also tests here: https://github.com/w3c/web-platform-tests/pull/5567
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517 commit 2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517 Author: binji <binji@chromium.org> Date: Fri May 12 23:41:31 2017 Add messageerror event handler This event is not currently wired up anywhere, but will be used in a subsequent CL. The idea is that when posting a message that cannot be decoded by the receiver, the receiver will dispatch a messageerror event instead of a message event. Spec changes: https://github.com/whatwg/html/pull/2530 web platform tests: https://github.com/w3c/web-platform-tests/pull/5567 Intent-to-implement: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/Z_XzejHJTrs BUG=chromium:714842 Review-Url: https://codereview.chromium.org/2860483002 Cr-Commit-Position: refs/heads/master@{#471491} [delete] https://crrev.com/64b691c1dfc3e667a1c615e29abf08304c8d5734/third_party/WebKit/LayoutTests/external/wpt/webmessaging/messageerror-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/platform/linux/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-dedicated-worker-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-shared-worker-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/virtual/stable/webexposed/element-instance-property-listing-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/webexposed/element-instance-property-listing-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/Source/core/dom/MessagePort.h [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/Source/core/dom/MessagePort.idl [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/Source/core/events/EventTypeNames.json5 [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/Source/core/frame/DOMWindowEventHandlers.h [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/Source/core/frame/WindowEventHandlers.idl [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/Source/core/html/HTMLAttributeNames.json5 [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/Source/core/html/HTMLBodyElement.cpp [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.h [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.idl [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.h [modify] https://crrev.com/2a863aff5dd967ab60b1ea2d17ac72c7cf2d6517/third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.idl
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/969f886bd1766c2b9a8e5fba26d9c6f1574791af commit 969f886bd1766c2b9a8e5fba26d9c6f1574791af Author: Ben Smith <binji@chromium.org> Date: Mon Aug 06 21:01:05 2018 Introduce AgentClusterID to serialized messages There are restrictions to sharing SharedArrayBuffer (and WebAssembly Modules) between execution contexts; for example, you cannot share a SharedArrayBuffer between a Window and the Service Worker it created. The rules are described here: https://html.spec.whatwg.org/multipage/webappapis.html#integration-with-the-javascript-agent-cluster-formalism This defines an "agent" which is similar to an execution context, and an "agent cluster" which is a collection of agents that can share between each other. This CL begins to model some of this behavior by using a `base::UnguessableToken` as an agent cluster ID that can be queried from an `ExecutionContext`. This CL also has the correct behavior when a message is sent to an agent that is not part of its agent cluster; in that case a "messageerror" event is sent instead of a "message" event. Bug: chromium:798572, chromium:714842 Change-Id: Ie70cce4cbd0ebd04d8d270d66f59690caf7f616a Reviewed-on: https://chromium-review.googlesource.com/1130505 Commit-Queue: Ben Smith <binji@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Jeremy Roman <jbroman@chromium.org> Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org> Cr-Commit-Position: refs/heads/master@{#580984} [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/WebKit/LayoutTests/TestExpectations [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/WebKit/LayoutTests/external/wpt/wasm/resources/service-worker.js [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/WebKit/LayoutTests/external/wpt/wasm/wasm_service_worker_test.https.html [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/common/message_port/cloneable_message_struct_traits.cc [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/common/message_port/cloneable_message_struct_traits.h [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/public/common/message_port/cloneable_message.h [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/public/mojom/message_port/message_port.mojom [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/bindings/core/v8/custom/v8_message_event_custom.cc [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/dom/document.cc [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/dom/document.h [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/events/message_event.cc [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/events/message_event.h [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/execution_context/execution_context.cc [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/execution_context/execution_context.h [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/messaging/blink_cloneable_message.h [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/messaging/blink_cloneable_message_struct_traits.cc [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/messaging/blink_cloneable_message_struct_traits.h [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/messaging/blink_transferable_message.cc [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/messaging/message_port.cc [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/testing/null_execution_context.h [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/workers/dedicated_worker.cc [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/workers/global_scope_creation_params.cc [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/workers/global_scope_creation_params.h [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/workers/worker_global_scope.cc [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/workers/worker_global_scope.h [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/core/workers/worklet_global_scope.h [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/modules/broadcastchannel/broadcast_channel.cc [modify] https://crrev.com/969f886bd1766c2b9a8e5fba26d9c6f1574791af/third_party/blink/renderer/modules/service_worker/service_worker_container.cc
Comment 1 by bugdroid1@chromium.org
, May 12 2017