mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:07:45 +00:00
LibJS: Support creation of global object in Realm::set_global_object()
This commit is contained in:
parent
c8f1651761
commit
885004abee
1 changed files with 5 additions and 2 deletions
|
@ -75,8 +75,11 @@ void Realm::set_global_object(GlobalObject* global_object, GlobalObject* this_va
|
||||||
{
|
{
|
||||||
// 1. If globalObj is undefined, then
|
// 1. If globalObj is undefined, then
|
||||||
if (global_object == nullptr) {
|
if (global_object == nullptr) {
|
||||||
// NOTE: Step 1 is not supported, the global object must be allocated elsewhere.
|
// a. Let intrinsics be realmRec.[[Intrinsics]].
|
||||||
VERIFY_NOT_REACHED();
|
// b. Set globalObj to OrdinaryObjectCreate(intrinsics.[[%Object.prototype%]]).
|
||||||
|
// NOTE: We allocate a proper GlobalObject directly as this plain object is
|
||||||
|
// turned into one via SetDefaultGlobalBindings in the spec.
|
||||||
|
global_object = heap().allocate_without_global_object<GlobalObject>(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Assert: Type(globalObj) is Object.
|
// 2. Assert: Type(globalObj) is Object.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue