summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-09-21 01:20:20 +0200
committerAndrew Kaster <andrewdkaster@gmail.com>2022-12-25 07:58:58 -0700
commit3610ac5e191487dcff8c4a8bd3ed271669c30a6a (patch)
tree39e0a59497e947046891ed432d66dbbd10e8bfa9
parentf043d4b654eca99675d899d468ee1dca828ad512 (diff)
downloadserenity-3610ac5e191487dcff8c4a8bd3ed271669c30a6a.zip
Ladybird/WebView: Close top-level BC when the WebView is destroyed
-rw-r--r--Ladybird/PageClientLadybird.cpp5
-rw-r--r--Ladybird/PageClientLadybird.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/Ladybird/PageClientLadybird.cpp b/Ladybird/PageClientLadybird.cpp
index ed0b866356..d643b20b23 100644
--- a/Ladybird/PageClientLadybird.cpp
+++ b/Ladybird/PageClientLadybird.cpp
@@ -34,6 +34,11 @@ PageClientLadybird::PageClientLadybird(WebView& view)
{
}
+PageClientLadybird::~PageClientLadybird()
+{
+ m_page->top_level_browsing_context().close();
+}
+
Web::Layout::InitialContainingBlock* PageClientLadybird::layout_root()
{
auto* document = page().top_level_browsing_context().active_document();
diff --git a/Ladybird/PageClientLadybird.h b/Ladybird/PageClientLadybird.h
index 36471d2ccf..57ef428a01 100644
--- a/Ladybird/PageClientLadybird.h
+++ b/Ladybird/PageClientLadybird.h
@@ -18,6 +18,7 @@ namespace Ladybird {
class PageClientLadybird final : public Web::PageClient {
public:
static NonnullOwnPtr<PageClientLadybird> create(WebView&);
+ virtual ~PageClientLadybird() override;
Web::Page& page() { return *m_page; }
Web::Page const& page() const { return *m_page; }