mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:37:44 +00:00
LibJS: Start implementing ShadowRealm
This commit adds the ShadowRealm object itself, its constructor, and prototype (currently empty).
This commit is contained in:
parent
50f8755792
commit
d40331ef69
10 changed files with 216 additions and 0 deletions
|
@ -7,10 +7,31 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibJS/Runtime/Object.h>
|
||||
#include <LibJS/Runtime/Realm.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
class ShadowRealm final : public Object {
|
||||
JS_OBJECT(ShadowRealm, Object);
|
||||
|
||||
public:
|
||||
ShadowRealm(Realm&, ExecutionContext, Object& prototype);
|
||||
virtual ~ShadowRealm() override = default;
|
||||
|
||||
[[nodiscard]] Realm const& shadow_realm() const { return m_shadow_realm; }
|
||||
[[nodiscard]] Realm& shadow_realm() { return m_shadow_realm; }
|
||||
[[nodiscard]] ExecutionContext const& execution_context() const { return m_execution_context; }
|
||||
[[nodiscard]] ExecutionContext& execution_context() { return m_execution_context; }
|
||||
|
||||
private:
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
// 3.5 Properties of ShadowRealm Instances, https://tc39.es/proposal-shadowrealm/#sec-properties-of-shadowrealm-instances
|
||||
Realm& m_shadow_realm; // [[ShadowRealm]]
|
||||
ExecutionContext m_execution_context; // [[ExecutionContext]]
|
||||
};
|
||||
|
||||
ThrowCompletionOr<Value> get_wrapped_value(GlobalObject&, Realm& caller_realm, Value);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue