mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 01:51:03 +09:00

This object represents the global object for a shadow realm. The IDL generator will need to be adjusted to the '[Global]' extended attribute and no '[Exposed]' field (the change in the test is not correct, as I understand it), but this should be enough to get us started on shadow realms.
38 lines
1,000 B
C++
38 lines
1,000 B
C++
/*
|
|
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
|
#include <LibWeb/DOM/EventTarget.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
// https://whatpr.org/html/9893/webappapis.html#shadowrealmglobalscope
|
|
class ShadowRealmGlobalScope : public DOM::EventTarget {
|
|
WEB_PLATFORM_OBJECT(ShadowRealmGlobalScope, DOM::EventTarget);
|
|
JS_DECLARE_ALLOCATOR(ShadowRealmGlobalScope);
|
|
|
|
public:
|
|
virtual ~ShadowRealmGlobalScope() override;
|
|
|
|
static JS::NonnullGCPtr<ShadowRealmGlobalScope> create(JS::Realm&);
|
|
|
|
// https://whatpr.org/html/9893/webappapis.html#dom-shadowrealmglobalscope-self
|
|
JS::NonnullGCPtr<ShadowRealmGlobalScope> self()
|
|
{
|
|
// The self getter steps are to return this.
|
|
return *this;
|
|
}
|
|
|
|
protected:
|
|
explicit ShadowRealmGlobalScope(JS::Realm&);
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
};
|
|
|
|
}
|