Bug 1452643 [wpt PR 10286] - Use stable error messages in the link onload event tests by default., a=testonly

Automatic update from web-platform-testsMerge pull request #10286 from bzbarsky/stable-error-messages-for-link-load

Use stable error messages in the link onload event tests by default.

wpt-commits: f527ada08cea94e63a40712062073d6ed37c8526
wpt-pr: 10286
wpt-commits: f527ada08cea94e63a40712062073d6ed37c8526
wpt-pr: 10286
This commit is contained in:
Boris Zbarsky 2018-04-09 21:34:53 +00:00 коммит произвёл James Graham
Родитель 517b92133b
Коммит a226ee98a3
2 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -564471,7 +564471,7 @@
"support"
],
"html/semantics/document-metadata/the-link-element/resources/link-load-error-events.sub.js": [
"0c45045a1db6958751dfe112aa3234ca936263e7",
"1c5d8fe0b94b033b8e6ee7bcf54bd35ba2febd36",
"support"
],
"html/semantics/document-metadata/the-link-element/resources/stylesheet.css": [

Просмотреть файл

@ -7,6 +7,10 @@
* avoids issues around caching of sheets based on URL.
*/
// Our URLs are random, so we don't use them in error messages by
// default, but enable doing it if someone wants to debug things.
const DEBUG_URLS = false;
var isHttps = location.protocol == "https:";
var tests = [
@ -113,12 +117,13 @@ for (var test of tests) {
var t = async_test(description);
var link = document.createElement("link");
link.rel = "stylesheet";
hrefString = DEBUG_URLS ? `: ${href}` : "";
if (success) {
link.onload = t.step_func_done(() => {});
link.onerror = t.step_func_done(() => assert_unreached(`error fired when load expected: ${href}`) );
link.onerror = t.step_func_done(() => assert_unreached(`error fired when load expected${hrefString}`) );
} else {
link.onerror = t.step_func_done(() => {});
link.onload = t.step_func_done(() => assert_unreached(`load fired when error expected: ${href}`) );
link.onload = t.step_func_done(() => assert_unreached(`load fired when error expected${hrefString}`) );
}
link.href = href;
document.head.appendChild(link);