From 0244a5b69be034cf08e1071d6bbf38a105a71b54 Mon Sep 17 00:00:00 2001 From: networkException Date: Mon, 19 Sep 2022 18:13:13 +0200 Subject: [PATCH] update fetch_descendants_of_a_module_script to match spec update --- .../Libraries/LibWeb/HTML/Scripting/Fetching.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp index 2ff2fd339c829ce..4250c5a19669c32 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp +++ b/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp @@ -92,23 +92,21 @@ void fetch_descendants_of_a_module_script(JavaScriptModuleScript const& module_s // FIXME: 7. Assert: options is not null, as module script is a JavaScript module script. - if (module_requests.is_empty()) { + // 8. Let pendingCount be the length of moduleRequests. + auto pending_count = module_requests.size(); + + // 9. If pendingCount is zero, run onComplete with module script. + if (pending_count == 0) { on_complete(&module_script); return; } + // 10. Let failed be false. auto context = DescendantFetchingContext::create(); - - // 8. Let pendingCount be the length of moduleRequests. - context->set_pending_count(module_requests.size()); - - // 9. Let failed be false. + context->set_pending_count(pending_count); context->set_failed(false); - context->set_on_complete(move(on_complete)); - // VERIFY(module_requests.size() > 0); - // 10. For each moduleRequest in moduleRequests, perform the internal module script graph fetching procedure given moduleRequest, // fetch client settings object, destination, options, module script's settings object, visited set, module script's base URL, and the following steps given result: for (auto const& module_request : module_requests) {