This commit is contained in:
Dave Townsend 2010-11-11 16:08:48 -08:00
Родитель d334032385
Коммит 2da9f3859b
3 изменённых файлов: 2 добавлений и 52 удалений

Просмотреть файл

@ -5322,8 +5322,6 @@ AddonInstall.prototype = {
this.badCertHandler.asyncOnChannelRedirect(aOldChannel, aNewChannel, aFlags, aCallback);
else
aCallback.onRedirectVerifyCallback(Cr.NS_OK);
this.channel = aNewChannel;
},
/**

Просмотреть файл

@ -157,11 +157,8 @@ Installer.prototype = {
}, this);
}
break;
case AddonManager.STATE_CANCELLED:
// Just ignore cancelled downloads
break;
default:
WARN("Download of " + install.sourceURI.spec + " in unexpected state " +
WARN("Download of " + install.sourceURI + " in unexpected state " +
install.state);
}
}

Просмотреть файл

@ -39,11 +39,6 @@ function run_test() {
testserver = new nsHttpServer();
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.registerPathHandler("/redirect", function(aRequest, aResponse) {
aResponse.setStatusLine(null, 301, "Moved Permanently");
let url = aRequest.host + ":" + aRequest.port + aRequest.queryString;
aResponse.setHeader("Location", "http://" + url);
});
testserver.start(4444);
do_test_pending();
@ -1471,46 +1466,6 @@ function run_test_25() {
ensure_test_completed();
run_test_26();
end_test();
}, "application/x-xpinstall", do_get_addon_hash("test_install3"));
}
function run_test_26() {
prepare_test({ }, [
"onNewInstall",
"onDownloadStarted",
"onDownloadCancelled"
]);
let observerService = AM_Cc["@mozilla.org/network/http-activity-distributor;1"].
getService(AM_Ci.nsIHttpActivityDistributor);
observerService.addObserver({
observeActivity: function(aChannel, aType, aSubtype, aTimestamp, aSizeData,
aStringData) {
aChannel.QueryInterface(AM_Ci.nsIChannel);
// Wait for the final event for the redirected URL
if (aChannel.URI.spec != "http://localhost:4444/addons/test_install1.xpi" ||
aType != AM_Ci.nsIHttpActivityObserver.ACTIVITY_TYPE_HTTP_TRANSACTION ||
aSubtype != AM_Ci.nsIHttpActivityObserver.ACTIVITY_SUBTYPE_TRANSACTION_CLOSE)
return;
// Request should have been cancelled
do_check_eq(aChannel.status, Components.results.NS_BINDING_ABORTED);
observerService.removeObserver(this);
do_test_finished();
}
});
let url = "http://localhost:4444/redirect?/addons/test_install1.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onDownloadProgress: function(aInstall) {
aInstall.cancel();
}
});
aInstall.install();
}, "application/x-xpinstall");
}