mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibWeb: Unregister IntersectionObserver in finalize, not the destructor
Otherwise it UAFs the intersection root. Not sure how this didn't cause a lot of crashes!
This commit is contained in:
parent
5694981352
commit
7550b4175e
Notes:
sideshowbarker
2024-07-17 03:35:24 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/commit/7550b4175e Pull-request: https://github.com/SerenityOS/serenity/pull/20462
2 changed files with 4 additions and 1 deletions
|
@ -53,7 +53,9 @@ IntersectionObserver::IntersectionObserver(JS::Realm& realm, JS::GCPtr<WebIDL::C
|
|||
});
|
||||
}
|
||||
|
||||
IntersectionObserver::~IntersectionObserver()
|
||||
IntersectionObserver::~IntersectionObserver() = default;
|
||||
|
||||
void IntersectionObserver::finalize()
|
||||
{
|
||||
intersection_root().visit([this](auto& node) {
|
||||
node->document().unregister_intersection_observer({}, *this);
|
||||
|
|
|
@ -66,6 +66,7 @@ private:
|
|||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(JS::Cell::Visitor&) override;
|
||||
virtual void finalize() override;
|
||||
|
||||
// https://www.w3.org/TR/intersection-observer/#dom-intersectionobserver-callback-slot
|
||||
JS::GCPtr<WebIDL::CallbackType> m_callback;
|
||||
|
|
Loading…
Reference in a new issue