mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-18 18:00:31 +00:00
We weren't doing this before either, but through a slightly sneaky mechanism: we had overridden Cell::initialize() in ShadowRealmGlobalScope as a no-op. Instead of that, do the same thing Window and Worker globals do and make all of the globals that inherit UniversalGlobalScopeMixin opt out of WEB_SET_PROTOTYPE_FOR_INTERFACE in EventTarget::initialize().
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Bindings/ShadowRealmExposedInterfaces.h>
|
|
#include <LibWeb/Bindings/ShadowRealmGlobalScopePrototype.h>
|
|
#include <LibWeb/HTML/ShadowRealmGlobalScope.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
GC_DEFINE_ALLOCATOR(ShadowRealmGlobalScope);
|
|
|
|
ShadowRealmGlobalScope::ShadowRealmGlobalScope(JS::Realm& realm)
|
|
: DOM::EventTarget(realm)
|
|
{
|
|
}
|
|
|
|
ShadowRealmGlobalScope::~ShadowRealmGlobalScope() = default;
|
|
|
|
GC::Ref<ShadowRealmGlobalScope> ShadowRealmGlobalScope::create(JS::Realm& realm)
|
|
{
|
|
return realm.create<ShadowRealmGlobalScope>(realm);
|
|
}
|
|
|
|
void ShadowRealmGlobalScope::initialize_web_interfaces()
|
|
{
|
|
auto& realm = this->realm();
|
|
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(ShadowRealmGlobalScope);
|
|
|
|
add_shadow_realm_exposed_interfaces(*this);
|
|
Bindings::ShadowRealmGlobalScopeGlobalMixin::initialize(realm, *this);
|
|
}
|
|
|
|
void ShadowRealmGlobalScope::visit_edges(Cell::Visitor& visitor)
|
|
{
|
|
Base::visit_edges(visitor);
|
|
UniversalGlobalScopeMixin::visit_edges(visitor);
|
|
}
|
|
|
|
}
|