Skip to content

Commit

Permalink
LibWeb: Obtain basename before passing base_url to ClassicScript::create
Browse files Browse the repository at this point in the history
This would previously crash because it depended on a specific order for
evaluating function arguments, which is undefined.

(cherry picked from commit 27b1d94e04386fd46c2c9148b9555c841595e2d3)
  • Loading branch information
sin-ack authored and nico committed Nov 13, 2024
1 parent 8c71476 commit 3e29a19
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 3e29a19

Please sign in to comment.