Backed out changeset 4f7f1840152b (Bug 680113) due to orange.
authorJustin Wood <Callek@gmail.com>
Fri, 09 Sep 2011 23:24:27 -0400
changeset 76863 dcfc0272831286a7d5ea9d1b08f27ec53fdc42a4
parent 76859 4f7f1840152b3cc2645c60c9c9a972c287f2a009
child 76864 06b2977afb850d41f5cafc384eb5b8f7b2f13ff6
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
bugs680113
milestone9.0a1
backs out4f7f1840152b3cc2645c60c9c9a972c287f2a009
Backed out changeset 4f7f1840152b (Bug 680113) due to orange.
toolkit/locales/en-US/chrome/mozapps/extensions/selectAddons.properties
toolkit/mozapps/extensions/content/selectAddons.js
toolkit/mozapps/extensions/content/selectAddons.xml
toolkit/mozapps/extensions/content/selectAddons.xul
toolkit/mozapps/extensions/test/browser/browser_select_selection.js
--- a/toolkit/locales/en-US/chrome/mozapps/extensions/selectAddons.properties
+++ b/toolkit/locales/en-US/chrome/mozapps/extensions/selectAddons.properties
@@ -1,15 +1,11 @@
 #LOCALIZATION NOTE (source.profile) add-ons installed by the user, this may be
 # translated as "You" or "User" depending on the locale
 source.profile=You
-#LOCALIZATION NOTE (source.bundled) add-ons shipped with the application, and thus
-# treated as installed by the user. This may be
-# translated as "You" or "User" depending on the locale
-source.bundled=You (Bundled)
 #LOCALIZATION NOTE (source.other) add-ons installed by other applications
 # installed on the computer
 source.other=Third Party
 
 action.enabled=Will be enabled
 action.disabled=Will be disabled
 action.autoupdate=Will be updated to be compatible
 action.incompatible=Will be enabled when compatible
--- a/toolkit/mozapps/extensions/content/selectAddons.js
+++ b/toolkit/mozapps/extensions/content/selectAddons.js
@@ -33,17 +33,16 @@
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 "use strict";
 
 Components.utils.import("resource://gre/modules/AddonManager.jsm");
-Components.utils.import("resource://gre/modules/Services.jsm");
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
 var gView = null;
 
 function showView(aView) {
   gView = aView;
@@ -66,27 +65,20 @@ function showView(aView) {
 
 function showButtons(aCancel, aBack, aNext, aDone) {
   document.getElementById("cancel").hidden = !aCancel;
   document.getElementById("back").hidden = !aBack;
   document.getElementById("next").hidden = !aNext;
   document.getElementById("done").hidden = !aDone;
 }
 
-function isAddonDistroInstalled(aID) {
-  let branch = Services.prefs.getBranch("extensions.installedDistroAddon.");
-  if (!branch.prefHasUserValue(aID))
-    return false;
-
-  return branch.getBoolPref(aID);
-}
-
 function orderForScope(aScope) {
   switch (aScope) {
   case AddonManager.SCOPE_PROFILE:
+    return 2;
   case AddonManager.SCOPE_APPLICATION:
     return 1;
   default:
     return 0;
   }
 }
 
 var gAddons = {};
@@ -178,18 +170,17 @@ var gChecking = {
         let separator = document.createElement("separator");
         rows.appendChild(separator);
       }
 
       let row = document.createElement("row");
       row.setAttribute("id", aEntry.addon.id);
       row.setAttribute("class", "addon");
       rows.appendChild(row);
-      row.setAddon(aEntry.addon, aEntry.install, aEntry.wasActive,
-                   isAddonDistroInstalled(aEntry.addon.id));
+      row.setAddon(aEntry.addon, aEntry.install, aEntry.wasActive);
 
       if (aEntry.install)
         aEntry.install.addListener(gUpdate);
 
       lastAddon = aEntry.addon;
     });
 
     showView(gSelect);
--- a/toolkit/mozapps/extensions/content/selectAddons.xml
+++ b/toolkit/mozapps/extensions/content/selectAddons.xml
@@ -76,16 +76,17 @@
 
     <implementation>
       <field name="_addon"/>
       <field name="_disabled"/>
       <field name="_install"/>
       <field name="_wasActive"/>
       <field name="_keep">document.getAnonymousElementByAttribute(this, "anonid", "keep");</field>
       <field name="_update">document.getAnonymousElementByAttribute(this, "anonid", "update");</field>
+      <field name="_appStrings">document.getElementById("app-strings");</field>
       <field name="_strings">document.getElementById("strings");</field>
 
       <property name="action" readonly="true">
         <getter><![CDATA[
           if (!this._keep.checked) {
             if (this._wasActive)
               return "disable";
             else
@@ -104,39 +105,34 @@
           return null;
         ]]></getter>
       </property>
 
       <method name="setAddon">
         <parameter name="aAddon"/>
         <parameter name="aInstall"/>
         <parameter name="aWasActive"/>
-        <parameter name="aDistroInstalled"/>
         <body><![CDATA[
           this._addon = aAddon;
           this._install = aInstall;
           this._wasActive = aWasActive;
 
           this.setAttribute("name", aAddon.name);
           this.setAttribute("type", aAddon.type);
 
           // User and application installed add-ons default to staying enabled,
           // others default to disabled.
-          let scope = aAddon.scope;
-          if (aDistroInstalled)
-            scope = AddonManager.SCOPE_APPLICATION;
-
-          switch (scope) {
+          switch (aAddon.scope) {
             case AddonManager.SCOPE_PROFILE:
               this._keep.checked = !aAddon.userDisabled;
               this.setAttribute("source", this._strings.getString("source.profile"));
               break;
             case AddonManager.SCOPE_APPLICATION:
               this._keep.checked = !aAddon.userDisabled;
-              this.setAttribute("source", this._strings.getString("source.bundled"));
+              this.setAttribute("source", this._appStrings.getString("brandShortName"));
               break;
             default:
               this._keep.checked = false;
               this.setAttribute("source", this._strings.getString("source.other"));
           }
 
           this.updateAction();
         ]]></body>
--- a/toolkit/mozapps/extensions/content/selectAddons.xul
+++ b/toolkit/mozapps/extensions/content/selectAddons.xul
@@ -47,16 +47,17 @@
 %updateDTD;
 %brandDTD;
 ]>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         style="&upgrade.style;" id="select-window">
 
   <script type="application/javascript" src="chrome://mozapps/content/extensions/selectAddons.js"/>
+  <stringbundle id="app-strings" src="chrome://branding/locale/brand.properties"/>
   <stringbundle id="strings" src="chrome://mozapps/locale/extensions/selectAddons.properties"/>
 
   <deck id="view-deck" flex="1" align="stretch" pack="stretch">
     <vbox id="checking" align="stretch">
       <vbox flex="1">
         <label id="checking-heading" class="heading">&checking.heading;</label>
       </vbox>
       <progressmeter id="checking-progress" class="progress" mode="undetermined"/>
--- a/toolkit/mozapps/extensions/test/browser/browser_select_selection.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_select_selection.js
@@ -12,53 +12,53 @@ const USER = AddonManager.SCOPE_USER;
 const APP = AddonManager.SCOPE_APPLICATION;
 const SYSTEM = AddonManager.SCOPE_SYSTEM;
 
 // The matrix of testcases for the selection part of the UI
 // Note that the isActive flag has the value it had when the previous version
 // of the application ran with this add-on.
 var ADDONS = [
   //userDisabled   wasAppDisabled isAppDisabled  isActive  hasUpdate  autoUpdate  scope    defaultKeep  position  keepString           disableString
-  [false,          true,          false,         false,    false,     true,       PROFILE, true,        46,       "enabled",           ""],               // 0
-  [false,          true,          false,         false,    true,      true,       PROFILE, true,        47,       "enabled",           ""],               // 1
-  [false,          true,          false,         false,    true,      false,      PROFILE, true,        52,       "unneededupdate",    ""],               // 2
-  [false,          false,         false,         true,     false,     true,       PROFILE, true,        53,       "",                  "disabled"],       // 3
-  [false,          false,         false,         true,     true,      true,       PROFILE, true,        54,       "",                  "disabled"],       // 4
-  [false,          false,         false,         true,     true,      false,      PROFILE, true,        55,       "unneededupdate",    "disabled"],       // 5
-  [false,          true,          true,          false,    false,     true,       PROFILE, true,        56,       "incompatible",      ""],               // 6
-  [false,          true,          true,          false,    true,      true,       PROFILE, true,        57,       "autoupdate",        ""],               // 7
-  [false,          true,          true,          false,    true,      false,      PROFILE, true,        58,       "neededupdate",      ""],               // 8
-  [false,          false,         true,          true,     false,     true,       PROFILE, true,        59,       "incompatible",      "disabled"],       // 9
-  [false,          true,          true,          true,     true,      true,       PROFILE, true,        48,       "autoupdate",        "disabled"],       // 10
-  [false,          true,          true,          true,     true,      false,      PROFILE, true,        49,       "neededupdate",      "disabled"],       // 11
-  [true,           false,         false,         false,    false,     true,       PROFILE, false,       50,       "enabled",           ""],               // 12
-  [true,           false,         false,         false,    true,      true,       PROFILE, false,       51,       "enabled",           ""],               // 13
-  [true,           false,         false,         false,    true,      false,      PROFILE, false,       52,       "unneededupdate",    ""],               // 14
+  [false,          true,          false,         false,    false,     true,       PROFILE, true,        72,       "enabled",           ""],               // 0
+  [false,          true,          false,         false,    true,      true,       PROFILE, true,        73,       "enabled",           ""],               // 1
+  [false,          true,          false,         false,    true,      false,      PROFILE, true,        82,       "unneededupdate",    ""],               // 2
+  [false,          false,         false,         true,     false,     true,       PROFILE, true,        83,       "",                  "disabled"],       // 3
+  [false,          false,         false,         true,     true,      true,       PROFILE, true,        84,       "",                  "disabled"],       // 4
+  [false,          false,         false,         true,     true,      false,      PROFILE, true,        85,       "unneededupdate",    "disabled"],       // 5
+  [false,          true,          true,          false,    false,     true,       PROFILE, true,        86,       "incompatible",      ""],               // 6
+  [false,          true,          true,          false,    true,      true,       PROFILE, true,        87,       "autoupdate",        ""],               // 7
+  [false,          true,          true,          false,    true,      false,      PROFILE, true,        88,       "neededupdate",      ""],               // 8
+  [false,          false,         true,          true,     false,     true,       PROFILE, true,        89,       "incompatible",      "disabled"],       // 9
+  [false,          true,          true,          true,     true,      true,       PROFILE, true,        74,       "autoupdate",        "disabled"],       // 10
+  [false,          true,          true,          true,     true,      false,      PROFILE, true,        75,       "neededupdate",      "disabled"],       // 11
+  [true,           false,         false,         false,    false,     true,       PROFILE, false,       76,       "enabled",           ""],               // 12
+  [true,           false,         false,         false,    true,      true,       PROFILE, false,       77,       "enabled",           ""],               // 13
+  [true,           false,         false,         false,    true,      false,      PROFILE, false,       78,       "unneededupdate",    ""],               // 14
 
   // userDisabled and isActive cannot be true on startup
 
-  [true,           true,          true,          false,    false,     true,       PROFILE, false,       38,       "incompatible",      ""],               // 15
-  [true,           true,          true,          false,    true,      true,       PROFILE, false,       39,       "autoupdate",        ""],               // 16
-  [true,           true,          true,          false,    true,      false,      PROFILE, false,       40,       "neededupdate",      ""],               // 17
+  [true,           true,          true,          false,    false,     true,       PROFILE, false,       79,       "incompatible",      ""],               // 15
+  [true,           true,          true,          false,    true,      true,       PROFILE, false,       80,       "autoupdate",        ""],               // 16
+  [true,           true,          true,          false,    true,      false,      PROFILE, false,       81,       "neededupdate",      ""],               // 17
 
   // userDisabled and isActive cannot be true on startup
 
   // Being in a different scope should make little difference except no updates are possible so don't exhaustively test each
   [false,          false,         false,         true,     true,      false,      USER,    false,       0,        "",                  "disabled"],       // 18
   [true,           true,          false,         false,    true,      false,      USER,    false,       1,        "enabled",           ""],               // 19
   [false,          true,          true,          true,     true,      false,      USER,    false,       2,        "incompatible",      "disabled"],       // 20
   [true,           true,          true,          false,    true,      false,      USER,    false,       3,        "incompatible",      ""],               // 21
   [false,          false,         false,         true,     true,      false,      SYSTEM,  false,       4,        "",                  "disabled"],       // 22
   [true,           true,          false,         false,    true,      false,      SYSTEM,  false,       5,        "enabled",           ""],               // 23
   [false,          true,          true,          true,     true,      false,      SYSTEM,  false,       6,        "incompatible",      "disabled"],       // 24
   [true,           true,          true,          false,    true,      false,      SYSTEM,  false,       7,        "incompatible",      ""],               // 25
-  [false,          false,         false,         true,     true,      false,      APP,     true,        42,       "",                  "disabled"],       // 26
-  [true,           true,          false,         false,    true,      false,      APP,     false,       43,       "enabled",           ""],               // 27
-  [false,          true,          true,          true,     true,      false,      APP,     true,        44,       "incompatible",      "disabled"],       // 28
-  [true,           true,          true,          false,    true,      false,      APP,     false,       45,       "incompatible",      ""],               // 29
+  [false,          false,         false,         true,     true,      false,      APP,     true,        38,       "",                  "disabled"],       // 26
+  [true,           true,          false,         false,    true,      false,      APP,     false,       39,       "enabled",           ""],               // 27
+  [false,          true,          true,          true,     true,      false,      APP,     true,        40,       "incompatible",      "disabled"],       // 28
+  [true,           true,          true,          false,    true,      false,      APP,     false,       41,       "incompatible",      ""],               // 29
 ];
 
 function waitForView(aView, aCallback) {
   var view = gWin.document.getElementById(aView);
   view.addEventListener("ViewChanged", function() {
     view.removeEventListener("ViewChanged", arguments.callee, false);
     aCallback();
   }, false);
@@ -222,12 +222,12 @@ add_test(function selection_test() {
     EventUtils.synthesizeMouseAtCenter(keep, { }, gWin);
     is(keep.checked, !addon[7], "Keep checkbox should be in the right state");
 
     check_state();
 
     pos++;
   }
 
-  is(pos, 60, "Should have seen the right number of add-ons");
+  is(pos, 90, "Should have seen the right number of add-ons");
 
   run_next_test();
 });