mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
LibWeb: Hang on to the internal realm with a JS::Handle
This fixes an issue where GC would kill the internal realm if it ran at the wrong time during startup. Found by aggressively GC'ing between every allocation.
This commit is contained in:
parent
6e0f80fbe0
commit
2898701459
2 changed files with 3 additions and 0 deletions
|
@ -375,6 +375,7 @@ JS::VM& main_thread_vm()
|
|||
auto* intrinsics = root_realm->heap().allocate<Intrinsics>(*root_realm, *root_realm);
|
||||
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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue