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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 case Node.DOCUMENT_FRAGMENT_NODE: | 823 case Node.DOCUMENT_FRAGMENT_NODE: |
824 return "DocumentFragment node with " + val.childNodes.length
+ (val.childNodes.length == 1 ? " child" : " children"); | 824 return "DocumentFragment node with " + val.childNodes.length
+ (val.childNodes.length == 1 ? " child" : " children"); |
825 default: | 825 default: |
826 return "Node object of unknown type"; | 826 return "Node object of unknown type"; |
827 } | 827 } |
828 } | 828 } |
829 | 829 |
830 /* falls through */ | 830 /* falls through */ |
831 default: | 831 default: |
832 try { | 832 try { |
833 return typeof val + ' "' + truncate(String(val), 60) + '"'; | 833 return typeof val + ' "' + truncate(String(val), 1000) + '"'; |
834 } catch(e) { | 834 } catch(e) { |
835 return ("[stringifying object threw " + String(e) + | 835 return ("[stringifying object threw " + String(e) + |
836 " with type " + String(typeof e) + "]"); | 836 " with type " + String(typeof e) + "]"); |
837 } | 837 } |
838 } | 838 } |
839 } | 839 } |
840 expose(format_value, "format_value"); | 840 expose(format_value, "format_value"); |
841 | 841 |
842 /* | 842 /* |
843 * Assertions | 843 * Assertions |
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2457 throw new Error(); | 2457 throw new Error(); |
2458 } catch (e) { | 2458 } catch (e) { |
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 var re = new RegExp((get_script_url() || "\\btestharness.js") + ":\\d+:\
\d+"); | 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. |
| 2469 var re = new RegExp((get_script_url().replace(/[-\/\\^$*+?.()|[\]{}]/g,
'\\$&') || "\\btestharness.js") + ":\\d+:\\d+"); |
2468 | 2470 |
2469 // Some browsers include a preamble that specifies the type of the error
object. Skip this by | 2471 // Some browsers include a preamble that specifies the type of the error
object. Skip this by |
2470 // advancing until we find the first stack frame originating from testha
rness.js. | 2472 // advancing until we find the first stack frame originating from testha
rness.js. |
2471 var i = 0; | 2473 var i = 0; |
2472 while (!re.test(lines[i]) && i < lines.length) { | 2474 while (!re.test(lines[i]) && i < lines.length) { |
2473 i++; | 2475 i++; |
2474 } | 2476 } |
2475 | 2477 |
2476 // Then skip the top frames originating from testharness.js to begin the
stack at the test code. | 2478 // Then skip the top frames originating from testharness.js to begin the
stack at the test code. |
2477 while (re.test(lines[i]) && i < lines.length) { | 2479 while (re.test(lines[i]) && i < lines.length) { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2666 tests.status.status = tests.status.ERROR; | 2668 tests.status.status = tests.status.ERROR; |
2667 tests.status.message = e.message; | 2669 tests.status.message = e.message; |
2668 tests.status.stack = e.stack; | 2670 tests.status.stack = e.stack; |
2669 } | 2671 } |
2670 }); | 2672 }); |
2671 | 2673 |
2672 test_environment.on_tests_ready(); | 2674 test_environment.on_tests_ready(); |
2673 | 2675 |
2674 })(); | 2676 })(); |
2675 // vim: set expandtab shiftwidth=4 tabstop=4: | 2677 // vim: set expandtab shiftwidth=4 tabstop=4: |
OLD | NEW |