Bug 1440164 - Detect a subtest URL not resolving and give an error message. r=kats

MozReview-Commit-ID: 1LntbmmFwif

--HG--
extra : rebase_source : 5c088cf4094e1d2537bc33664d6983654508c28c
This commit is contained in:
Botond Ballo 2018-02-23 21:55:24 -05:00
Родитель a4974673d4
Коммит 1060e61b5c
1 изменённых файлов: 14 добавлений и 1 удалений

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

@ -232,7 +232,20 @@ function runSubtestsSeriallyInFreshWindows(aSubtests) {
if (test.onload) {
w.addEventListener('load', function(e) { test.onload(w); }, { once: true });
}
w.location = location.href.substring(0, location.href.lastIndexOf('/') + 1) + aFile;
var subtestUrl = location.href.substring(0, location.href.lastIndexOf('/') + 1) + aFile;
function urlResolves(url) {
var request = new XMLHttpRequest();
request.open('GET', url, false);
request.send();
return request.status !== 404;
}
if (!urlResolves(subtestUrl)) {
SimpleTest.ok(false, "Subtest URL " + subtestUrl + " does not resolve. " +
"Be sure it's present in the support-files section of mochitest.ini.");
reject();
return;
}
w.location = subtestUrl;
return w;
}