diff --git a/Userland/Libraries/LibWeb/HTML/Navigable.cpp b/Userland/Libraries/LibWeb/HTML/Navigable.cpp
index ee18e1a9b6..69b1d54724 100644
--- a/Userland/Libraries/LibWeb/HTML/Navigable.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Navigable.cpp
@@ -90,6 +90,17 @@ void Navigable::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_container);
}
+void Navigable::set_delaying_load_events(bool value)
+{
+ if (value) {
+ auto document = container_document();
+ VERIFY(document);
+ m_delaying_the_load_event.emplace(*document);
+ } else {
+ m_delaying_the_load_event.clear();
+ }
+}
+
JS::GCPtr Navigable::navigable_with_active_document(JS::NonnullGCPtr document)
{
for (auto* navigable : all_navigables()) {
diff --git a/Userland/Libraries/LibWeb/HTML/Navigable.h b/Userland/Libraries/LibWeb/HTML/Navigable.h
index 402646c10e..b5ccf02d59 100644
--- a/Userland/Libraries/LibWeb/HTML/Navigable.h
+++ b/Userland/Libraries/LibWeb/HTML/Navigable.h
@@ -10,6 +10,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -56,8 +57,7 @@ public:
bool is_closing() const { return m_closing; }
void set_closing(bool value) { m_closing = value; }
- bool is_delaying_load_events() const { return m_delaying_load_events; }
- void set_delaying_load_events(bool value) { m_delaying_load_events = value; }
+ void set_delaying_load_events(bool value);
JS::GCPtr active_session_history_entry() const { return m_active_session_history_entry; }
void set_active_session_history_entry(JS::GCPtr entry) { m_active_session_history_entry = entry; }
@@ -160,7 +160,7 @@ private:
bool m_closing { false };
// https://html.spec.whatwg.org/multipage/document-sequences.html#delaying-load-events-mode
- bool m_delaying_load_events { false };
+ Optional m_delaying_the_load_event;
// Implied link between navigable and its container.
JS::GCPtr m_container;