Auto merge of #14963 - jdm:script_current_line, r=asajeffrey

Report meaningful line numbers for inline script errors

Rebased from #14661.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #12744 and partially #9604
- [X] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14963)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-01-11 18:11:52 -08:00 committed by GitHub
commit eb72c0ec7b
11 changed files with 61 additions and 22 deletions

View file

@ -1,5 +0,0 @@
[window-onerror-parse-error.html]
type: testharness
[correct line number passed to window.onerror]
expected: FAIL

View file

@ -1,5 +0,0 @@
[window-onerror-runtime-error.html]
type: testharness
[correct line number passed to window.onerror]
expected: FAIL

View file

@ -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",

View 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>