servo: Merge #15020 - Do not use the script element's line number for external scripts (from jdm:external_script_line); r=Ms2ger

This was yielding incorrect line numbers when looking at JS backtraces in gdb.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] There are tests for these changes

Source-Repo: https://github.com/servo/servo
Source-Revision: ecd1d2dbc9a94c88c718cb311603d35a4f667356
This commit is contained in:
Josh Matthews 2017-01-16 11:11:46 -08:00
Родитель 57f96ae1b3
Коммит 7c098e953e
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -500,9 +500,10 @@ impl HTMLScriptElement {
// Step 5.a.2. // Step 5.a.2.
let window = window_from_node(self); let window = window_from_node(self);
let line_number = if script.external { 1 } else { self.line_number as u32 };
rooted!(in(window.get_cx()) let mut rval = UndefinedValue()); rooted!(in(window.get_cx()) let mut rval = UndefinedValue());
window.upcast::<GlobalScope>().evaluate_script_on_global_with_result( window.upcast::<GlobalScope>().evaluate_script_on_global_with_result(
&script.text, script.url.as_str(), rval.handle_mut(), self.line_number as u32); &script.text, script.url.as_str(), rval.handle_mut(), line_number);
// Step 6. // Step 6.
document.set_current_script(old_script.r()); document.set_current_script(old_script.r());