зеркало из https://github.com/mozilla/pjs.git
Bug 525819 - Make do_timeout take a callback function, not a string to eval. r=jwalden
--HG-- extra : rebase_source : 6fbaac51eabe95fcfaf4706feb9fd8a28ba4dfbf
This commit is contained in:
Родитель
200a545f67
Коммит
44d12116b2
|
@ -76,7 +76,7 @@ function run_test() {
|
||||||
// Restore could take some time, usually less than 1s.
|
// Restore could take some time, usually less than 1s.
|
||||||
// We will poll later in continue_test to be sure restore has finished.
|
// We will poll later in continue_test to be sure restore has finished.
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
do_timeout(1000, "continue_test();");
|
do_timeout(1000, continue_test);
|
||||||
}
|
}
|
||||||
|
|
||||||
function continue_test() {
|
function continue_test() {
|
||||||
|
@ -85,7 +85,7 @@ function continue_test() {
|
||||||
|
|
||||||
if (bs.getIdForItemAt(bs.toolbarFolder, 0) == -1) {
|
if (bs.getIdForItemAt(bs.toolbarFolder, 0) == -1) {
|
||||||
// Not enough time to complete restore, poll again later.
|
// Not enough time to complete restore, poll again later.
|
||||||
do_timeout(1000, "continue_test();");
|
do_timeout(1000, continue_test);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ let observer = {
|
||||||
observe: function(aSubject, aTopic, aData) {
|
observe: function(aSubject, aTopic, aData) {
|
||||||
if (aTopic == TOPIC_CUSTOMIZATION_COMPLETE) {
|
if (aTopic == TOPIC_CUSTOMIZATION_COMPLETE) {
|
||||||
os.removeObserver(this, TOPIC_CUSTOMIZATION_COMPLETE);
|
os.removeObserver(this, TOPIC_CUSTOMIZATION_COMPLETE);
|
||||||
do_timeout(0, "continue_test();");
|
do_timeout(0, continue_test);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ function run_test() {
|
||||||
// Import could take some time, usually less than 1s, but to be sure we will
|
// Import could take some time, usually less than 1s, but to be sure we will
|
||||||
// check after 3s.
|
// check after 3s.
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
do_timeout(3000, "continue_test();");
|
do_timeout(3000, continue_test);
|
||||||
}
|
}
|
||||||
|
|
||||||
function continue_test() {
|
function continue_test() {
|
||||||
|
|
|
@ -71,7 +71,7 @@ function run_test() {
|
||||||
// Restore could take some time, usually less than 1s.
|
// Restore could take some time, usually less than 1s.
|
||||||
// We will poll later in continue_test() to be sure restore has finished.
|
// We will poll later in continue_test() to be sure restore has finished.
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
do_timeout(1000, "continue_test();");
|
do_timeout(1000, continue_test);
|
||||||
}
|
}
|
||||||
|
|
||||||
function continue_test() {
|
function continue_test() {
|
||||||
|
@ -80,7 +80,7 @@ function continue_test() {
|
||||||
|
|
||||||
if (bs.getIdForItemAt(bs.toolbarFolder, 0) == -1) {
|
if (bs.getIdForItemAt(bs.toolbarFolder, 0) == -1) {
|
||||||
// Not enough time to complete restore, poll again later.
|
// Not enough time to complete restore, poll again later.
|
||||||
do_timeout(1000, "continue_test();");
|
do_timeout(1000, continue_test);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ function run_test() {
|
||||||
|
|
||||||
// Kick-off tests.
|
// Kick-off tests.
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
do_timeout(0, "run_next_test();");
|
do_timeout(0, run_next_test);
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_next_test() {
|
function run_next_test() {
|
||||||
|
@ -160,7 +160,7 @@ function run_next_test() {
|
||||||
do_check_true(compareJSON(gReferenceJSON, leftPaneJSON));
|
do_check_true(compareJSON(gReferenceJSON, leftPaneJSON));
|
||||||
do_check_eq(PlacesUtils.bookmarks.getItemTitle(gFolderId), "test");
|
do_check_eq(PlacesUtils.bookmarks.getItemTitle(gFolderId), "test");
|
||||||
// Go to next test.
|
// Go to next test.
|
||||||
do_timeout(0, "run_next_test();");
|
do_timeout(0, run_next_test);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// All tests finished.
|
// All tests finished.
|
||||||
|
|
|
@ -58,7 +58,7 @@ var asyncXHR = {
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
do_timeout(0, "run_test_pt1()");
|
do_timeout(0, run_test_pt1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// network offline
|
// network offline
|
||||||
|
|
|
@ -32,15 +32,15 @@ function run_test() {
|
||||||
|
|
||||||
// ... and the first one has
|
// ... and the first one has
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
do_timeout(10, "verifyFirstExpiration();");
|
do_timeout(10, verifyFirstExpiration);
|
||||||
|
|
||||||
// ... and that the short-term one will
|
// ... and that the short-term one will
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
do_timeout(200, "verifyExpiration();");
|
do_timeout(200, verifyExpiration);
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
do_timeout(300, "end_test();");
|
do_timeout(300, end_test);
|
||||||
}
|
}
|
||||||
|
|
||||||
function verifyFirstExpiration() {
|
function verifyFirstExpiration() {
|
||||||
|
|
|
@ -114,7 +114,7 @@ function run_test() {
|
||||||
do_test_pending(); // for 'cleared' notification
|
do_test_pending(); // for 'cleared' notification
|
||||||
pm.removeAll();
|
pm.removeAll();
|
||||||
|
|
||||||
do_timeout(100, "cleanup();");
|
do_timeout(100, cleanup);
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
|
|
|
@ -121,7 +121,7 @@ function checkValueAndTrigger(request, data, ctx) {
|
||||||
if (index < tests.length - 1) {
|
if (index < tests.length - 1) {
|
||||||
var delay = tests[index++].delay;
|
var delay = tests[index++].delay;
|
||||||
if (delay) {
|
if (delay) {
|
||||||
do_timeout(delay, "triggerNextTest()");
|
do_timeout(delay, triggerNextTest);
|
||||||
} else {
|
} else {
|
||||||
triggerNextTest();
|
triggerNextTest();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ TestListener.prototype.onStartRequest = function(request, context) {
|
||||||
TestListener.prototype.onStopRequest = function(request, context, status) {
|
TestListener.prototype.onStopRequest = function(request, context, status) {
|
||||||
change_content_type();
|
change_content_type();
|
||||||
|
|
||||||
do_timeout(0, "after_channel_closed()");
|
do_timeout(0, after_channel_closed);
|
||||||
}
|
}
|
||||||
|
|
||||||
function after_channel_closed() {
|
function after_channel_closed() {
|
||||||
|
|
|
@ -59,7 +59,7 @@ var copyObserver =
|
||||||
do_check_true(test_source_closed);
|
do_check_true(test_source_closed);
|
||||||
}
|
}
|
||||||
|
|
||||||
do_timeout(0, "do_test();");
|
do_timeout(0, do_test);
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: function(aIID)
|
QueryInterface: function(aIID)
|
||||||
|
@ -119,8 +119,9 @@ function do_test() {
|
||||||
pipe1.outputStream.write(test_content, test_content.length);
|
pipe1.outputStream.write(test_content, test_content.length);
|
||||||
pipe1.outputStream.flush();
|
pipe1.outputStream.flush();
|
||||||
do_timeout(20,
|
do_timeout(20,
|
||||||
"copier.cancel(test_result);" +
|
function(){
|
||||||
"pipe1.outputStream.write(\"a\", 1);");
|
copier.cancel(test_result);
|
||||||
|
pipe1.outputStream.write("a", 1);});
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
case 6: // close sink
|
case 6: // close sink
|
||||||
|
@ -156,10 +157,12 @@ function do_test() {
|
||||||
// we will close the sink
|
// we will close the sink
|
||||||
test_sink_closed = true;
|
test_sink_closed = true;
|
||||||
do_timeout(20,
|
do_timeout(20,
|
||||||
"pipe2.outputStream" +
|
function()
|
||||||
" .QueryInterface(Ci.nsIAsyncOutputStream)" +
|
{
|
||||||
" .closeWithStatus(test_result);" +
|
pipe2.outputStream
|
||||||
"pipe1.outputStream.write(\"a\", 1);");
|
.QueryInterface(Ci.nsIAsyncOutputStream)
|
||||||
|
.closeWithStatus(test_result);
|
||||||
|
pipe1.outputStream.write("a", 1);});
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
|
@ -169,6 +172,6 @@ function do_test() {
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
test_nr = 0;
|
test_nr = 0;
|
||||||
do_timeout(0, "do_test();");
|
do_timeout(0, do_test);
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ var listener = {
|
||||||
do_check_eq(buffer, "0123456789");
|
do_check_eq(buffer, "0123456789");
|
||||||
do_check_eq(observers_called, results[test_nr]);
|
do_check_eq(observers_called, results[test_nr]);
|
||||||
test_nr++;
|
test_nr++;
|
||||||
do_timeout(0, "do_test();");
|
do_timeout(0, do_test);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ function run_test() {
|
||||||
obs.addObserver(observer, "http-on-examine-merged-response", false);
|
obs.addObserver(observer, "http-on-examine-merged-response", false);
|
||||||
obs.addObserver(observer, "http-on-examine-cached-response", false);
|
obs.addObserver(observer, "http-on-examine-cached-response", false);
|
||||||
|
|
||||||
do_timeout(0, "do_test();");
|
do_timeout(0, do_test);
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ function checkValueAndTrigger(request, data, ctx) {
|
||||||
index++;
|
index++;
|
||||||
// this call happens in onStopRequest from the channel, and opening a
|
// this call happens in onStopRequest from the channel, and opening a
|
||||||
// new channel to the same url here is no good idea... post it instead
|
// new channel to the same url here is no good idea... post it instead
|
||||||
do_timeout(1, "triggerNextTest();");
|
do_timeout(1, triggerNextTest);
|
||||||
} else {
|
} else {
|
||||||
httpserver.stop(do_test_finished);
|
httpserver.stop(do_test_finished);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ Test.prototype = {
|
||||||
do_check_eq(this._isFromCache, this.readFromCache);
|
do_check_eq(this._isFromCache, this.readFromCache);
|
||||||
do_check_eq(gHitServer, this.hitServer);
|
do_check_eq(gHitServer, this.hitServer);
|
||||||
|
|
||||||
do_timeout(0, "run_next_test();");
|
do_timeout(0, run_next_test);
|
||||||
},
|
},
|
||||||
|
|
||||||
run: function() {
|
run: function() {
|
||||||
|
|
|
@ -77,7 +77,7 @@ var listener = {
|
||||||
// Once onStopRequest is reached, the channel is marked as having been
|
// Once onStopRequest is reached, the channel is marked as having been
|
||||||
// opened
|
// opened
|
||||||
check_async_open_throws(NS_ERROR_ALREADY_OPENED);
|
check_async_open_throws(NS_ERROR_ALREADY_OPENED);
|
||||||
do_timeout(0, "after_channel_closed()");
|
do_timeout(0, after_channel_closed);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -49,5 +49,5 @@ function run_test() {
|
||||||
do_check_true(true);
|
do_check_true(true);
|
||||||
|
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
do_timeout(100, "do_test_finished();");
|
do_timeout(100, do_test_finished);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,13 +75,11 @@ if ("@mozilla.org/toolkit/crash-reporter;1" in Components.classes) {
|
||||||
|
|
||||||
|
|
||||||
function _TimerCallback(expr, timer) {
|
function _TimerCallback(expr, timer) {
|
||||||
this._expr = expr;
|
this._func = expr;
|
||||||
// Keep timer alive until it fires
|
// Keep timer alive until it fires
|
||||||
_pendingCallbacks.push(timer);
|
_pendingCallbacks.push(timer);
|
||||||
}
|
}
|
||||||
_TimerCallback.prototype = {
|
_TimerCallback.prototype = {
|
||||||
_expr: "",
|
|
||||||
|
|
||||||
QueryInterface: function(iid) {
|
QueryInterface: function(iid) {
|
||||||
if (iid.Equals(Components.interfaces.nsITimerCallback) ||
|
if (iid.Equals(Components.interfaces.nsITimerCallback) ||
|
||||||
iid.Equals(Components.interfaces.nsISupports))
|
iid.Equals(Components.interfaces.nsISupports))
|
||||||
|
@ -92,7 +90,7 @@ _TimerCallback.prototype = {
|
||||||
|
|
||||||
notify: function(timer) {
|
notify: function(timer) {
|
||||||
_pendingCallbacks.splice(_pendingCallbacks.indexOf(timer), 1);
|
_pendingCallbacks.splice(_pendingCallbacks.indexOf(timer), 1);
|
||||||
eval(this._expr);
|
this._func.call(null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ function checkResult() {
|
||||||
|
|
||||||
// Need to poll RecentDocs value because the SHAddToRecentDocs call
|
// Need to poll RecentDocs value because the SHAddToRecentDocs call
|
||||||
// doesn't update the registry immediately.
|
// doesn't update the registry immediately.
|
||||||
do_timeout(POLL_REGISTRY_TIMEOUT, "pollRecentDocs();");
|
do_timeout(POLL_REGISTRY_TIMEOUT, pollRecentDocs);
|
||||||
}
|
}
|
||||||
|
|
||||||
var gPollsCount = 0;
|
var gPollsCount = 0;
|
||||||
|
@ -74,7 +74,7 @@ function pollRecentDocs() {
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
do_timeout(POLL_REGISTRY_TIMEOUT, "pollRecentDocs();");
|
do_timeout(POLL_REGISTRY_TIMEOUT, pollRecentDocs);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkRecentDocsFor(aFileName) {
|
function checkRecentDocsFor(aFileName) {
|
||||||
|
|
|
@ -63,7 +63,7 @@ function run_test() {
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
|
|
||||||
gItemId1 = bmsvc.insertBookmark(gTestRoot, gURI, bmsvc.DEFAULT_INDEX, "");
|
gItemId1 = bmsvc.insertBookmark(gTestRoot, gURI, bmsvc.DEFAULT_INDEX, "");
|
||||||
do_timeout(100, "phase2();");
|
do_timeout(100, phase2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function phase2() {
|
function phase2() {
|
||||||
|
@ -71,7 +71,7 @@ function phase2() {
|
||||||
var b = bmsvc.getBookmarkIdsForURI(gURI);
|
var b = bmsvc.getBookmarkIdsForURI(gURI);
|
||||||
do_check_eq(b[0], gItemId2);
|
do_check_eq(b[0], gItemId2);
|
||||||
do_check_eq(b[1], gItemId1);
|
do_check_eq(b[1], gItemId1);
|
||||||
do_timeout(100, "phase3();");
|
do_timeout(100, phase3);
|
||||||
}
|
}
|
||||||
|
|
||||||
function phase3() {
|
function phase3() {
|
||||||
|
|
|
@ -97,7 +97,7 @@ var observer = {
|
||||||
|
|
||||||
// The database connection will be closed after this sync, but we can't
|
// The database connection will be closed after this sync, but we can't
|
||||||
// know how much time it will take, so we use a polling strategy.
|
// know how much time it will take, so we use a polling strategy.
|
||||||
do_timeout(POLLING_TIMEOUT_MS, "check_results();");
|
do_timeout(POLLING_TIMEOUT_MS, check_results);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ function check_results() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hs.QueryInterface(Ci.nsPIPlacesDatabase).DBConnection.connectionReady) {
|
if (hs.QueryInterface(Ci.nsPIPlacesDatabase).DBConnection.connectionReady) {
|
||||||
do_timeout(POLLING_TIMEOUT_MS, "check_results();");
|
do_timeout(POLLING_TIMEOUT_MS, check_results);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ function run_test() {
|
||||||
ghist.addURI(testURI, false, true, null);
|
ghist.addURI(testURI, false, true, null);
|
||||||
ghist.addURI(testURI, false, true, testURI);
|
ghist.addURI(testURI, false, true, testURI);
|
||||||
// lazy message timer is 3000, see LAZY_MESSAGE_TIMEOUT
|
// lazy message timer is 3000, see LAZY_MESSAGE_TIMEOUT
|
||||||
do_timeout(3500, "confirm_results();");
|
do_timeout(3500, confirm_results);
|
||||||
}
|
}
|
||||||
|
|
||||||
function confirm_results() {
|
function confirm_results() {
|
||||||
|
|
|
@ -124,7 +124,7 @@ function run_test() {
|
||||||
|
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
// lazy timeout is 3s and favicons are lazy added
|
// lazy timeout is 3s and favicons are lazy added
|
||||||
do_timeout(3500, "end_test();");
|
do_timeout(3500, end_test);
|
||||||
}
|
}
|
||||||
|
|
||||||
function end_test() {
|
function end_test() {
|
||||||
|
|
|
@ -77,5 +77,5 @@ function run_test() {
|
||||||
bs.DEFAULT_INDEX, "bookmark");
|
bs.DEFAULT_INDEX, "bookmark");
|
||||||
|
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
do_timeout(1000, "verify();");
|
do_timeout(1000, verify);
|
||||||
}
|
}
|
||||||
|
|
|
@ -527,7 +527,7 @@ function startExpireNeither() {
|
||||||
// Changing expiration preferences triggers partial expiration.
|
// Changing expiration preferences triggers partial expiration.
|
||||||
|
|
||||||
// Check results.
|
// Check results.
|
||||||
do_timeout(600, "checkExpireNeither();");
|
do_timeout(600, checkExpireNeither);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkExpireNeither() {
|
function checkExpireNeither() {
|
||||||
|
@ -588,7 +588,7 @@ function startExpireDaysOnly() {
|
||||||
// Changing expiration preferences triggers partial expiration.
|
// Changing expiration preferences triggers partial expiration.
|
||||||
|
|
||||||
// Check results.
|
// Check results.
|
||||||
do_timeout(600, "checkExpireDaysOnly();");
|
do_timeout(600, checkExpireDaysOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkExpireDaysOnly() {
|
function checkExpireDaysOnly() {
|
||||||
|
@ -658,7 +658,7 @@ function startExpireBoth() {
|
||||||
// Changing expiration preferences triggers partial expiration.
|
// Changing expiration preferences triggers partial expiration.
|
||||||
|
|
||||||
// Check results.
|
// Check results.
|
||||||
do_timeout(600, "checkExpireBoth();"); // incremental expiration timer is 3500
|
do_timeout(600, checkExpireBoth); // incremental expiration timer is 3500
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkExpireBoth() {
|
function checkExpireBoth() {
|
||||||
|
@ -716,7 +716,7 @@ function startExpireNeitherOver() {
|
||||||
// Changing expiration preferences triggers partial expiration.
|
// Changing expiration preferences triggers partial expiration.
|
||||||
|
|
||||||
// Check results.
|
// Check results.
|
||||||
do_timeout(600, "checkExpireNeitherOver();");
|
do_timeout(600, checkExpireNeitherOver);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkExpireNeitherOver() {
|
function checkExpireNeitherOver() {
|
||||||
|
@ -765,7 +765,7 @@ function startExpireHistoryDisabled() {
|
||||||
// Changing expiration preferences triggers partial expiration.
|
// Changing expiration preferences triggers partial expiration.
|
||||||
|
|
||||||
// Check results.
|
// Check results.
|
||||||
do_timeout(600, "checkExpireHistoryDisabled();");
|
do_timeout(600, checkExpireHistoryDisabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkExpireHistoryDisabled() {
|
function checkExpireHistoryDisabled() {
|
||||||
|
@ -817,7 +817,7 @@ function startExpireBadPrefs() {
|
||||||
// Changing expiration preferences triggers partial expiration.
|
// Changing expiration preferences triggers partial expiration.
|
||||||
|
|
||||||
// Check results.
|
// Check results.
|
||||||
do_timeout(600, "checkExpireBadPrefs();");
|
do_timeout(600, checkExpireBadPrefs);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkExpireBadPrefs() {
|
function checkExpireBadPrefs() {
|
||||||
|
|
|
@ -77,5 +77,5 @@ function run_test() {
|
||||||
hs.TRANSITION_TYPED, false, 0);
|
hs.TRANSITION_TYPED, false, 0);
|
||||||
|
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
do_timeout(1000, "verify();");
|
do_timeout(1000, verify);
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ function run_test()
|
||||||
// test too soon the timestamp will be the same! So, we'll wait a short
|
// test too soon the timestamp will be the same! So, we'll wait a short
|
||||||
// period of time to make sure the timestamp will differ.
|
// period of time to make sure the timestamp will differ.
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
do_timeout(50, "delayed_test()");
|
do_timeout(50, delayed_test);
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw "FAILED in test #" + testnum + " -- " + e;
|
throw "FAILED in test #" + testnum + " -- " + e;
|
||||||
|
|
|
@ -362,7 +362,7 @@ function run_test() {
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
|
|
||||||
// Give time for phone home to complete.
|
// Give time for phone home to complete.
|
||||||
do_timeout(DELAY, "run_test_pt2()");
|
do_timeout(DELAY, run_test_pt2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -437,7 +437,7 @@ var WindowWatcher = {
|
||||||
gNewBlocks.push(list[i].name + " " + list[i].version);
|
gNewBlocks.push(list[i].name + " " + list[i].version);
|
||||||
|
|
||||||
// Call the callback after the blocklist has finished up
|
// Call the callback after the blocklist has finished up
|
||||||
do_timeout(0, "gCallback()");
|
do_timeout(0, gCallback);
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: function(iid) {
|
QueryInterface: function(iid) {
|
||||||
|
|
|
@ -174,7 +174,7 @@ var WindowWatcher = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call the next test after the blocklist has finished up
|
// Call the next test after the blocklist has finished up
|
||||||
do_timeout(0, "gTestCheck()");
|
do_timeout(0, gTestCheck);
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: function(iid) {
|
QueryInterface: function(iid) {
|
||||||
|
|
|
@ -107,7 +107,7 @@ var WindowWatcher = {
|
||||||
do_check_neq(item.name, "test_bug514327_outdated");
|
do_check_neq(item.name, "test_bug514327_outdated");
|
||||||
|
|
||||||
// Call the next test after the blocklist has finished up
|
// Call the next test after the blocklist has finished up
|
||||||
do_timeout(0, "gNextTestPart()");
|
do_timeout(0, gNextTestPart);
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: function(iid) {
|
QueryInterface: function(iid) {
|
||||||
|
|
|
@ -603,7 +603,7 @@ xhr.prototype = {
|
||||||
responseXML: null,
|
responseXML: null,
|
||||||
responseText: null,
|
responseText: null,
|
||||||
send: function(body) {
|
send: function(body) {
|
||||||
do_timeout(0, "gXHRCallback()"); // Use a timeout so the XHR completes
|
do_timeout(0, gXHRCallback); // Use a timeout so the XHR completes
|
||||||
},
|
},
|
||||||
_onprogress: null,
|
_onprogress: null,
|
||||||
set onprogress(val) { gXHR._onprogress = val; },
|
set onprogress(val) { gXHR._onprogress = val; },
|
||||||
|
@ -656,7 +656,7 @@ const updateCheckListener = {
|
||||||
"update.statusText = " + request.statusText + ", " +
|
"update.statusText = " + request.statusText + ", " +
|
||||||
"updateCount = " + updateCount + "\n");
|
"updateCount = " + updateCount + "\n");
|
||||||
// Use a timeout to allow the XHR to complete
|
// Use a timeout to allow the XHR to complete
|
||||||
do_timeout(0, "gCheckFunc()");
|
do_timeout(0, gCheckFunc);
|
||||||
},
|
},
|
||||||
|
|
||||||
onError: function(request, update) {
|
onError: function(request, update) {
|
||||||
|
@ -667,7 +667,7 @@ const updateCheckListener = {
|
||||||
"request.status = " + gStatusCode + ", " +
|
"request.status = " + gStatusCode + ", " +
|
||||||
"update.statusText = " + gStatusText + "\n");
|
"update.statusText = " + gStatusText + "\n");
|
||||||
// Use a timeout to allow the XHR to complete
|
// Use a timeout to allow the XHR to complete
|
||||||
do_timeout(0, "gCheckFunc()");
|
do_timeout(0, gCheckFunc);
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: function(aIID) {
|
QueryInterface: function(aIID) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ function run_test() {
|
||||||
overrideXHR(callHandleEvent);
|
overrideXHR(callHandleEvent);
|
||||||
startAUS();
|
startAUS();
|
||||||
startUpdateChecker();
|
startUpdateChecker();
|
||||||
do_timeout(0, "run_test_pt1()");
|
do_timeout(0, run_test_pt1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function end_test() {
|
function end_test() {
|
||||||
|
|
|
@ -52,7 +52,7 @@ function run_test() {
|
||||||
startUpdateChecker();
|
startUpdateChecker();
|
||||||
// The HTTP server is only used for the mar file downloads which is slow
|
// The HTTP server is only used for the mar file downloads which is slow
|
||||||
start_httpserver(DIR_DATA);
|
start_httpserver(DIR_DATA);
|
||||||
do_timeout(0, "run_test_pt1()");
|
do_timeout(0, run_test_pt1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function end_test() {
|
function end_test() {
|
||||||
|
@ -218,7 +218,7 @@ const downloadListener = {
|
||||||
onStopRequest: function(request, context, status) {
|
onStopRequest: function(request, context, status) {
|
||||||
gStatusResult = status;
|
gStatusResult = status;
|
||||||
// Use a timeout to allow the request to complete
|
// Use a timeout to allow the request to complete
|
||||||
do_timeout(0, "gCheckFunc()");
|
do_timeout(0, gCheckFunc);
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: function(iid) {
|
QueryInterface: function(iid) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ function run_test() {
|
||||||
gAppInfo = AUS_Cc["@mozilla.org/xre/app-info;1"].
|
gAppInfo = AUS_Cc["@mozilla.org/xre/app-info;1"].
|
||||||
getService(AUS_Ci.nsIXULAppInfo).
|
getService(AUS_Ci.nsIXULAppInfo).
|
||||||
QueryInterface(AUS_Ci.nsIXULRuntime);
|
QueryInterface(AUS_Ci.nsIXULRuntime);
|
||||||
do_timeout(0, "run_test_pt1()");
|
do_timeout(0, run_test_pt1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function end_test() {
|
function end_test() {
|
||||||
|
|
|
@ -56,7 +56,7 @@ function run_test() {
|
||||||
getPrefBranch().setCharPref(PREF_APP_UPDATE_URL_OVERRIDE,
|
getPrefBranch().setCharPref(PREF_APP_UPDATE_URL_OVERRIDE,
|
||||||
URL_HOST + "update.xml");
|
URL_HOST + "update.xml");
|
||||||
overrideXHR(callHandleEvent);
|
overrideXHR(callHandleEvent);
|
||||||
do_timeout(0, "run_test_pt1()");
|
do_timeout(0, run_test_pt1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function end_test() {
|
function end_test() {
|
||||||
|
|
|
@ -72,7 +72,7 @@ function run_test() {
|
||||||
|
|
||||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1.0", "2.0");
|
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1.0", "2.0");
|
||||||
setDefaultPrefs();
|
setDefaultPrefs();
|
||||||
do_timeout(0, "run_test_pt1()");
|
do_timeout(0, run_test_pt1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function end_test() {
|
function end_test() {
|
||||||
|
@ -111,7 +111,7 @@ function run_test_pt1() {
|
||||||
do_check_true(privBrowsing.autoStarted);
|
do_check_true(privBrowsing.autoStarted);
|
||||||
|
|
||||||
// Use a timeout to give private browsing time to reset necko.
|
// Use a timeout to give private browsing time to reset necko.
|
||||||
do_timeout(0, "run_test_pt2()");
|
do_timeout(0, run_test_pt2);
|
||||||
}
|
}
|
||||||
function run_test_pt2() {
|
function run_test_pt2() {
|
||||||
dump("Testing: update count should equal 1\n");
|
dump("Testing: update count should equal 1\n");
|
||||||
|
|
|
@ -161,7 +161,7 @@ function end_test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test1thru6() {
|
function run_test1thru6() {
|
||||||
gNextFunc = "check_test1thru6()";
|
gNextFunc = check_test1thru6;
|
||||||
// bogus default interval
|
// bogus default interval
|
||||||
gCompReg.registerFactory(TESTS[0].classID, TESTS[0].desc,
|
gCompReg.registerFactory(TESTS[0].classID, TESTS[0].desc,
|
||||||
TESTS[0].contractID, gTest1Factory);
|
TESTS[0].contractID, gTest1Factory);
|
||||||
|
@ -271,11 +271,11 @@ function check_test1thru6() {
|
||||||
"registered\n");
|
"registered\n");
|
||||||
do_check_eq(count, 0);
|
do_check_eq(count, 0);
|
||||||
|
|
||||||
do_timeout(0, "run_test7()");
|
do_timeout(0, run_test7());
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test7() {
|
function run_test7() {
|
||||||
gNextFunc = "check_test7()";
|
gNextFunc = check_test7;
|
||||||
gPref.setIntPref(PREF_BRANCH_LAST_UPDATE_TIME + TESTS[6].timerID, 1);
|
gPref.setIntPref(PREF_BRANCH_LAST_UPDATE_TIME + TESTS[6].timerID, 1);
|
||||||
gCompReg.registerFactory(TESTS[6].classID, TESTS[6].desc,
|
gCompReg.registerFactory(TESTS[6].classID, TESTS[6].desc,
|
||||||
TESTS[6].contractID, gTest7Factory);
|
TESTS[6].contractID, gTest7Factory);
|
||||||
|
@ -386,7 +386,7 @@ var gTest6Factory = {
|
||||||
var gTest7TimerCallback = {
|
var gTest7TimerCallback = {
|
||||||
notify: function T7CB_notify(aTimer) {
|
notify: function T7CB_notify(aTimer) {
|
||||||
TESTS[6].notified = true;
|
TESTS[6].notified = true;
|
||||||
do_timeout(0, "check_test7()");
|
do_timeout(0, check_test7);
|
||||||
},
|
},
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
|
||||||
};
|
};
|
||||||
|
|
|
@ -58,7 +58,7 @@ function checkFile() {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Wait a bit longer then try again
|
// Wait a bit longer then try again
|
||||||
do_timeout(1000, "checkFile()");
|
do_timeout(1000, checkFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,5 +155,5 @@ function run_test() {
|
||||||
localHandler.launchWithURI(uri);
|
localHandler.launchWithURI(uri);
|
||||||
|
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
do_timeout(1000, "checkFile()");
|
do_timeout(1000, checkFile);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче