mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 687332: Fix up update tests.
This commit is contained in:
parent
982b07a86e
commit
bb038e3359
@ -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");
|
||||
|
@ -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) {
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -87,7 +87,7 @@ function callHandleEvent() {
|
||||
gXHR.responseXML = null;
|
||||
}
|
||||
var e = { target: gXHR };
|
||||
gXHR.onload.handleEvent(e);
|
||||
gXHR.onload(e);
|
||||
}
|
||||
|
||||
// update xml not found
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user