summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/Scripting
diff options
context:
space:
mode:
authornetworkException <git@nwex.de>2022-10-02 23:17:33 +0200
committerAndreas Kling <kling@serenityos.org>2022-10-06 16:41:36 +0200
commit83554526f0488b063e0fff07f0fd11d86301e765 (patch)
tree7f99bd7580c04d5d25f14ae13510d309d972d21f /Userland/Libraries/LibWeb/HTML/Scripting
parent5a3e079deb93eaf9dcd6f29563666d0bc4b2815f (diff)
downloadserenity-83554526f0488b063e0fff07f0fd11d86301e765.zip
LibWeb: Allow all Script types to be used as [[HostDefined]] values
This patch adds support for all child classes of Web::HTML::Script to be used in the [[HostDefined]] field of JS::Modules and JS::Scripts.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/Scripting')
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp5
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.h5
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/Script.cpp5
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/Script.h7
4 files changed, 12 insertions, 10 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp
index 7aef833c9e..7ac67f244d 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp
@@ -166,9 +166,4 @@ void ClassicScript::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_script_record);
}
-void ClassicScript::visit_host_defined_self(Cell::Visitor& visitor)
-{
- visitor.visit(this);
-}
-
}
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.h b/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.h
index 41004659c3..6780c656aa 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.h
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.h
@@ -13,9 +13,7 @@
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/webappapis.html#classic-script
-class ClassicScript final
- : public Script
- , public JS::Script::HostDefined {
+class ClassicScript final : public Script {
JS_CELL(ClassicScript, Script);
public:
@@ -42,7 +40,6 @@ private:
ClassicScript(AK::URL base_url, String filename, EnvironmentSettingsObject& environment_settings_object);
virtual void visit_edges(Cell::Visitor&) override;
- virtual void visit_host_defined_self(Cell::Visitor&) override;
JS::GCPtr<JS::Script> m_script_record;
MutedErrors m_muted_errors { MutedErrors::No };
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Script.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/Script.cpp
index ae7371b007..72c13bd8f8 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/Script.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/Script.cpp
@@ -17,4 +17,9 @@ Script::Script(AK::URL base_url, String filename, EnvironmentSettingsObject& env
Script::~Script() = default;
+void Script::visit_host_defined_self(JS::Cell::Visitor& visitor)
+{
+ visitor.visit(this);
+}
+
}
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Script.h b/Userland/Libraries/LibWeb/HTML/Scripting/Script.h
index 862cee3763..b3a5a52e09 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/Script.h
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/Script.h
@@ -8,12 +8,15 @@
#include <AK/URL.h>
#include <LibJS/Heap/Cell.h>
+#include <LibJS/Script.h>
#include <LibWeb/Forward.h>
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-script
-class Script : public JS::Cell {
+class Script
+ : public JS::Cell
+ , public JS::Script::HostDefined {
JS_CELL(Script, JS::Cell);
public:
@@ -28,6 +31,8 @@ protected:
Script(AK::URL base_url, String filename, EnvironmentSettingsObject& environment_settings_object);
private:
+ virtual void visit_host_defined_self(JS::Cell::Visitor&) override;
+
AK::URL m_base_url;
String m_filename;
EnvironmentSettingsObject& m_settings_object;