Skip to content

Truly independent web browser

LibWeb: Don't unregister intersection observers when finalizing them

Shannon Boothad42218c9ae9
diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp
index 517a3218507..d67466c553a 100644
--- a/Libraries/LibWeb/DOM/Document.cpp
+++ b/Libraries/LibWeb/DOM/Document.cpp
@@ -7140,12 +7140,6 @@ void Document::register_intersection_observer(Badge<IntersectionObserver::Inters
m_intersection_observers.set(observer);
}
-void Document::unregister_intersection_observer(Badge<IntersectionObserver::IntersectionObserver>, IntersectionObserver::IntersectionObserver& observer)
-{
- bool was_removed = m_intersection_observers.remove(observer);
- VERIFY(was_removed);
-}
-
bool Document::has_intersection_observation_targets() const
{
for (auto const& observer : m_intersection_observers) {
diff --git a/Libraries/LibWeb/DOM/Document.h b/Libraries/LibWeb/DOM/Document.h
index 44290bdba8e..8fe55bfff72 100644
--- a/Libraries/LibWeb/DOM/Document.h
+++ b/Libraries/LibWeb/DOM/Document.h
@@ -1159,7 +1159,6 @@ public:
void add_speculative_fetch_url(URL::URL url) { m_list_of_speculative_fetch_urls.set(move(url)); }
void register_intersection_observer(Badge<IntersectionObserver::IntersectionObserver>, IntersectionObserver::IntersectionObserver&);
- void unregister_intersection_observer(Badge<IntersectionObserver::IntersectionObserver>, IntersectionObserver::IntersectionObserver&);
bool has_intersection_observation_targets() const;
void register_resize_observer(Badge<ResizeObserver::ResizeObserver>, ResizeObserver::ResizeObserver&);
diff --git a/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp b/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp
index 3b6b03c49e4..393ac461390 100644
--- a/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp
+++ b/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp
@@ -170,13 +170,6 @@ IntersectionObserver::IntersectionObserver(GC::Ptr<WebIDL::CallbackType> callbac
IntersectionObserver::~IntersectionObserver() = default;
-void IntersectionObserver::finalize()
-{
- Base::finalize();
- if (m_document)
- m_document->unregister_intersection_observer({}, *this);
-}
-
void IntersectionObserver::visit_edges(GC::Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
diff --git a/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h b/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h
index ed9a3b94abc..70001332525 100644
--- a/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h
+++ b/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h
@@ -67,7 +67,6 @@ private:
explicit IntersectionObserver(GC::Ptr<WebIDL::CallbackType> callback, IntersectionObserverRoot const& root, GC::Ref<DOM::Document> implicit_root_document, Vector<CSS::LengthPercentage> root_margin, Vector<CSS::LengthPercentage> scroll_margin, Vector<double>&& thresholds, double delay, bool track_visibility);
virtual void visit_edges(GC::Cell::Visitor&) override;
- virtual void finalize() override;
static Optional<Vector<CSS::LengthPercentage>> parse_a_margin(String);