1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

LibWeb: Early return navigation process if navigable has been destroyed

If a navigable has been destroyed during a navigation process, we
should early return from it. The introduced checks are not in
the spec because, as explained in
https://github.com/whatwg/html/issues/9690 the spec is not written
with such a level of detail.
This commit is contained in:
Aliaksandr Kalenik 2023-09-05 23:36:20 +02:00 committed by Andreas Kling
parent c20123378d
commit c437f16cc1
4 changed files with 50 additions and 2 deletions

View file

@ -128,6 +128,10 @@ public:
void reload();
// https://github.com/whatwg/html/issues/9690
[[nodiscard]] bool has_been_destroyed() const { return m_has_been_destroyed; }
void set_has_been_destroyed() { m_has_been_destroyed = true; }
protected:
Navigable();
@ -160,8 +164,12 @@ private:
// Implied link between navigable and its container.
JS::GCPtr<NavigableContainer> m_container;
bool m_has_been_destroyed { false };
};
HashTable<Navigable*>& all_navigables();
bool navigation_must_be_a_replace(AK::URL const& url, DOM::Document const& document);
void finalize_a_cross_document_navigation(JS::NonnullGCPtr<Navigable>, HistoryHandlingBehavior, JS::NonnullGCPtr<SessionHistoryEntry>);
void perform_url_and_history_update_steps(DOM::Document& document, AK::URL new_url, HistoryHandlingBehavior history_handling = HistoryHandlingBehavior::Reload);