Bug 623134: Add HTTP logging to track down the intermittent request timeouts. r=robstrong

This commit is contained in:
Dave Townsend 2011-05-16 11:46:55 -07:00
parent d1bac4c182
commit 37399c2be0
2 changed files with 33 additions and 10 deletions

View File

@ -440,16 +440,21 @@ function UpdateParser(aId, aType, aUpdateKey, aUrl, aObserver) {
}
LOG("Requesting " + aUrl);
this.request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
createInstance(Ci.nsIXMLHttpRequest);
this.request.open("GET", aUrl, true);
this.request.channel.notificationCallbacks = new BadCertHandler(!requireBuiltIn);
this.request.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
this.request.overrideMimeType("text/xml");
var self = this;
this.request.onload = function(event) { self.onLoad() };
this.request.onerror = function(event) { self.onError() };
this.request.send(null);
try {
this.request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
createInstance(Ci.nsIXMLHttpRequest);
this.request.open("GET", aUrl, true);
this.request.channel.notificationCallbacks = new BadCertHandler(!requireBuiltIn);
this.request.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
this.request.overrideMimeType("text/xml");
var self = this;
this.request.onload = function(event) { self.onLoad() };
this.request.onerror = function(event) { self.onError() };
this.request.send(null);
}
catch (e) {
ERROR("Failed to request update manifest", e);
}
}
UpdateParser.prototype = {

View File

@ -22,11 +22,29 @@ var gTests = [];
var gStart = 0;
var gLast = 0;
var HTTPObserver = {
observeActivity: function(aChannel, aType, aSubtype, aTimestamp, aSizeData,
aStringData) {
aChannel.QueryInterface(Ci.nsIChannel);
dump("*** HTTP Activity 0x" + aType.toString(16) + " 0x" + aSubtype.toString(16) +
" " + aChannel.URI.spec + "\n");
}
};
function test() {
gStart = Date.now();
requestLongerTimeout(4);
waitForExplicitFinish();
let observerService = Cc["@mozilla.org/network/http-activity-distributor;1"].
getService(Ci.nsIHttpActivityDistributor);
observerService.addObserver(HTTPObserver);
registerCleanupFunction(function() {
observerService.removeObserver(HTTPObserver);
});
run_next_test();
}