mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
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.
This commit is contained in:
committed by
Alexander Kalenik
parent
718e874cc7
commit
b8af3fccf6
Notes:
github-actions[bot]
2025-02-27 13:32:33 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/b8af3fccf63 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3711
@@ -202,6 +202,10 @@ Optional<URL::URL> NavigableContainer::shared_attribute_processing_steps_for_ifr
|
||||
if (!m_content_navigable)
|
||||
return {};
|
||||
|
||||
if (initial_insertion && m_content_navigable->has_pending_navigations()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
// 1. Let url be the URL record about:blank.
|
||||
auto url = URL::about_blank();
|
||||
|
||||
@@ -310,7 +314,7 @@ void NavigableContainer::destroy_the_child_navigable()
|
||||
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#potentially-delays-the-load-event
|
||||
bool NavigableContainer::currently_delays_the_load_event() const
|
||||
{
|
||||
if (!m_content_navigable_initialized)
|
||||
if (!content_navigable_has_session_history_entry_and_ready_for_navigation())
|
||||
return true;
|
||||
|
||||
if (!m_potentially_delays_the_load_event)
|
||||
|
||||
Reference in New Issue
Block a user