diff --git a/components/script/dom/html/htmlscriptelement.rs b/components/script/dom/html/htmlscriptelement.rs index 29b038af579..f32889e0870 100644 --- a/components/script/dom/html/htmlscriptelement.rs +++ b/components/script/dom/html/htmlscriptelement.rs @@ -943,6 +943,7 @@ impl HTMLScriptElement { base_url.clone(), self.id, options, + self.line_number, can_gc, ); }, diff --git a/components/script/script_module.rs b/components/script/script_module.rs index c7bced3ecc3..9b8ddb07565 100644 --- a/components/script/script_module.rs +++ b/components/script/script_module.rs @@ -467,13 +467,15 @@ impl ModuleTree { options: ScriptFetchOptions, mut module_script: RustMutableHandleObject, inline: bool, - can_gc: CanGc, + line_number: u64, introduction_type: Option<&'static CStr>, + can_gc: CanGc, ) -> Result<(), RethrowError> { let cx = GlobalScope::get_cx(); let _ac = JSAutoRealm::new(*cx, *global.reflector().get_jsobject()); - let mut compile_options = unsafe { CompileOptionsWrapper::new(*cx, url.as_str(), 1) }; + let mut compile_options = + unsafe { CompileOptionsWrapper::new(*cx, url.as_str(), line_number as u32) }; if let Some(introduction_type) = introduction_type { compile_options.set_introduction_type(introduction_type); } @@ -1341,8 +1343,9 @@ impl FetchResponseListener for ModuleContext { self.options.clone(), compiled_module.handle_mut(), false, - CanGc::note(), + 1, // external scripts start at the first line of the file self.introduction_type, + CanGc::note(), ); match compiled_module_result { @@ -1890,6 +1893,7 @@ pub(crate) fn fetch_inline_module_script( url: ServoUrl, script_id: ScriptId, options: ScriptFetchOptions, + line_number: u64, can_gc: CanGc, ) { let global = owner.global(); @@ -1906,8 +1910,9 @@ pub(crate) fn fetch_inline_module_script( options.clone(), compiled_module.handle_mut(), true, - can_gc, + line_number, Some(IntroductionType::INLINE_SCRIPT), + can_gc, ); match compiled_module_result { diff --git a/tests/wpt/meta/MANIFEST.json b/tests/wpt/meta/MANIFEST.json index af2bf5d5d13..fdaeacb08a2 100644 --- a/tests/wpt/meta/MANIFEST.json +++ b/tests/wpt/meta/MANIFEST.json @@ -758650,6 +758650,13 @@ {} ] ], + "evaluation-error-5.html": [ + "3021ecd4a9f9c68a5632c43d1253e4938debf994", + [ + null, + {} + ] + ], "execorder.html": [ "6a7513dc1361de0716584df8a5e7c8b3df2b69f3", [ diff --git a/tests/wpt/tests/html/semantics/scripting-1/the-script-element/module/evaluation-error-5.html b/tests/wpt/tests/html/semantics/scripting-1/the-script-element/module/evaluation-error-5.html new file mode 100644 index 00000000000..3021ecd4a9f --- /dev/null +++ b/tests/wpt/tests/html/semantics/scripting-1/the-script-element/module/evaluation-error-5.html @@ -0,0 +1,16 @@ + +