ladybird/Tests/LibWeb/Text/input/navigation/iframe-load-after-remove-and-recreate-same-src.html
Andreas Kling d4fc8d027e LibWeb: Preserve live iframe navigations during history
Speedometer removes and recreates its benchmark iframe while nested
session-history bookkeeping is still queued. A live child-frame commit
could find that its nested history list had been pruned and then behave
like a stale detached frame. That dropped the real src navigation and
left the harness waiting for a load event.

Preserve the newest real child navigation until the initial session
history entry is ready. Tolerate detached child navigables while history
steps scan target entries, and recreate the missing nested history only
when the child is still the container's live content navigable. Share
the nested-history append path with initial child creation so the normal
and recovery paths keep the same step handling.

Add iframe remove/recreate coverage for pending child history, same-src
load, and repeated pushState removal.
2026-06-17 02:17:34 +02:00

30 lines
818 B
HTML

<!doctype html>
<script src="../include.js"></script>
<script>
function loadFrame(src)
{
return new Promise(resolve => {
const iframe = document.createElement("iframe");
document.body.append(iframe);
iframe.onload = () => resolve(iframe);
iframe.src = src;
});
}
asyncTest(async done => {
const src = "about:blank";
const first = await loadFrame(src);
println("first load");
first.contentWindow.location.hash = "child";
await internals.flushSessionHistoryTraversalQueue();
first.remove();
await internals.flushSessionHistoryTraversalQueue();
const second = await loadFrame(src);
println("second load");
second.remove();
done();
});
</script>