mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-04 08:36:12 +00:00
LibWeb: Do not destroy document until whole subtree completed unloading
Fixes crashing when "unload" event handler tries to access active document that has already been destroyed.
This commit is contained in:
parent
9881d10e38
commit
d3cfe35fbd
Notes:
sideshowbarker
2024-07-16 22:18:54 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: d3cfe35fbd
Pull-request: https://github.com/SerenityOS/serenity/pull/24024
6 changed files with 70 additions and 26 deletions
|
@ -92,6 +92,15 @@ bool Navigable::is_traversable() const
|
|||
return is<TraversableNavigable>(*this);
|
||||
}
|
||||
|
||||
bool Navigable::is_ancestor_of(JS::NonnullGCPtr<Navigable> other) const
|
||||
{
|
||||
for (auto ancestor = other->parent(); ancestor; ancestor = ancestor->parent()) {
|
||||
if (ancestor == this)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Navigable::Navigable()
|
||||
{
|
||||
all_navigables().set(this);
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
|
||||
String const& id() const { return m_id; }
|
||||
JS::GCPtr<Navigable> parent() const { return m_parent; }
|
||||
bool is_ancestor_of(JS::NonnullGCPtr<Navigable>) const;
|
||||
|
||||
bool is_closing() const { return m_closing; }
|
||||
void set_closing(bool value) { m_closing = value; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue