commit b795285e13eb8e7ffbf7a543f16aedb45eab8aba
parent 4712d66307c236ffaa21d85df2ca0f5a85a7b18f
Author: RichardTjokroutomo <richard.tjokro2@gmail.com>
Date: Thu, 9 Oct 2025 20:31:31 +0000
Bug 1992120 [wpt PR 55121] - script: Add line number argument to module script compilation functions, a=testonly
Automatic update from web-platform-tests
Script: added line_no as argument to both fetch_inline_module_script & compile_module_script to fix the inline script reporting wrong line issue (#39415)
Originally, the function compile_module_script hardwires the value 1 when invoking CompileOptionsWrapper::new(). This is fine if the script is written in separate JS file, but for inline scripts, it will cause confusion if the <script> tag doesn't start from line #1.
Credits to JDM for actually pointing out which functions to fix.
Testing: There are WPT tests for this change, specifically: tests/wpt/tests/html/semantics/scripting-1/the-script-element/module/evaluation-error-5.html
Signed-off-by: RichardTjokroutomo <richard.tjokro2@gmail.com>
--
Script: Fixed code according to reviewer's comments.
Testing: Modified code according to reviewer's comment.
Signed-off-by: RichardTjokroutomo <richard.tjokro2@gmail.com>
--
Tests: Removed trailing whitespace in servo/tests/wpt/tests/html/semantics/scripting-1/the-script-element/module/evaluation-error-5.html : 11
Signed-off-by: RichardTjokroutomo <richard.tjokro2@gmail.com>
--
wpt-commits: 86ad054d2d6884464c701c3d90216553a414972a, cc50ae3ee82addab06018863cd684cfe7676545b, d674ed8b109820398f0e631f4421c18ef4715ee8
wpt-pr: 55121
Diffstat:
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/module/evaluation-error-5.html b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/module/evaluation-error-5.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<title>Handling of evaluation errors, 5</title>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+ setup({allow_uncaught_exception: true});
+ const test_load = async_test("Test for the inline module script error that reports wrong line\n");
+ window.addEventListener("error", test_load.step_func_done(ev => {
+
+ const expectedLine = 16;
+ assert_equals(ev.lineno, expectedLine);
+
+ }));
+</script>
+<script type="module">a</script>