зеркало из https://github.com/mozilla/pjs.git
Bug 745507 - test_location.html fails if it is executed alone. r=bent
This commit is contained in:
Родитель
ec9d94ffb6
Коммит
c6905f4587
|
@ -24,7 +24,8 @@ Tests of DOM Worker Location
|
|||
var workerFilename = "location_worker.js";
|
||||
|
||||
var href = window.location.href
|
||||
var baseHref = href.substr(0, href.lastIndexOf("/") + 1);
|
||||
var queryPos = href.lastIndexOf(window.location.search);
|
||||
var baseHref = href.substr(0, href.substr(0, queryPos).lastIndexOf("/") + 1);
|
||||
|
||||
var path = window.location.pathname;
|
||||
var basePath = path.substr(0, path.lastIndexOf("/") + 1);
|
||||
|
@ -40,22 +41,21 @@ Tests of DOM Worker Location
|
|||
"hash": ""
|
||||
};
|
||||
|
||||
var lastSlash = href.lastIndexOf("/") + 1;
|
||||
var lastSlash = href.substr(0, queryPos).lastIndexOf("/") + 1;
|
||||
is(thisFilename,
|
||||
href.substr(lastSlash,
|
||||
href.lastIndexOf(window.location.search) - lastSlash),
|
||||
"Correct filename");
|
||||
href.substr(lastSlash, queryPos - lastSlash),
|
||||
"Correct filename ");
|
||||
|
||||
var worker = new Worker(workerFilename);
|
||||
|
||||
worker.onmessage = function(event) {
|
||||
if (event.data.string == "testfinished") {
|
||||
is(event.data.value, strings["href"]);
|
||||
is(event.data.value, strings["href"], "href");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
ok(event.data.string in strings);
|
||||
is(event.data.value, strings[event.data.string]);
|
||||
ok(event.data.string in strings, event.data.string);
|
||||
is(event.data.value, strings[event.data.string], event.data.string);
|
||||
};
|
||||
|
||||
worker.onerror = function(event) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче