mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:37:36 +00:00
LibJS: Implement SetDefaultGlobalBindings as a standalone function
Instead of hardcoding all the property definitions in GlobalObject's initialize() function, make it the standalone AO it is supposed to be that can then be used by other global objects that don't inherit from JS::GlobalObject.
This commit is contained in:
parent
e3804e6426
commit
040e3abb1d
3 changed files with 103 additions and 81 deletions
|
@ -71,11 +71,11 @@ ThrowCompletionOr<NonnullOwnPtr<ExecutionContext>> Realm::initialize_host_define
|
|||
// 9. Perform SetRealmGlobalObject(realm, global, thisValue).
|
||||
realm->set_global_object(global, this_value);
|
||||
|
||||
// NOTE: Steps 10 & 11 are somewhat ad-hoc, since we store intrinsics on the global object.
|
||||
|
||||
// 10. Let globalObj be ? SetDefaultGlobalBindings(realm).
|
||||
auto& global_object = set_default_global_bindings(*realm);
|
||||
|
||||
// 11. Create any host-defined global object properties on globalObj.
|
||||
realm->global_object().initialize(*realm);
|
||||
global_object.initialize(*realm);
|
||||
|
||||
// 12. Return unused.
|
||||
return new_context;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue