/* * Copyright (c) 2022, Andrew Kaster * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace Web::Bindings { struct HostDefined : public JS::Realm::HostDefined { HostDefined(JS::GCPtr eso, JS::NonnullGCPtr intrinsics) : environment_settings_object(eso) , intrinsics(intrinsics) { } virtual ~HostDefined() override = default; virtual void visit_edges(JS::Cell::Visitor& visitor) override; // NOTE: Only the root execution environment in the main thread VM ever sets this to nullptr JS::GCPtr environment_settings_object; JS::NonnullGCPtr intrinsics; }; [[nodiscard]] inline HTML::EnvironmentSettingsObject& host_defined_environment_settings_object(JS::Realm& realm) { return *verify_cast(realm.host_defined())->environment_settings_object; } }