diff --git a/Libraries/LibWeb/HTML/Scripting/Fetching.cpp b/Libraries/LibWeb/HTML/Scripting/Fetching.cpp
index 7a52be21d6b..36a203b0cd7 100644
--- a/Libraries/LibWeb/HTML/Scripting/Fetching.cpp
+++ b/Libraries/LibWeb/HTML/Scripting/Fetching.cpp
@@ -713,7 +713,7 @@ void fetch_single_module_script(JS::Realm& realm,
// 7. If mimeType is a JavaScript MIME type and moduleType is "javascript", then set moduleScript to the result of creating a JavaScript module script given sourceText, moduleMapRealm, response's URL, and options.
// FIXME: Pass options.
if (mime_type.has_value() && mime_type->is_javascript() && module_type == "javascript")
- module_script = JavaScriptModuleScript::create(url.basename(), source_text, module_map_realm, response->url().value_or({})).release_value_but_fixme_should_propagate_errors();
+ module_script = JavaScriptModuleScript::create(url.to_byte_string(), source_text, module_map_realm, response->url().value_or({})).release_value_but_fixme_should_propagate_errors();
// FIXME: 8. If the MIME type essence of mimeType is "text/css" and moduleType is "css", then set moduleScript to the result of creating a CSS module script given sourceText and settingsObject.
// FIXME: 9. If mimeType is a JSON MIME type and moduleType is "json", then set moduleScript to the result of creating a JSON module script given sourceText and settingsObject.
diff --git a/Tests/LibWeb/Text/expected/error-stack-must-contain-full-url.txt b/Tests/LibWeb/Text/expected/error-stack-must-contain-full-url.txt
new file mode 100644
index 00000000000..2d1ab6eb42d
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/error-stack-must-contain-full-url.txt
@@ -0,0 +1,11 @@
+classic: Error
+ at Error
+ at blob:file:///[flaky-uuid-replaced]:3:36
+
+module: Error
+ at Error
+ at blob:file:///[flaky-uuid-replaced]:3:36
+ at
+ at
+ at
+
diff --git a/Tests/LibWeb/Text/input/error-stack-must-contain-full-url.html b/Tests/LibWeb/Text/input/error-stack-must-contain-full-url.html
new file mode 100644
index 00000000000..867a94c79ed
--- /dev/null
+++ b/Tests/LibWeb/Text/input/error-stack-must-contain-full-url.html
@@ -0,0 +1,43 @@
+
+
+
+