Skip to content

Implement Worker, transferable MessagePort, and iframe transport - #172

Merged
wieslawsoltes merged 1 commit into
mainfrom
stack/worker-messageport-core
Sep 16, 2026
Merged

wieslawsoltes merged 1 commit into
mainfrom
stack/worker-messageport-core

Conversation

@wieslawsoltes

@wieslawsoltes wieslawsoltes commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Problem and change

Code OSS and Monaco need isolated workers plus a transferable MessagePort bootstrap path. Current main does not expose that transport, so browser extension hosts and language workers cannot use their normal execution model.

This base layer adds:

  • classic and module dedicated workers using isolated V8 runtimes;
  • Worker, MessageChannel, and MessagePort event behavior;
  • structured clone for cycles, built-ins, ArrayBuffer, and transferred ports;
  • same-origin iframe postMessage with explicit unsupported-navigation rejection;
  • worker failure, termination, navigation, and shutdown handling;
  • bounded worker and port queues, a 16 MiB message limit, worker and port binding limits, and transfer-before-detach validation;
  • weak MessagePort wrapper ownership and reusable native binding slots.

Focused regressions cover ordering, transfer ownership, clone failures, queue saturation, prompt termination, navigation cancellation, receiver-side messageerror, and same-origin iframe port handoff. The performance gate completes 10,000 worker/port round trips within 10 seconds. The memory gate releases three batches of 2,048 channels and bounds the final V8 heap to 16 MiB above the warmed baseline.

Local validation on the cumulative stack:

  • WEBSCENE_HYBRID_V8_RUNTIME_TEST_FILTER=worker-messageport: passed;
  • directly related Worker/MessagePort WPT: 8/8 documents, 35/35 assertions;
  • git diff --check: passed.

Stack: #172 -> #173 -> #174 -> #175. This is layer 1 of 4; #175 is the cumulative validation head.

Advances #81.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant