1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 07:14:58 +00:00

LibWeb: Fix unsafe capture in fetch_external_module_script_graph()

We can't be capturing the AK::URL by reference here, since on_complete
may be called later, after the value is no longer alive.
This commit is contained in:
Andreas Kling 2022-10-06 18:27:24 +02:00
parent b9a45cf1aa
commit 19494b436b

View file

@ -268,7 +268,7 @@ void fetch_external_module_script_graph(AK::URL const& url, EnvironmentSettingsO
{
// 1. Fetch a single module script given url, settings object, "script", options, settings object, "client", true, and with the following steps given result:
// FIXME: Pass options.
fetch_single_module_script(url, settings_object, "script"sv, settings_object, "client"sv, {}, TopLevelModule::Yes, [&settings_object, on_complete = move(on_complete), &url](auto* result) mutable {
fetch_single_module_script(url, settings_object, "script"sv, settings_object, "client"sv, {}, TopLevelModule::Yes, [&settings_object, on_complete = move(on_complete), url](auto* result) mutable {
// 1. If result is null, run onComplete given null, and abort these steps.
if (!result) {
on_complete(nullptr);