Skip to content

fix(home): address the demo's play/pause messages to our own origin - #45

Merged
cevheri merged 1 commit into
mainfrom
fix/demo-postmessage-origin
Aug 25, 2026
Merged

fix(home): address the demo's play/pause messages to our own origin#45
cevheri merged 1 commit into
mainfrom
fix/demo-postmessage-origin

Conversation

@cevheri

@cevheri cevheri commented Aug 25, 2026

Copy link
Copy Markdown
Member

Follow-up to #44.

Both walkthrough clips are served from public/demo/, so the play and pause messages have no reason to go out to '*'. Addressing them to window.location.origin means nothing is delivered to a frame that some other document has managed to navigate elsewhere.

-      win.postMessage(`libredb-demo:${verb}`, '*');
-      win.postMessage({ type: `om-demo-${verb}` }, '*');
+      win.postMessage(`libredb-demo:${verb}`, window.location.origin);
+      win.postMessage({ type: `om-demo-${verb}` }, window.location.origin);

Verified

Both clips, on Astro 7.2.4: plays on enter, parks off screen, resumes on re-entry (the desktop clip reloads, as #44 explains). The explicit origin changes nothing about delivery.

desktop @1440px phone @390px
distinct frames while in view 3 3
distinct frames while off screen 1 (parked) 1 (parked)
distinct frames after re-entry 2 3

Gate clean: 0 errors, prettier clean, oxlint clean, knip clean, 75 tests pass.

Note: the CodeQL alerts on public/demo/** are inside the vendored bundles, not this code, and are unaffected either way.

Both clips are served from public/demo/, so the walkthrough's play and
pause messages have no reason to go out to '*'. Addressing them to our
origin means nothing is delivered to a frame some other document has
managed to navigate elsewhere.

Verified on both clips at 1440px and 390px: plays on enter, parks off
screen, resumes (desktop reloads) on re-entry — the explicit origin
changes nothing about delivery.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@cevheri
cevheri merged commit 5ef4995 into main Aug 25, 2026
4 checks passed
@cevheri
cevheri deleted the fix/demo-postmessage-origin branch August 25, 2026 19:51
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