mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 10:37:44 +00:00
LibJS: Turn initialize_global_object() into a regular initialize()
There's nothing special about global object initialization anymore, this can just work the same way as for any other object now.
This commit is contained in:
parent
867ad03995
commit
cfa5885855
17 changed files with 36 additions and 36 deletions
|
@ -88,8 +88,10 @@ GlobalObject::GlobalObject(Realm& realm)
|
|||
}
|
||||
|
||||
// 9.3.4 SetDefaultGlobalBindings ( realmRec ), https://tc39.es/ecma262/#sec-setdefaultglobalbindings
|
||||
void GlobalObject::initialize_global_object(Realm& realm)
|
||||
void GlobalObject::initialize(Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
ensure_shape_is_unique();
|
||||
|
|
|
@ -18,8 +18,7 @@ class GlobalObject : public Object {
|
|||
|
||||
public:
|
||||
explicit GlobalObject(Realm&);
|
||||
virtual void initialize_global_object(Realm&);
|
||||
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~GlobalObject() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -75,7 +75,7 @@ ThrowCompletionOr<NonnullOwnPtr<ExecutionContext>> Realm::initialize_host_define
|
|||
|
||||
// 10. Let globalObj be ? SetDefaultGlobalBindings(realm).
|
||||
// 11. Create any host-defined global object properties on globalObj.
|
||||
realm->global_object().initialize_global_object(*realm);
|
||||
realm->global_object().initialize(*realm);
|
||||
|
||||
// 12. Return unused.
|
||||
return new_context;
|
||||
|
|
|
@ -64,7 +64,7 @@ ThrowCompletionOr<Object*> ShadowRealmConstructor::construct(FunctionObject& new
|
|||
// 10. Perform ? SetRealmGlobalObject(realmRec, undefined, undefined).
|
||||
auto* new_global_object = vm.heap().allocate_without_realm<GlobalObject>(*realm);
|
||||
realm->set_global_object(new_global_object, nullptr);
|
||||
new_global_object->initialize_global_object(*realm);
|
||||
new_global_object->initialize(*realm);
|
||||
|
||||
// TODO: I don't think we should have these exactly like this, that doesn't work well with how
|
||||
// we create global objects. Still, it should be possible to make a ShadowRealm with a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue