Skip to content

Expose Worker in hydrated iframe realms - #173

Merged
wieslawsoltes merged 1 commit into
stack/worker-messageport-corefrom
stack/iframe-worker-extension-host
Sep 16, 2026
Merged

wieslawsoltes merged 1 commit into
stack/worker-messageport-corefrom
stack/iframe-worker-extension-host

Conversation

@wieslawsoltes

@wieslawsoltes wieslawsoltes commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Problem and change

The core Worker transport works in the top-level realm, but Code OSS creates its browser extension host inside a hydrated same-origin iframe. That realm needs its own Worker constructor, realm-local EventTarget chain, and URL base. Module workers also need a microtask checkpoint so a blob bootstrap using top-level await import(...) can finish before the transferred-port handoff.

This layer installs Worker in each hydrated iframe realm and adds a Code OSS-shaped contract for:

  1. same-origin iframe creation;
  2. blob-backed module Worker construction inside that iframe;
  3. top-level dynamic import;
  4. Worker startup; and
  5. transferred MessagePort request/response.

It also makes the detached-iframe Inspector regression count callbacks only after the synchronous removal boundary, avoiding a race with legal delivery before detachment.

Focused validation on the cumulative stack:

  • iframe module-worker extension-host contract: 4/4 assertions;
  • WEBSCENE_NATIVE_ENGINE_TEST_FILTER=iframe-worker-inspector-detach with Inspector enabled: passed;
  • cumulative worker/MessagePort hybrid filter: passed.

Stack: #172 -> #173 -> #174 -> #175. This is layer 2 of 4, based on #172. Reconstructs the focused behavior from #95 on current main.

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