Files
romm/frontend/src/utils
zurdi 3f67e0b74a feat(v2): open the EmulatorJS and js-dos launch views without a page load
Play navigated to the EmulatorJS and js-dos launch views with a full document
load, because only a directly loaded player URL carries the COOP/COEP headers
nginx attaches to it, and only a cross-origin isolated document exposes the
SharedArrayBuffer that threaded cores need. Every launch paid that reload,
while only three cores (dosbox_pure, ppsspp, azahar) need threads, and js-dos
8.4.1 does not reference SharedArrayBuffer at all.

Both views are now reached by SPA navigation with the cover morph, like the
PICO-8 and Ruffle views. When a threaded core is booted without
SharedArrayBuffer, useIsolatedLaunch keeps the pre-play selection in
sessionStorage and reloads the view into the isolated document, where it
boots straight away; a second miss reports the insecure context instead of
looping. Adding a threaded core is one entry in areThreadsRequiredForEJSCore;
another player that needs isolation uses the same composable.

Leaving a player view is a full navigation whenever the document is isolated,
since the rest of the app cannot embed third-party images under that policy
(provider covers in Match ROM, see #4522), and whenever the EmulatorJS runtime
was injected, which declares globals a second injection would clash with.
usePlayerExit holds that rule for both views; js-dos also injects its runtime
once per document. EmulatorJS closes the play session on pagehide as well,
since the full navigation unmounts nothing.

The Vite dev server mirrors the nginx header map for the player URLs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R1VFUvsR5wYK3axxR1gebc
2026-09-17 00:03:48 +02:00
..
2026-06-08 11:13:15 -04:00
2026-05-24 17:43:01 -04:00