From 2da9f3859b73a528de7851259ab7da7515ba60cf Mon Sep 17 00:00:00 2001 From: Dave Townsend Date: Thu, 11 Nov 2010 16:08:48 -0800 Subject: [PATCH] Backing out bug 611076 --- toolkit/mozapps/extensions/XPIProvider.jsm | 2 - .../extensions/amWebInstallListener.js | 5 +- .../extensions/test/xpcshell/test_install.js | 47 +------------------ 3 files changed, 2 insertions(+), 52 deletions(-) diff --git a/toolkit/mozapps/extensions/XPIProvider.jsm b/toolkit/mozapps/extensions/XPIProvider.jsm index 90e327acf20..4ebf8f6758d 100644 --- a/toolkit/mozapps/extensions/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/XPIProvider.jsm @@ -5322,8 +5322,6 @@ AddonInstall.prototype = { this.badCertHandler.asyncOnChannelRedirect(aOldChannel, aNewChannel, aFlags, aCallback); else aCallback.onRedirectVerifyCallback(Cr.NS_OK); - - this.channel = aNewChannel; }, /** diff --git a/toolkit/mozapps/extensions/amWebInstallListener.js b/toolkit/mozapps/extensions/amWebInstallListener.js index 890847126e1..dfa8250f8e5 100644 --- a/toolkit/mozapps/extensions/amWebInstallListener.js +++ b/toolkit/mozapps/extensions/amWebInstallListener.js @@ -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); } } diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_install.js b/toolkit/mozapps/extensions/test/xpcshell/test_install.js index b89d0ca6f37..f2ab70ad35e 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_install.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_install.js @@ -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"); -}