summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/Scripting
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-09-01 21:22:02 +0200
committerAndreas Kling <kling@serenityos.org>2022-09-06 00:27:09 +0200
commitabfb73f2e716017c11fd0513e63e742cec64cecf (patch)
tree41ae695fa3175419abca2faa431884c7fe336d54 /Userland/Libraries/LibWeb/HTML/Scripting
parent2ff7e37048e0296ae6dc3653ca69da7bb1fa22dc (diff)
downloadserenity-abfb73f2e716017c11fd0513e63e742cec64cecf.zip
LibWeb+LibJS: Let JS::Realm::HostDefined objects mark things during GC
This allows us to mark the HTML::Window from our window environment settings object.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/Scripting')
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp8
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h8
2 files changed, 13 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp
index 2d3befe376..6e21dd40ca 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp
@@ -16,6 +16,14 @@ WindowEnvironmentSettingsObject::WindowEnvironmentSettingsObject(Window& window,
{
}
+WindowEnvironmentSettingsObject::~WindowEnvironmentSettingsObject() = default;
+
+void WindowEnvironmentSettingsObject::visit_edges(JS::Cell::Visitor& visitor)
+{
+ EnvironmentSettingsObject::visit_edges(visitor);
+ visitor.visit(m_window.ptr());
+}
+
// https://html.spec.whatwg.org/multipage/window-object.html#set-up-a-window-environment-settings-object
void WindowEnvironmentSettingsObject::setup(AK::URL const& creation_url, NonnullOwnPtr<JS::ExecutionContext> execution_context, Optional<Environment> reserved_environment, AK::URL top_level_creation_url, Origin top_level_origin)
{
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h b/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h
index d513ff3efd..48f3196d0e 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h
@@ -6,8 +6,8 @@
#pragma once
+#include <LibJS/Heap/Cell.h>
#include <LibWeb/HTML/Scripting/Environments.h>
-#include <LibWeb/HTML/Window.h>
namespace Web::HTML {
@@ -15,7 +15,7 @@ class WindowEnvironmentSettingsObject final : public EnvironmentSettingsObject {
public:
static void setup(AK::URL const& creation_url, NonnullOwnPtr<JS::ExecutionContext>, Optional<Environment>, AK::URL top_level_creation_url, Origin top_level_origin);
- virtual ~WindowEnvironmentSettingsObject() override = default;
+ virtual ~WindowEnvironmentSettingsObject() override;
virtual JS::GCPtr<DOM::Document> responsible_document() override;
virtual String api_url_character_encoding() override;
@@ -26,7 +26,9 @@ public:
private:
WindowEnvironmentSettingsObject(Window&, NonnullOwnPtr<JS::ExecutionContext>);
- WeakPtr<Window> m_window;
+ virtual void visit_edges(JS::Cell::Visitor&) override;
+
+ JS::GCPtr<Window> m_window;
};
}