mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 02:03:06 -05: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
Notes:
sideshowbarker
2024-07-17 05:17:20 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/2898701459 Pull-request: https://github.com/SerenityOS/serenity/pull/15672
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()
|
||||
|
|
|
@ -32,6 +32,8 @@ struct WebEngineCustomData final : public JS::VM::CustomData {
|
|||
// FIXME: This should be a set.
|
||||
Vector<JS::Handle<DOM::MutationObserver>> mutation_observers;
|
||||
|
||||
JS::Handle<JS::Realm> internal_realm;
|
||||
|
||||
OwnPtr<JS::ExecutionContext> root_execution_context;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue