mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 23:09:08 +00:00
LibJS+LibWeb: Make CyclicModule & GraphLoadingState GC-allocated
This allows them to participate in the ownership graph and fixes a lifetime issue in module loading found by ASAN. Co-Authored-By: networkException <networkexception@serenityos.org>
This commit is contained in:
parent
aa7501a66a
commit
0817d8bda6
Notes:
sideshowbarker
2024-07-16 22:22:13 +09:00
Author: https://github.com/awesomekling
Commit: 0817d8bda6
Pull-request: https://github.com/SerenityOS/serenity/pull/21967
Issue: https://github.com/SerenityOS/serenity/issues/21737
Issue: https://github.com/SerenityOS/serenity/issues/21899
6 changed files with 60 additions and 24 deletions
|
@ -760,7 +760,7 @@ void fetch_descendants_of_and_link_a_module_script(JS::Realm& realm,
|
|||
}
|
||||
|
||||
// 3. Let state be Record { [[ParseError]]: null, [[Destination]]: destination, [[PerformFetch]]: null, [[FetchClient]]: fetchClient }.
|
||||
auto state = FetchContext { {}, destination, {}, fetch_client };
|
||||
auto state = realm.heap().allocate_without_realm<FetchContext>(JS::js_null(), destination, nullptr, fetch_client);
|
||||
|
||||
// FIXME: 4. If performFetch was given, set state.[[PerformFetch]] to performFetch.
|
||||
|
||||
|
@ -796,8 +796,8 @@ void fetch_descendants_of_and_link_a_module_script(JS::Realm& realm,
|
|||
WebIDL::upon_rejection(loading_promise, [&state, &module_script, on_complete](auto const&) -> WebIDL::ExceptionOr<JS::Value> {
|
||||
// 1. If state.[[ParseError]] is not null, set moduleScript's error to rethrow to state.[[ParseError]] and run
|
||||
// onComplete given moduleScript.
|
||||
if (state.parse_error != nullptr) {
|
||||
module_script.set_error_to_rethrow(*state.parse_error);
|
||||
if (!state->parse_error.is_null()) {
|
||||
module_script.set_error_to_rethrow(state->parse_error);
|
||||
|
||||
on_complete->function()(module_script);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue