From 93405b4affb141ef97231d26f1f0991c8978efe3 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 13 Oct 2022 22:22:41 +0200 Subject: [PATCH] LibWeb: Add virtual destructor to Environment This makes it polymorphic and allows checking the subclass of an Environment with is(). We also need to change the inheritance order so JS::Cell comes first for this to work. Unfortunately, I have no idea why that is. Co-Authored-By: Andreas Kling --- Userland/Libraries/LibWeb/HTML/Scripting/Environments.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h index 551c18f53e..0de0ba771b 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h +++ b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h @@ -20,6 +20,8 @@ namespace Web::HTML { // https://html.spec.whatwg.org/multipage/webappapis.html#environment struct Environment { + virtual ~Environment() = default; + // An id https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-id String id; @@ -53,8 +55,8 @@ enum class RunScriptDecision { // https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object struct EnvironmentSettingsObject - : public Environment - , public JS::Cell { + : public JS::Cell + , public Environment { JS_CELL(EnvironmentSettingsObject, JS::Cell); virtual ~EnvironmentSettingsObject() override;