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

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

Issue 2446483002: Import wpt@c5a14f553cba5f197743b9af605a84eddd8692a2 (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/LayoutTests/resources/idlharness.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 1240
1241 EncodingError: 0, 1241 EncodingError: 0,
1242 NotReadableError: 0, 1242 NotReadableError: 0,
1243 UnknownError: 0, 1243 UnknownError: 0,
1244 ConstraintError: 0, 1244 ConstraintError: 0,
1245 DataError: 0, 1245 DataError: 0,
1246 TransactionInactiveError: 0, 1246 TransactionInactiveError: 0,
1247 ReadOnlyError: 0, 1247 ReadOnlyError: 0,
1248 VersionError: 0, 1248 VersionError: 0,
1249 OperationError: 0, 1249 OperationError: 0,
1250 NotAllowedError: 0
1250 }; 1251 };
1251 1252
1252 if (!(name in name_code_map)) { 1253 if (!(name in name_code_map)) {
1253 throw new AssertionError('Test bug: unrecognized DOMException co de "' + code + '" passed to assert_throws()'); 1254 throw new AssertionError('Test bug: unrecognized DOMException co de "' + code + '" passed to assert_throws()');
1254 } 1255 }
1255 1256
1256 var required_props = { code: name_code_map[name] }; 1257 var required_props = { code: name_code_map[name] };
1257 1258
1258 if (required_props.code === 0 || 1259 if (required_props.code === 0 ||
1259 (typeof e == "object" && 1260 (typeof e == "object" &&
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 var stack = new Error().stack; 2457 var stack = new Error().stack;
2457 // IE11 does not initialize 'Error.stack' until the object is thrown. 2458 // IE11 does not initialize 'Error.stack' until the object is thrown.
2458 if (!stack) { 2459 if (!stack) {
2459 try { 2460 try {
2460 throw new Error(); 2461 throw new Error();
2461 } catch (e) { 2462 } catch (e) {
2462 stack = e.stack; 2463 stack = e.stack;
2463 } 2464 }
2464 } 2465 }
2465 2466
2467 // 'Error.stack' is not supported in all browsers/versions
2468 if (!stack) {
2469 return "(Stack trace unavailable)";
2470 }
2471
2466 var lines = stack.split("\n"); 2472 var lines = stack.split("\n");
2467 2473
2468 // Create a pattern to match stack frames originating within testharness .js. These include the 2474 // Create a pattern to match stack frames originating within testharness .js. These include the
2469 // script URL, followed by the line/col (e.g., '/resources/testharness.j s:120:21'). 2475 // script URL, followed by the line/col (e.g., '/resources/testharness.j s:120:21').
2470 // Escape the URL per http://stackoverflow.com/questions/3561493/is-ther e-a-regexp-escape-function-in-javascript 2476 // Escape the URL per http://stackoverflow.com/questions/3561493/is-ther e-a-regexp-escape-function-in-javascript
2471 // in case it contains RegExp characters. 2477 // in case it contains RegExp characters.
2472 var script_url = get_script_url(); 2478 var script_url = get_script_url();
2473 var re_text = script_url ? script_url.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') : "\\btestharness.js"; 2479 var re_text = script_url ? script_url.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') : "\\btestharness.js";
2474 var re = new RegExp(re_text + ":\\d+:\\d+"); 2480 var re = new RegExp(re_text + ":\\d+:\\d+");
2475 2481
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
2673 tests.status.status = tests.status.ERROR; 2679 tests.status.status = tests.status.ERROR;
2674 tests.status.message = e.message; 2680 tests.status.message = e.message;
2675 tests.status.stack = e.stack; 2681 tests.status.stack = e.stack;
2676 } 2682 }
2677 }); 2683 });
2678 2684
2679 test_environment.on_tests_ready(); 2685 test_environment.on_tests_ready();
2680 2686
2681 })(); 2687 })();
2682 // vim: set expandtab shiftwidth=4 tabstop=4: 2688 // vim: set expandtab shiftwidth=4 tabstop=4:
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/resources/idlharness.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698