From cc5cba90db6c7452cce0155a0de51175b9560b40 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 20 Jun 2020 17:45:27 +0200 Subject: LibWeb: Give the DOM Window object a (weak) pointer to its JS wrapper --- Libraries/LibWeb/Bindings/WindowObject.cpp | 1 + Libraries/LibWeb/Bindings/WindowObject.h | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'Libraries/LibWeb/Bindings') diff --git a/Libraries/LibWeb/Bindings/WindowObject.cpp b/Libraries/LibWeb/Bindings/WindowObject.cpp index 746a81c8fc..7c321f8661 100644 --- a/Libraries/LibWeb/Bindings/WindowObject.cpp +++ b/Libraries/LibWeb/Bindings/WindowObject.cpp @@ -45,6 +45,7 @@ namespace Bindings { WindowObject::WindowObject(Window& impl) : m_impl(impl) { + impl.set_wrapper({}, *this); } void WindowObject::initialize() diff --git a/Libraries/LibWeb/Bindings/WindowObject.h b/Libraries/LibWeb/Bindings/WindowObject.h index dff689c8e4..3bc6797249 100644 --- a/Libraries/LibWeb/Bindings/WindowObject.h +++ b/Libraries/LibWeb/Bindings/WindowObject.h @@ -26,13 +26,16 @@ #pragma once +#include #include #include namespace Web { namespace Bindings { -class WindowObject final : public JS::GlobalObject { +class WindowObject final + : public JS::GlobalObject + , public Weakable { public: explicit WindowObject(Window&); virtual void initialize() override; -- cgit v1.2.3