summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrestonLTaylor <95388976+PrestonLTaylor@users.noreply.github.com>2023-05-30 21:05:49 +0100
committerAndreas Kling <kling@serenityos.org>2023-06-03 05:58:00 +0200
commitb322abd8d0881003fcf84bed9c1fe6c30fcff191 (patch)
tree06c5682ec72dba82c17491daefe5f37fb92d2820
parent31d536912c86702cc76d5dfe3ca6b20f3eece377 (diff)
downloadserenity-b322abd8d0881003fcf84bed9c1fe6c30fcff191.zip
LibWeb: Add document_fully_loaded event to DocumentObserver
SVGUseElement needs to be able to query the fully loaded document for its referenced element.
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.cpp5
-rw-r--r--Userland/Libraries/LibWeb/DOM/DocumentObserver.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp
index 3ed261fd9d..fcb2cff399 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Document.cpp
@@ -1679,6 +1679,11 @@ void Document::completely_finish_loading()
container->dispatch_event(DOM::Event::create(container->realm(), HTML::EventNames::load).release_value_but_fixme_should_propagate_errors());
});
}
+
+ for (auto& document_observer : m_document_observers) {
+ if (document_observer->document_fully_loaded)
+ document_observer->document_fully_loaded();
+ }
}
DeprecatedString Document::cookie(Cookie::Source source)
diff --git a/Userland/Libraries/LibWeb/DOM/DocumentObserver.h b/Userland/Libraries/LibWeb/DOM/DocumentObserver.h
index 1378a2db05..4b52847927 100644
--- a/Userland/Libraries/LibWeb/DOM/DocumentObserver.h
+++ b/Userland/Libraries/LibWeb/DOM/DocumentObserver.h
@@ -18,6 +18,7 @@ class DocumentObserver final : public Bindings::PlatformObject {
public:
JS::SafeFunction<void()> document_became_inactive;
+ JS::SafeFunction<void()> document_fully_loaded;
private:
explicit DocumentObserver(JS::Realm&, DOM::Document&);