From 9aca54091a53b5b287096311a6bbcfdd21f42d2f Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Tue, 28 Feb 2023 18:06:18 +0000 Subject: [PATCH] LibWeb: Remove the dummy execution context --- .../LibWeb/Bindings/MainThreadVM.cpp | 22 ------------------- 1 file changed, 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(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(*root_realm, *root_realm).release_allocated_value_but_fixme_should_propagate_errors(); - auto host_defined = make(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; }