Skip to content

[pull] master from microsoft:master - #269

Merged
pull[bot] merged 3 commits into
ConnectionMaster:masterfrom
microsoft:master
Aug 13, 2026
Merged

pull[bot] merged 3 commits into
ConnectionMaster:masterfrom
microsoft:master

Conversation

@pull

@pull pull Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

Amerlander and others added 3 commits August 13, 2026 18:08
…#11518)

When the editor spawns a simulator extension (simx) iframe it sets the
extension's `parentOrigin` query param. A simx that validates the origin of
incoming `postMessage`s - as jacdac-docs does - uses that value to decide
which sender to trust.

The editor was forwarding `options.parentOrigin`, but that is the *editor's*
embedder origin, and it is only set when the editor is itself hosted inside
another page (controller mode). For the simx that origin is its grandparent,
not its parent: the simx's parent window is the editor, and every simulator
message the editor posts into the simx arrives with the editor's origin. So
an origin-validating simx rejects all of them whenever the editor is embedded
on an origin different from its own.

Pass `window.location.origin` instead, which is the origin the simx actually
receives messages from, and set it unconditionally:

- Editor embedded same-origin: unchanged, the two values are equal.
- Editor not embedded: the param goes from unset to the editor's origin.
  Previously the simx fell back to accepting any origin, so this also
  tightens the check rather than loosening it.
- Editor embedded cross-origin: fixed, this is the broken case.

Also drop the `encodeURIComponent` calls: `URLSearchParams.set` percent-
encodes internally, so the values were encoded twice and a simx reading
`params.get("parentOrigin")` saw `https%3A%2F%2F...` and never matched a real
message origin. (The `$PARENT_ORIGIN$` template substitution on the legacy
messageSimulator path below builds the query string by hand, so its
`encodeURIComponent` is correct and is left alone.) The same double encoding
applied to `language`, which was harmless in practice as language codes have
no characters that need escaping.

Fixes #11446
…11512)

The binary header spec (docs/source-embedding.md) gives the embedded
text length a 4-byte field, but packSource only ever wrote the low 2
bytes, leaving the high bytes zero. Projects whose compressed source
reaches 64 KiB were silently written with a truncated length
(true length mod 65536), so importing the hex read too little data
and failed. The data itself was always fully present.

Fix the writer to store all 4 length bytes and the hex reader to
combine the high bytes it already captured but ignored. The UF2/bin
reader already read all 4 bytes and needs no change.

Add an embed-test suite covering the header layout and write/read
round-trips either side of the 64 KiB boundary, for both the hex and
UF2 containers. packSource and saveSourceToUF2 are now exported so
the tests can drive the real writers.

Co-authored-by: Joey Wunderlich <jwunderl@users.noreply.github.com>
@pull pull Bot locked and limited conversation to collaborators Aug 13, 2026
@pull pull Bot added the ⤵️ pull label Aug 13, 2026
@pull
pull Bot merged commit f737473 into ConnectionMaster:master Aug 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants