LibWeb: Remove the dummy execution context
This commit is contained in:
parent
a1f7186153
commit
9aca54091a
Notes:
sideshowbarker
2024-07-17 12:02:22 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/commit/9aca54091a Pull-request: https://github.com/SerenityOS/serenity/pull/17669 Reviewed-by: https://github.com/davidot Reviewed-by: https://github.com/linusg ✅
1 changed files with 0 additions and 22 deletions
|
@ -368,28 +368,6 @@ JS::VM& main_thread_vm()
|
|||
// 10. Return resolvedModuleScript's record.
|
||||
return JS::NonnullGCPtr(*resolved_module_script.module_script->record());
|
||||
};
|
||||
|
||||
// NOTE: We push a dummy execution context onto the JS execution context stack,
|
||||
// just to make sure that it's never empty.
|
||||
auto& custom_data = *verify_cast<WebEngineCustomData>(vm->custom_data());
|
||||
custom_data.root_execution_context = MUST(JS::Realm::initialize_host_defined_realm(*vm, nullptr, nullptr));
|
||||
|
||||
auto* root_realm = custom_data.root_execution_context->realm;
|
||||
auto intrinsics = root_realm->heap().allocate<Intrinsics>(*root_realm, *root_realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
auto host_defined = make<HostDefined>(nullptr, intrinsics);
|
||||
root_realm->set_host_defined(move(host_defined));
|
||||
custom_data.internal_realm = root_realm;
|
||||
|
||||
// NOTE: We make sure the internal realm has all the Window intrinsics initialized.
|
||||
// The DeferGC is a hack to avoid nested GC allocations due to lazy ensure_web_prototype()
|
||||
// and ensure_web_constructor() invocations.
|
||||
// FIXME: Find a nicer way to do this.
|
||||
JS::DeferGC defer_gc(root_realm->heap());
|
||||
auto object = JS::Object::create(*root_realm, nullptr);
|
||||
root_realm->set_global_object(object, object);
|
||||
add_window_exposed_interfaces(*object);
|
||||
|
||||
vm->push_execution_context(*custom_data.root_execution_context);
|
||||
}
|
||||
return *vm;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue