2024-10-26 21:35:21 +13:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2024-11-08 16:35:16 +13:00
|
|
|
#include <LibWeb/Bindings/ShadowRealmGlobalScopeGlobalMixin.h>
|
2024-10-26 21:35:21 +13:00
|
|
|
#include <LibWeb/DOM/EventTarget.h>
|
2024-11-08 16:35:16 +13:00
|
|
|
#include <LibWeb/HTML/UniversalGlobalScope.h>
|
2024-10-26 21:35:21 +13:00
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
// https://whatpr.org/html/9893/webappapis.html#shadowrealmglobalscope
|
2024-11-08 16:35:16 +13:00
|
|
|
class ShadowRealmGlobalScope
|
|
|
|
: public DOM::EventTarget
|
|
|
|
, public UniversalGlobalScopeMixin
|
|
|
|
, public Bindings::ShadowRealmGlobalScopeGlobalMixin {
|
2024-10-26 21:35:21 +13:00
|
|
|
WEB_PLATFORM_OBJECT(ShadowRealmGlobalScope, DOM::EventTarget);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(ShadowRealmGlobalScope);
|
2024-10-26 21:35:21 +13:00
|
|
|
|
|
|
|
public:
|
|
|
|
virtual ~ShadowRealmGlobalScope() override;
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
static GC::Ref<ShadowRealmGlobalScope> create(JS::Realm&);
|
2024-10-26 21:35:21 +13:00
|
|
|
|
2024-11-08 16:35:16 +13:00
|
|
|
virtual Bindings::PlatformObject& this_impl() override { return *this; }
|
|
|
|
virtual Bindings::PlatformObject const& this_impl() const override { return *this; }
|
|
|
|
|
2024-10-26 21:35:21 +13:00
|
|
|
// https://whatpr.org/html/9893/webappapis.html#dom-shadowrealmglobalscope-self
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ref<ShadowRealmGlobalScope> self()
|
2024-10-26 21:35:21 +13:00
|
|
|
{
|
|
|
|
// The self getter steps are to return this.
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2024-11-08 16:35:16 +13:00
|
|
|
using UniversalGlobalScopeMixin::atob;
|
|
|
|
using UniversalGlobalScopeMixin::btoa;
|
|
|
|
using UniversalGlobalScopeMixin::queue_microtask;
|
|
|
|
using UniversalGlobalScopeMixin::structured_clone;
|
|
|
|
|
2024-11-08 16:03:45 +13:00
|
|
|
void initialize_web_interfaces();
|
|
|
|
|
2024-10-26 21:35:21 +13:00
|
|
|
protected:
|
|
|
|
explicit ShadowRealmGlobalScope(JS::Realm&);
|
|
|
|
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|