ladybird/Tests/LibWeb/Text/input/navigation/navigate-iframe-right-after-creation.html
Aliaksandr Kalenik b8af3fccf6 LibWeb: Wait until child navigable's SHE is ready before navigating
This change fixes a bug that can be reproduced with the following steps:
```js
const iframe = document.createElement("iframe");
document.body.appendChild(iframe);
iframe.contentWindow.location.href = ("http://localhost:8080/demo.html");
```

These steps are executed in the following order:
1. Create iframe and schedule session history traversal task that adds
   session history entry for the iframe.
2. Generate navigation id for scheduled navigation to
   `http://localhost:8080/demo.html`.
3. Execute the scheduled session history traversal task, which adds
   session history entry for the iframe.
4. Ooops, navigation to `http://localhost:8080/demo.html` is aborted
   because addings SHE for the iframe resets the navigation id.

This change fixes this by delaying all navigations until SHE for a
navigable is created.
2025-02-27 14:31:41 +01:00

17 lines
No EOL
485 B
HTML

<!DOCTYPE html>
<html lang="en">
<script src="../include.js"></script>
<body>
<script>
asyncTest(done => {
const iframe = document.createElement("iframe");
document.body.appendChild(iframe);
window.addEventListener("message", (e) => {
println(e.data);
done();
});
iframe.contentWindow.location.href = "../../data/test-iframe-content.html";
});
</script>
</body>
</html>