mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Store parser's current line when script elements are created.
Use the newly stored line as the starting line number when evaluating JS. This ensures that inline scripts will report errors with meaningful line numbers.
This commit is contained in:
parent
d1bc1a4f1b
commit
db2082bc6e
11 changed files with 61 additions and 22 deletions
|
@ -1,5 +0,0 @@
|
|||
[window-onerror-parse-error.html]
|
||||
type: testharness
|
||||
[correct line number passed to window.onerror]
|
||||
expected: FAIL
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
[window-onerror-runtime-error.html]
|
||||
type: testharness
|
||||
[correct line number passed to window.onerror]
|
||||
expected: FAIL
|
||||
|
|
@ -15200,6 +15200,12 @@
|
|||
"url": "/_mozilla/mozilla/trace_null.html"
|
||||
}
|
||||
],
|
||||
"mozilla/track_line.html": [
|
||||
{
|
||||
"path": "mozilla/track_line.html",
|
||||
"url": "/_mozilla/mozilla/track_line.html"
|
||||
}
|
||||
],
|
||||
"mozilla/union.html": [
|
||||
{
|
||||
"path": "mozilla/union.html",
|
||||
|
|
17
tests/wpt/mozilla/tests/mozilla/track_line.html
Normal file
17
tests/wpt/mozilla/tests/mozilla/track_line.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Test that errors from inline scripts report meaningful line numbers</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test("error event has proper line number");
|
||||
window.addEventListener('error', t.step_func(function(e) {
|
||||
assert_true(e instanceof ErrorEvent);
|
||||
assert_equals(e.lineno, 16);
|
||||
t.done();
|
||||
}), true);
|
||||
</script>
|
||||
<script>
|
||||
this_is_a_js_error
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue