summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-08-01 16:42:11 +0200
committerAndreas Kling <kling@serenityos.org>2022-08-05 12:42:46 +0200
commitffb23db57ff120294944c70a0b967a517a6477d4 (patch)
tree21d13ad95c502c40aca393f1a2b6a0d8589dbb0f /Userland/Libraries/LibWeb/HTML
parentc4a0b7057b08b72d4d16b41bc6bf074aa2d264e7 (diff)
downloadserenity-ffb23db57ff120294944c70a0b967a517a6477d4.zip
LibWeb: Add browsing context "still on its initial about:blank Document"
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML')
-rw-r--r--Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp11
-rw-r--r--Userland/Libraries/LibWeb/HTML/BrowsingContext.h3
2 files changed, 14 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
index 2e68a8b447..24dcacbfd1 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
@@ -541,4 +541,15 @@ BrowsingContext* BrowsingContext::choose_a_browsing_context(StringView name, boo
return chosen;
}
+// https://html.spec.whatwg.org/multipage/dom.html#still-on-its-initial-about:blank-document
+bool BrowsingContext::still_on_its_initial_about_blank_document() const
+{
+ // A browsing context browsingContext is still on its initial about:blank Document
+ // if browsingContext's session history's size is 1
+ // and browsingContext's session history[0]'s document's is initial about:blank is true.
+ return m_session_history.size() == 1
+ && m_session_history[0].document
+ && m_session_history[0].document->is_initial_about_blank();
+}
+
}
diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h
index 7ae35ee318..f519cf4948 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h
@@ -116,6 +116,9 @@ public:
Vector<SessionHistoryEntry>& session_history() { return m_session_history; }
Vector<SessionHistoryEntry> const& session_history() const { return m_session_history; }
+ // https://html.spec.whatwg.org/multipage/dom.html#still-on-its-initial-about:blank-document
+ bool still_on_its_initial_about_blank_document() const;
+
private:
explicit BrowsingContext(Page&, HTML::BrowsingContextContainer*);