summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp')
-rw-r--r--Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
index 038f6dbdbd..95464fa6b5 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
@@ -1322,4 +1322,22 @@ void BrowsingContext::discard()
parent()->remove_child(*this);
}
+// https://html.spec.whatwg.org/multipage/window-object.html#close-a-browsing-context
+void BrowsingContext::close()
+{
+ VERIFY(active_document());
+
+ // FIXME: 1. If the result of calling prompt to unload with browsingContext's active document is "refuse", then return.
+
+ // 2. Unload browsingContext's active document.
+ active_document()->unload();
+
+ // 3. Remove browsingContext from the user interface (e.g., close or hide its tab in a tabbed browser).
+ if (m_page)
+ m_page->client().page_did_close_browsing_context(*this);
+
+ // 4. Discard browsingContext.
+ discard();
+}
+
}