mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 00:25:12 +00: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
@@ -684,9 +684,9 @@ WebIDL::ExceptionOr<Document*> Document::open(Optional<String> const&, Optional<
|
||||
// If document belongs to a child navigable, we need to make sure its initial navigation is done,
|
||||
// because subsequent steps will modify "initial about:blank" to false, which would cause
|
||||
// initial navigation to fail in case it was "about:blank".
|
||||
if (auto navigable = this->navigable(); navigable && navigable->container() && !navigable->container()->content_navigable_initialized()) {
|
||||
if (auto navigable = this->navigable(); navigable && navigable->container() && !navigable->container()->content_navigable_has_session_history_entry_and_ready_for_navigation()) {
|
||||
HTML::main_thread_event_loop().spin_processing_tasks_with_source_until(HTML::Task::Source::NavigationAndTraversal, GC::create_function(heap(), [navigable_container = navigable->container()] {
|
||||
return navigable_container->content_navigable_initialized();
|
||||
return navigable_container->content_navigable_has_session_history_entry_and_ready_for_navigation();
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user