Bug 687332: Fix up update tests.

This commit is contained in:
Kyle Huey 2011-09-29 12:06:36 -04:00
parent 982b07a86e
commit bb038e3359
8 changed files with 12 additions and 9 deletions

View File

@ -79,12 +79,12 @@ function run_test() {
.createInstance(Components.interfaces.nsIXMLHttpRequest);
request.open("GET", redirectURL, true);
request.setRequestHeader("X-Custom-Header", "present");
request.onreadystatechange = function() {
request.addEventListener("readystatechange", function() {
if (request.readyState == 4) {
do_check_eq(request.status, 200);
server.stop(do_test_finished);
}
};
}, false);
request.send();
try {
request.setRequestHeader("X-Unwanted-Header", "present");

View File

@ -46,7 +46,7 @@ var asyncXHR = {
request.open("GET", "http://localhost:4444/test_error_code.xml", true);
var self = this;
request.onerror = function(event) { self.onError(event); };
request.addEventListener("error", function(event) { self.onError(event); }, false);
request.send(null);
},
onError: function doAsyncRequest_onError(event) {

View File

@ -38,10 +38,10 @@ function run_test()
// Test async XHR sending
let async = createXHR(true);
async.onreadystatechange = function(event) {
async.addEventListener("readystatechange", function(event) {
if (checkResults(async))
httpserver.stop(do_test_finished);
};
}, false);
async.send(null);
do_test_pending();
}

View File

@ -1007,6 +1007,9 @@ xhr.prototype = {
_onload: null,
set onload(val) { gXHR._onload = makeHandler(val); },
get onload() { return gXHR._onload; },
addEventListener: function(event, val, capturing) {
eval("gXHR._on" + event + " = val");
},
flags: AUS_Ci.nsIClassInfo.SINGLETON,
implementationLanguage: AUS_Ci.nsIProgrammingLanguage.JAVASCRIPT,
getHelperForLanguage: function(language) null,

View File

@ -87,7 +87,7 @@ function callHandleEvent() {
gXHR.responseXML = null;
}
var e = { target: gXHR };
gXHR.onload.handleEvent(e);
gXHR.onload(e);
}
// update xml not found

View File

@ -77,7 +77,7 @@ function callHandleEvent() {
catch(e) {
}
var e = { target: gXHR };
gXHR.onload.handleEvent(e);
gXHR.onload(e);
}
// Helper function for testing mar downloads that have the correct size

View File

@ -63,7 +63,7 @@ function end_test() {
// call the nsIDOMEventListener's handleEvent method for onload.
function callHandleEvent() {
var e = { target: gXHR };
gXHR.onload.handleEvent(e);
gXHR.onload(e);
}
// Helper function for parsing the result from the contructed url

View File

@ -68,7 +68,7 @@ function end_test() {
function callHandleEvent() {
gXHR.status = gExpectedStatusCode;
var e = { target: gXHR };
gXHR.onload.handleEvent(e);
gXHR.onload(e);
}
// Helper functions for testing nsIUpdateCheckListener statusText