Repository navigation
[pull] master from microsoft:master - #269
Merged
Merged
Conversation
…#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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 : )