Render logger throws SecurityError on a cross-origin iframe, corrupting React's scheduler
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 499
- Fork
- 100
- Merge medio
- 1g 17h
- PR unite (30g)
- 4
Descrizione
Summary
When a page mounts a cross-origin iframe, the devtools' render logger walks into it and throws a SecurityError. That leaves React's fiber scheduler in a bad state, and from then on controlled inputs stop committing anywhere on the page for the rest of that page load.
The visible symptom is not a devtools error — it's that typing into any <input> in the app silently does nothing. That makes it expensive to diagnose: the app looks fine, and the failure appears to be in whatever component you happen to be working on.
Versions
@tanstack/react-devtools0.10.7@tanstack/devtools-vite0.8.0- React 19, TanStack Start, Vite 8, dev mode only (devtools are
import.meta.env.DEV-gated)
Reproduction
- Mount
<TanStackDevtools>in the root route, gated onimport.meta.env.DEV. - Anywhere in the authenticated tree, mount a component that injects a cross-origin iframe. In our case it is the Spotify Web Playback SDK (
https://sdk.scdn.co/spotify-player.js), which creates its own iframe. - Load any page under that tree in dev.
- Type into any controlled input.
Observed console output, in order:
SecurityError: Failed to read a named property from 'Window': Blocked a frame with
origin "http://127.0.0.1:3939" from accessing a cross-origin frame.
then
Error: Should not already be working.
After the second error, controlled-input commits fail for the remainder of the page load — including inputs entirely unrelated to the iframe, such as a login form on a different route.
Workaround
Blocking the third-party script prevents the iframe from being created, and everything behaves normally:
await page.route('**sdk.scdn.co/**', (r) => r.abort())
Not mounting the iframe-owning component in dev also works. Both are avoidance rather than fixes.
Suggested fix
Guard the render logger's DOM traversal so a cross-origin frame is skipped rather than entered — accessing a frame's contentWindow properties should be wrapped, or iframe elements whose origin differs should be excluded from the walk. A third-party embed (payment, video, audio SDK, maps) is common enough that any app with one plus these devtools will hit this.
Happy to test a patch against the repro above.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dal traversal del DOM del render logger e riproduci il problema con un cross-origin iframe, ad esempio lo Spotify Web Playback SDK iframe, in un ambiente di sviluppo React 19. Segui il SecurityError e il successivo scheduler error, quindi verifica che i controlled inputs eseguano ancora il commit dopo il mount dell'iframe. Il lavoro è completato quando il cross-origin frame viene saltato in modo sicuro e il repro non interrompe più gli input commits.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- react, typescript
- Ambito
- devtools, frontend
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 68/100