From 3e29a1975af35b76e7beee9f5e64318f4c33ba0e Mon Sep 17 00:00:00 2001 From: sin-ack Date: Sat, 12 Oct 2024 11:41:27 +0000 Subject: [PATCH] LibWeb: Obtain basename before passing base_url to ClassicScript::create This would previously crash because it depended on a specific order for evaluating function arguments, which is undefined. (cherry picked from commit 27b1d94e04386fd46c2c9148b9555c841595e2d3) --- Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp b/Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp index 3150bf1b61e3ca..668a8e68096748 100644 --- a/Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp +++ b/Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp @@ -380,7 +380,8 @@ i32 WindowOrWorkerGlobalScopeMixin::run_timer_initialization_steps(TimerHandler // 7. Let script be the result of creating a classic script given handler, settings object, base URL, and fetch options. // FIXME: Pass fetch options. - auto script = ClassicScript::create(base_url.basename(), source, settings_object, move(base_url)); + auto basename = base_url.basename(); + auto script = ClassicScript::create(basename, source, settings_object, move(base_url)); // 8. Run the classic script script. (void)script->run();