Skip to content

Expose Worker in iframe realms for Code OSS extension host - #95

Closed
wieslawsoltes wants to merge 2 commits into
feature/code-oss-browser-compatibilityfrom
codex/issue-81-worker-iframe
Closed

wieslawsoltes wants to merge 2 commits into
feature/code-oss-browser-compatibilityfrom
codex/issue-81-worker-iframe

Conversation

@wieslawsoltes

@wieslawsoltes wieslawsoltes commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

The packaged Code OSS persistence smoke reached webWorkerExtensionHostIframe.html, but the iframe's createWorker call failed with ReferenceError: Worker is not defined, terminating LocalWebWorker with code 81. The original worker tests passed because they constructed workers in the top-level realm; hydrated iframe globals installed MessageChannel and postMessage but omitted Worker.

This focused follow-up installs the dedicated Worker constructor in every hydrated iframe realm with that realm's EventTarget prototype and URL base. It also advances worker microtasks between queued messages so Code OSS's blob-backed module bootstrap can complete its top-level await import(...) before the transferred MessagePort handoff.

The Code OSS-shaped regression now performs the real sequence: same-origin iframe, blob module worker, top-level dynamic import, worker start, and transferred-port request/response. The retained native regression also asserts that Worker exists in the iframe realm.

Validation on macOS arm64 Release:

  • 28/28 graphics-enabled native CTests pass.
  • 25/25 non-graphics native CTests pass.
  • Aureon candidate profile: 6/6 documents and 31/31 assertions pass.
  • Focused hybrid worker/iframe suite completes in 0.83 seconds, retaining the 10,000 MessagePort round-trip budget and queue saturation gates.
  • The new iframe-worker contract passes against both graphics and non-graphics runtime builds.

The branch is rebased on 96876a98. The rebuilt packaged Code OSS AppScene smoke passes write and restart/read with no Worker is not defined, LocalWebWorker code 81, or extension-host startup error. The PR remains draft for released-RID CI.

Advances #81.

@wieslawsoltes
wieslawsoltes force-pushed the codex/issue-81-worker-iframe branch from abd4657 to cbc4b48 Compare September 15, 2026 22:25
@wieslawsoltes wieslawsoltes changed the title Implement Worker MessagePort and iframe transport for Code OSS Expose Worker in iframe realms for Code OSS extension host Sep 15, 2026
@wieslawsoltes

Copy link
Copy Markdown
Collaborator Author

Packaged AppScene acceptance now passes with this commit.

I copied the validated graphics runtime into a duplicate of the current native-41cf43cc Code OSS AppScene bundle, ad-hoc signed the duplicate, and ran the two-process IndexedDB persistence smoke against it. Write and restart/read both passed in 9.196 seconds on different loopback origins (:55920 then :55976).

Neither native report contains Worker is not defined, LocalWebWorker code 81, unexpected worker termination, or extension-host startup errors. This closes the concrete packaged-app regression that prompted the follow-up.

Evidence:

  • summary: artifacts/iframe-worker-appscene-a2c15a5b/smoke/indexeddb-persistence-summary.json — SHA-256 dc8698d903603e3fed4fe36749d4f1bdc26114e188d29cc8b50bde85369cc24a
  • write report — SHA-256 408b01d52df36545b6063be9eae62ea04aab4cf08b6f30181121d08c18e10a10
  • restart/read report — SHA-256 858173598a7da4261e84d50bca303b20edd63bae4f271cd0372a55e6fbe8a645
  • embedded runtime — SHA-256 662a83d65b153a65628c0e4bd1a58d71d71ef3cb350894821ef3dcf2ec470795

@wieslawsoltes

Copy link
Copy Markdown
Collaborator Author

Follow-up for the exact-head Linux package failure in run 35031193726 / job 104590547667:

The runtime cleanup was not dispatching after iframe destruction. The Inspector regression queued a MessagePort message, then removed the iframe in a separate Inspector request, while counting callbacks both before and after removal. A valid delivery between those requests therefore produced the same counter value and was reported as a post-destruction callback.

274bb1db makes the regression count callbacks only after the removal expression starts. The detached marker is set synchronously immediately before removeChild, so timer, rAF, and MessagePort cleanup coverage remains intact without counting legal pre-removal delivery.

Validation:

  • native engine regression repeated 10/10 passes (172.77 s)
  • graphics-enabled Release CTest 28/28 (23.92 s)
  • Aureon Worker/iframe candidate profile 6/6 documents, 31/31 subtests
  • consolidation cherry-pick d807f7ab; stable patch-id c944a2cab1cfa6e18166b834f9744f5bed6e43b2

@wieslawsoltes

Copy link
Copy Markdown
Collaborator Author

Closing this older consolidation-based review as superseded by merged native Stack #176. Focused PRs #172#173#174#175 carry the Worker, iframe, transferable MessagePort, and browser-shaped dedicated-worker identity/runtime contracts on current main; they merged atomically at b6dff40361464e5380ed7a4a03598bd6921d9074. The cumulative top passed native and precompiled/V8 runners plus 35/35 focused WPT assertions. Issue #81 remains open only for packaged Monaco/extension-host acceptance, so no implementation is being discarded.

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