Skip to content

WebKit export of https://bugs.webkit.org/show_bug.cgi?id=327156 - #63543

Merged
annevk merged 1 commit into
web-platform-tests:masterfrom
annevk:wpt-export-for-webkit-327156
Oct 13, 2026
Merged

annevk merged 1 commit into
web-platform-tests:masterfrom
annevk:wpt-export-for-webkit-327156

Conversation

@annevk

@annevk annevk commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

WebKit export from bug: Implement [SameAgentCluster] for WebCodecs objects

Implement [SameAgentCluster] for WebCodecs objects and MediaStreamTrack

whatwg/html#13055 adds the [SameAgentCluster]
extended attribute: serializing or transferring an object implementing
such an interface restricts the result to the agent cluster it came from,
deserializing it in another agent cluster throws a DataCloneError, and
serializing it for storage throws as well. This is what
w3c/webcodecs#717 needs for EncodedVideoChunk,
VideoFrame, EncodedAudioChunk, and AudioData, and what the WebCodecs
crossAgentCluster tests already expect. MediaStreamTrack and
MediaStreamTrackHandle are transferred the same way, so restrict them
too.

The bindings generator now emits isRestrictedToSameAgentCluster for
[Serializable] and [Transferable] interfaces. SerializedScriptValue maps
each serialization tag to the PlatformObjectSerializationTraits of its
interface in one place, platformObjectSerializationTraitsForTag(), which
both the exposure check and the new isTagRestrictedToSameAgentCluster()
use. When CloneSerializer writes a restricted tag it writes the agent
cluster ID after it, as JSC already does for SharedArrayBuffer, and
CloneDeserializer checks that ID before reading the object. All of these
objects already refuse to be serialized for storage, before their tag is
written.

The existing tests only cover the video types, so add tests for
AudioData, EncodedAudioChunk, MediaStreamTrack, and
MediaStreamTrackHandle.

WebKit-Bug: https://bugs.webkit.org/show_bug.cgi?id=327156

@wpt-pr-bot

Copy link
Copy Markdown
Collaborator

This patch has been exported from WebKit; it will be approved automatically once the downstream patch is r+.

@annevk
annevk enabled auto-merge (rebase) October 11, 2026 14:26
whatwg/html#13055 adds the [SameAgentCluster]
extended attribute: serializing or transferring an object implementing
such an interface restricts the result to the agent cluster it came from,
deserializing it in another agent cluster throws a DataCloneError, and
serializing it for storage throws as well. This is what
w3c/webcodecs#717 needs for EncodedVideoChunk,
VideoFrame, EncodedAudioChunk, and AudioData, and what the WebCodecs
crossAgentCluster tests already expect. MediaStreamTrack and
MediaStreamTrackHandle are transferred the same way, so restrict them
too.

The bindings generator now emits isRestrictedToSameAgentCluster for
[Serializable] and [Transferable] interfaces. SerializedScriptValue maps
each serialization tag to the PlatformObjectSerializationTraits of its
interface in one place, platformObjectSerializationTraitsForTag(), which
both the exposure check and the new isTagRestrictedToSameAgentCluster()
use. When CloneSerializer writes a restricted tag it writes the agent
cluster ID after it, as JSC already does for SharedArrayBuffer, and
CloneDeserializer checks that ID before reading the object. All of these
objects already refuse to be serialized for storage, before their tag is
written.

The existing tests only cover the video types, so add tests for
AudioData, EncodedAudioChunk, MediaStreamTrack, and
MediaStreamTrackHandle.

WebKit-Bug: https://bugs.webkit.org/show_bug.cgi?id=327156

@wpt-pr-bot wpt-pr-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The review process for this patch is being conducted in the WebKit project.

@annevk
annevk merged commit 9243789 into web-platform-tests:master Oct 13, 2026
24 checks passed
@annevk
annevk deleted the wpt-export-for-webkit-327156 branch October 14, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants