mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:17:44 +00:00
LibJS: Implement a more general InitializeHostDefinedRealm AO
The existing implementation of this AO lives in Interpreter::create(), which makes it impossible to use without also constructing an Interpreter. This patch adds a new Realm::initialize_host_defined_realm() and takes the global object and global this customization steps as Function callback objects. This will be used by LibWeb to create realms during Document construction.
This commit is contained in:
parent
e756b5450d
commit
8a03b17007
3 changed files with 78 additions and 10 deletions
|
@ -26,8 +26,9 @@ public:
|
|||
Realm() = default;
|
||||
|
||||
static Realm* create(VM&);
|
||||
static ThrowCompletionOr<NonnullOwnPtr<ExecutionContext>> initialize_host_defined_realm(VM&, Function<Value(Realm&)> create_global_object, Function<Value(Realm&)> create_global_this_value);
|
||||
|
||||
void set_global_object(GlobalObject&, Object* this_value = nullptr);
|
||||
void set_global_object(Value global_object, Value this_value);
|
||||
|
||||
[[nodiscard]] GlobalObject& global_object() const { return *m_global_object; }
|
||||
[[nodiscard]] GlobalEnvironment& global_environment() const { return *m_global_environment; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue