Repository navigation
Implement origin-partitioned BroadcastChannel for Code OSS #764
Description
Implementation outcome — 20 September 2026
Merged through PR #765 at WebScene eb3efdc25f875fc44a64af8e915810a736aaa3e0. The runtime now exposes browser-shaped BroadcastChannel routing by storage partition, security origin, and channel name; clones messages; excludes the sender; delivers FIFO tasks fairly; bounds bindings, names, queues, bytes, and fanout; and retires state on close, GC, frame teardown, navigation, and shutdown.
Browser and native regression contracts are authored. They were not executed under the active implementation-throughput directive. Current installed Code OSS Markdown diff preview, IndexedDB file-change, profile, and voice/PTT acceptance remains owned by #81/#264/#263.
Parent: #81. Webview/Markdown consumer: #264. Capability ledger: #263.
Proven gap
Unchanged VS Code OSS 1.137 directly constructs BroadcastChannel in several reachable browser paths:
- Markdown diff-preview scroll synchronization;
- IndexedDB-backed file-system change propagation;
- user-data profile change propagation;
- voice/PTT window ownership.
WebScene currently has no BroadcastChannel binding. The unresolved-global detector explicitly classifies it as unsupported. VS Code's shared BroadcastDataChannel can fall back to localStorage, but Markdown's diff-preview path constructs BroadcastChannel directly and therefore cannot initialize that feature.
Focused implementation
Implement a product-neutral, origin- and storage-partition-scoped Broadcast Channel provider in the native V8 runtime:
- browser-shaped constructor,
name,postMessage,close,onmessage,onmessageerror, EventTarget behavior and branding; - structured-clone delivery without transfer lists or same-object aliasing;
- sender exclusion, FIFO delivery per sending agent, asynchronous task delivery, and microtask checkpoints;
- cross-realm and cross-runtime routing only for equal storage partition, origin, and channel name;
- bounded channel/subscriber/message/byte queues with deterministic failure;
- closed-channel errors, opaque-origin rejection, listener-aware reachability, navigation/shutdown retirement, and no stale delivery.
Keep VS Code unchanged and do not route through Electron, Chromium, CEF, or application-specific code.
Deferred gates
Source regression and contract fixtures should cover multiple channel objects, iframe realms, separate runtime instances, structured data/ArrayBuffer cloning, DataCloneError cases, sender exclusion, FIFO order, close, GC, navigation, teardown, queue/byte caps, and the four unchanged consumers. Performance/package/VM execution remains deferred under the active implementation-throughput directive.
Activity