OLD | NEW |
1 /*global self*/ | 1 /*global self*/ |
2 /*jshint latedef: nofunc*/ | 2 /*jshint latedef: nofunc*/ |
3 /* | 3 /* |
4 Distributed under both the W3C Test Suite License [1] and the W3C | 4 Distributed under both the W3C Test Suite License [1] and the W3C |
5 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the | 5 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the |
6 policies and contribution forms [3]. | 6 policies and contribution forms [3]. |
7 | 7 |
8 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license | 8 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license |
9 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license | 9 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license |
10 [3] http://www.w3.org/2004/10/27-testcases | 10 [3] http://www.w3.org/2004/10/27-testcases |
(...skipping 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2459 stack = e.stack; | 2459 stack = e.stack; |
2460 } | 2460 } |
2461 } | 2461 } |
2462 | 2462 |
2463 var lines = stack.split("\n"); | 2463 var lines = stack.split("\n"); |
2464 | 2464 |
2465 // Create a pattern to match stack frames originating within testharness
.js. These include the | 2465 // Create a pattern to match stack frames originating within testharness
.js. These include the |
2466 // script URL, followed by the line/col (e.g., '/resources/testharness.j
s:120:21'). | 2466 // script URL, followed by the line/col (e.g., '/resources/testharness.j
s:120:21'). |
2467 // Escape the URL per http://stackoverflow.com/questions/3561493/is-ther
e-a-regexp-escape-function-in-javascript | 2467 // Escape the URL per http://stackoverflow.com/questions/3561493/is-ther
e-a-regexp-escape-function-in-javascript |
2468 // in case it contains RegExp characters. | 2468 // in case it contains RegExp characters. |
2469 var re = new RegExp((get_script_url().replace(/[-\/\\^$*+?.()|[\]{}]/g,
'\\$&') || "\\btestharness.js") + ":\\d+:\\d+"); | 2469 var script_url = get_script_url(); |
| 2470 var re_text = script_url ? script_url.replace(/[-\/\\^$*+?.()|[\]{}]/g,
'\\$&') : "\\btestharness.js"; |
| 2471 var re = new RegExp(re_text + ":\\d+:\\d+"); |
2470 | 2472 |
2471 // Some browsers include a preamble that specifies the type of the error
object. Skip this by | 2473 // Some browsers include a preamble that specifies the type of the error
object. Skip this by |
2472 // advancing until we find the first stack frame originating from testha
rness.js. | 2474 // advancing until we find the first stack frame originating from testha
rness.js. |
2473 var i = 0; | 2475 var i = 0; |
2474 while (!re.test(lines[i]) && i < lines.length) { | 2476 while (!re.test(lines[i]) && i < lines.length) { |
2475 i++; | 2477 i++; |
2476 } | 2478 } |
2477 | 2479 |
2478 // Then skip the top frames originating from testharness.js to begin the
stack at the test code. | 2480 // Then skip the top frames originating from testharness.js to begin the
stack at the test code. |
2479 while (re.test(lines[i]) && i < lines.length) { | 2481 while (re.test(lines[i]) && i < lines.length) { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2668 tests.status.status = tests.status.ERROR; | 2670 tests.status.status = tests.status.ERROR; |
2669 tests.status.message = e.message; | 2671 tests.status.message = e.message; |
2670 tests.status.stack = e.stack; | 2672 tests.status.stack = e.stack; |
2671 } | 2673 } |
2672 }); | 2674 }); |
2673 | 2675 |
2674 test_environment.on_tests_ready(); | 2676 test_environment.on_tests_ready(); |
2675 | 2677 |
2676 })(); | 2678 })(); |
2677 // vim: set expandtab shiftwidth=4 tabstop=4: | 2679 // vim: set expandtab shiftwidth=4 tabstop=4: |
OLD | NEW |