You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inserting an iframe into a non-fully active document creates a child navigable #13085
If insertedNode's node document's browsing context is null, then return.
...
Create a new child navigable for insertedNode.
A non-fully active document that hasn't been destroyed still has a browsing context. For example, an iframe's previous document after a same-origin navigation isn't destroyed if the user agent intends to keep it in bfcache. Appending an iframe to it then creates a child navigable. (Firefox Nightly, Chrome Canary, and Safari TP don't keep it, so in them the appended iframe's contentWindow is null.)
All three only put top-level pages in bfcache (Gecko, Chromium, WebKit), so an iframe's own navigation destroys its previous document. The spec allows that, since intendToKeepInBfcache in unload a document is up to the user agent. So this is reachable in a user agent that keeps such documents, or for a document in a bfcached page that script can still reach (e.g., from an opener).
Options:
Return early from the iframe and frame post-connection steps if the node document isn't fully active. object already checks this when determining what it represents, and so does embed's "potentially active". This matches Ladybird and Gecko's IsActive() check.
Require intendToKeepInBfcache to be false for child navigables' documents, to match browsers. Then traversing back within an iframe repopulates the entry instead of reusing the document, since destroying it sets the entry's document to null. That doesn't cover documents in a bfcached page, so 1 seems needed either way.
Activity
zcorpan commentedon Oct 16, 2026
cc @foolip
shannonbooth commentedon Oct 16, 2026
https://github.com/LadybirdBrowser/ladybird/blob/2347e56772355691ec1ba1487d06120f3d4a2176/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp#L108 not that it matters too much for webcompat purposes, but we actually have the exact workaround suggested here, but I hadn't gotten around to filing spec issue / fixing yet since there are some other workarounds I hadn't investigated fully yet
zcorpan commentedon Oct 19, 2026
Thanks @shannonbooth, good to know!
I asked Claude to look into what Gecko, Chromium, and WebKit do here, and what the options for a spec fix are: