Bug 594329: Software Installation dialog reports wrong number of items to be installed. r=dtownsend, a=blocking-final
authorDanny Moules <opensource@rushyo.com>
Mon, 13 Sep 2010 11:47:07 -0700
changeset 53713 33405969cb629369735b5c6269f8c6c5ae67ce2b
parent 53712 6e12dfb03f56a7e538f00aa2be41a59dec5a0fc1
child 53714 7060ac6871d161c7afca3fb770a561952d752fb6
push id15681
push userdtownsend@mozilla.com
push dateMon, 13 Sep 2010 19:55:54 +0000
treeherdermozilla-central@33405969cb62 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdtownsend, blocking-final
bugs594329
milestone2.0b6pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 594329: Software Installation dialog reports wrong number of items to be installed. r=dtownsend, a=blocking-final
toolkit/mozapps/extensions/test/xpinstall/browser_signed_multiple.js
toolkit/mozapps/xpinstall/content/xpinstallConfirm.js
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_signed_multiple.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_signed_multiple.js
@@ -8,32 +8,45 @@ function test() {
   Harness.setup();
 
   var pm = Services.perms;
   pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
 
   var triggers = encodeURIComponent(JSON.stringify({
     "Signed XPI": TESTROOT + "signed.xpi",
     "Signed XPI 2": TESTROOT + "signed2.xpi",
+    "Signed XPI 3": TESTROOT + "signed-no-o.xpi",
+    "Signed XPI 4": TESTROOT + "signed-no-cn.xpi",
+    "Signed XPI 5": TESTROOT + "unsigned.xpi"
   }));
   gBrowser.selectedTab = gBrowser.addTab();
   gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
 }
 
 function get_item(items, url) {
   for (let i = 0; i < items.length; i++) {
     if (items[i].url == url)
       return items[i];
   }
   ok(false, "Item for " + url + " was not listed");
 }
 
 function confirm_install(window) {
+
+  var sbs = Components.classes["@mozilla.org/intl/stringbundle;1"].
+                       getService(Components.interfaces.nsIStringBundleService);
+  var bundle = sbs.createBundle("chrome://mozapps/locale/xpinstall/xpinstallConfirm.properties");
+
+  var expectedIntroString = bundle.formatStringFromName("itemWarnIntroMultiple", ["5"], 1);
+  
+  var introStringNode = window.document.getElementById("itemWarningIntro");
+  is(introStringNode.textContent, expectedIntroString, "Should have the correct intro string");
+
   items = window.document.getElementById("itemList").childNodes;
-  is(items.length, 2, "Should be 2 items listed in the confirmation dialog");
+  is(items.length, 5, "Should be 5 items listed in the confirmation dialog");
   let item = get_item(items, TESTROOT + "signed.xpi");
   if (item) {
     is(item.name, "Signed XPI Test", "Should have seen the name from the trigger list");
     is(item.cert, "(Object Signer)", "Should have seen the signer");
     is(item.signed, "true", "Should have listed the item as signed");
   }
   item = get_item(items, TESTROOT + "signed2.xpi");
   if (item) {
@@ -44,15 +57,15 @@ function confirm_install(window) {
   return true;
 }
 
 function install_ended(install, addon) {
   install.cancel();
 }
 
 function finish_test(count) {
-  is(count, 2, "2 Add-ons should have been successfully installed");
+  is(count, 5, "5 Add-ons should have been successfully installed");
 
   Services.perms.remove("example.com", "install");
 
   gBrowser.removeCurrentTab();
   Harness.finish();
 }
--- a/toolkit/mozapps/xpinstall/content/xpinstallConfirm.js
+++ b/toolkit/mozapps/xpinstall/content/xpinstallConfirm.js
@@ -79,17 +79,17 @@ XPInstallConfirm.init = function ()
     else {
       installItem.cert = bundle.getString("unverified");
     }
     installItem.signed = args.installs[i].certName ? "true" : "false";
   }
   
   var introString = bundle.getString("itemWarnIntroSingle");
   if (numItemsToInstall > 4)
-    introString = bundle.getFormattedString("itemWarnIntroMultiple", [numItemsToInstall / 4]);
+    introString = bundle.getFormattedString("itemWarnIntroMultiple", [numItemsToInstall]);
   var textNode = document.createTextNode(introString);
   var introNode = document.getElementById("itemWarningIntro");
   while (introNode.hasChildNodes())
     introNode.removeChild(introNode.firstChild);
   introNode.appendChild(textNode);
   
   var okButton = document.documentElement.getButton("accept");
   okButton.focus();