1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:17:42 +00:00

LibWeb: Add virtual destructor to Environment

This makes it polymorphic and allows checking the subclass of an
Environment with is<T>().

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 <kling@serenityos.org>
This commit is contained in:
Linus Groh 2022-10-13 22:22:41 +02:00
parent e40c8f550f
commit 93405b4aff

View file

@ -20,6 +20,8 @@ namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/webappapis.html#environment // https://html.spec.whatwg.org/multipage/webappapis.html#environment
struct Environment { struct Environment {
virtual ~Environment() = default;
// An id https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-id // An id https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-id
String id; String id;
@ -53,8 +55,8 @@ enum class RunScriptDecision {
// https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object // https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object
struct EnvironmentSettingsObject struct EnvironmentSettingsObject
: public Environment : public JS::Cell
, public JS::Cell { , public Environment {
JS_CELL(EnvironmentSettingsObject, JS::Cell); JS_CELL(EnvironmentSettingsObject, JS::Cell);
virtual ~EnvironmentSettingsObject() override; virtual ~EnvironmentSettingsObject() override;