diff options
author | Luke Wilde <lukew@serenityos.org> | 2023-02-28 18:06:18 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-03-07 11:51:12 +0000 |
commit | 9aca54091a53b5b287096311a6bbcfdd21f42d2f (patch) | |
tree | 938829807fae262e647fe7d300afe6a237210c2f /Userland/Libraries | |
parent | a1f7186153792840fe7a564a5bf615986878932d (diff) | |
download | serenity-9aca54091a53b5b287096311a6bbcfdd21f42d2f.zip |
LibWeb: Remove the dummy execution context
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp index cc9e0091d6..dfad905349 100644 --- a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp +++ b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp @@ -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; } |