Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/resources/testharness.js

Issue 2020083002: Import wpt@1b61dad2be6c5100beb565e91c58b8c1084b3c7d (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing tests Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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:
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698