mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 12:37:40 +00:00
LibWeb: Update create_new_child_navigable() after spec fix
Now that https://github.com/whatwg/html/issues/9686 is fixed, let's fix it the exact same way in our implementation. :^)
This commit is contained in:
parent
49fcc5dcd8
commit
0a05be69cf
1 changed files with 9 additions and 7 deletions
|
@ -114,16 +114,18 @@ WebIDL::ExceptionOr<void> NavigableContainer::create_new_child_navigable()
|
||||||
|
|
||||||
auto parent_doc_state = parent_navigable->active_session_history_entry()->document_state;
|
auto parent_doc_state = parent_navigable->active_session_history_entry()->document_state;
|
||||||
|
|
||||||
// 2. Let targetStepSHE be the first session history entry in traversable's session history entries whose document state equals parentDocState.
|
// 2. Let parentNavigableEntries be the result of getting session history entries for parentNavigable.
|
||||||
// NOTE: We need to look for parent document state in parent navigable instead of traversable as specification says. https://github.com/whatwg/html/issues/9686
|
auto parent_navigable_entries = parent_navigable->get_session_history_entries();
|
||||||
auto target_step_she = *(parent_navigable->get_session_history_entries().find_if([parent_doc_state](auto& entry) {
|
|
||||||
return entry->document_state == parent_doc_state;
|
|
||||||
}));
|
|
||||||
|
|
||||||
// 3. Set historyEntry's step to targetStepSHE's step.
|
// 3. Let targetStepSHE be the first session history entry in parentNavigableEntries whose document state equals parentDocState.
|
||||||
|
auto target_step_she = *parent_navigable_entries.find_if([parent_doc_state](auto& entry) {
|
||||||
|
return entry->document_state == parent_doc_state;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 4. Set historyEntry's step to targetStepSHE's step.
|
||||||
history_entry->step = target_step_she->step;
|
history_entry->step = target_step_she->step;
|
||||||
|
|
||||||
// 4. Let nestedHistory be a new nested history whose id is navigable's id and entries list is « historyEntry ».
|
// 5. Let nestedHistory be a new nested history whose id is navigable's id and entries list is « historyEntry ».
|
||||||
DocumentState::NestedHistory nested_history {
|
DocumentState::NestedHistory nested_history {
|
||||||
.id = navigable->id(),
|
.id = navigable->id(),
|
||||||
.entries { *history_entry },
|
.entries { *history_entry },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue