Bug 1372523 - Remove the isSecurityUpdate, showNeverForVersion, and showPrompt attributes from nsIUpdate and the use of these attributes. r=mhowell
authorRobert Strong <robert.bugzilla@gmail.com>
Wed, 14 Jun 2017 16:18:05 -0700
changeset 363974 0382d15e3734395dc1c5facb752e973057517a13
parent 363973 7145c0c045009665d15fd08f11b76f8bb252c2ad
child 363975 53af1e0611e180ca76218ab4759fb33abf766352
push id91460
push userrstrong@mozilla.com
push dateThu, 15 Jun 2017 03:00:28 +0000
treeherdermozilla-inbound@53af1e0611e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhowell
bugs1372523
milestone56.0a1
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 1372523 - Remove the isSecurityUpdate, showNeverForVersion, and showPrompt attributes from nsIUpdate and the use of these attributes. r=mhowell
toolkit/mozapps/update/UpdateListener.jsm
toolkit/mozapps/update/UpdateTelemetry.jsm
toolkit/mozapps/update/content/updates.js
toolkit/mozapps/update/nsIUpdateService.idl
toolkit/mozapps/update/nsUpdateService.js
--- a/toolkit/mozapps/update/UpdateListener.jsm
+++ b/toolkit/mozapps/update/UpdateListener.jsm
@@ -186,18 +186,18 @@ var UpdateListener = {
         }
         break;
     }
   },
 
   handleUpdateAvailable(update, status) {
     switch (status) {
       case "show-prompt":
-        // If an update is available and had the showPrompt flag set, then
-        // show an update available doorhanger.
+        // If an update is available and the app.update.auto preference is
+        // false, then show an update available doorhanger.
         this.clearCallbacks();
         this.showUpdateAvailableNotification(update, false);
         break;
       case "cant-apply":
         this.clearCallbacks();
         this.showManualUpdateNotification(update, false);
         break;
     }
--- a/toolkit/mozapps/update/UpdateTelemetry.jsm
+++ b/toolkit/mozapps/update/UpdateTelemetry.jsm
@@ -33,19 +33,16 @@ this.AUSTLMY = {
   /**
    * Values for the UPDATE_CHECK_CODE_NOTIFY and UPDATE_CHECK_CODE_EXTERNAL
    * Telemetry histograms.
    */
   // No update found (no notification)
   CHK_NO_UPDATE_FOUND: 0,
   // Update will be downloaded in the background (background download)
   CHK_DOWNLOAD_UPDATE: 1,
-  // Showing prompt due to the update.xml specifying showPrompt
-  // (update notification)
-  CHK_SHOWPROMPT_SNIPPET: 2,
   // Showing prompt due to preference (update notification)
   CHK_SHOWPROMPT_PREF: 3,
   // Already has an active update in progress (no notification)
   CHK_HAS_ACTIVEUPDATE: 8,
   // A background download is already in progress (no notification)
   CHK_IS_DOWNLOADING: 9,
   // An update is already staged (no notification)
   CHK_IS_STAGED: 10,
@@ -69,18 +66,16 @@ this.AUSTLMY = {
   // (check failure notification)
   CHK_GENERAL_ERROR_PROMPT: 22,
   // General update check failure and threshold not reached (no notification)
   CHK_GENERAL_ERROR_SILENT: 23,
   // No compatible update found though there were updates (no notification)
   CHK_NO_COMPAT_UPDATE_FOUND: 24,
   // Update found for a previous version (no notification)
   CHK_UPDATE_PREVIOUS_VERSION: 25,
-  // Update found for a version with the never preference set (no notification)
-  CHK_UPDATE_NEVER_PREF: 26,
   // Update found without a type attribute (no notification)
   CHK_UPDATE_INVALID_TYPE: 27,
   // The system is no longer supported (system unsupported notification)
   CHK_UNSUPPORTED: 28,
   // Unable to apply updates (manual install to update notification)
   CHK_UNABLE_TO_APPLY: 29,
   // Unable to check for updates due to no OS version (no notification)
   CHK_NO_OS_VERSION: 30,
--- a/toolkit/mozapps/update/content/updates.js
+++ b/toolkit/mozapps/update/content/updates.js
@@ -22,18 +22,16 @@ const PREF_APP_UPDATE_BACKGROUNDERRORS  
 const PREF_APP_UPDATE_CERT_ERRORS         = "app.update.cert.errors";
 const PREF_APP_UPDATE_ELEVATE_NEVER       = "app.update.elevate.never";
 const PREF_APP_UPDATE_ENABLED             = "app.update.enabled";
 const PREF_APP_UPDATE_LOG                 = "app.update.log";
 const PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED = "app.update.notifiedUnsupported";
 const PREF_APP_UPDATE_TEST_LOOP           = "app.update.test.loop";
 const PREF_APP_UPDATE_URL_MANUAL          = "app.update.url.manual";
 
-const PREFBRANCH_APP_UPDATE_NEVER         = "app.update.never.";
-
 const UPDATE_TEST_LOOP_INTERVAL = 2000;
 
 const URI_UPDATES_PROPERTIES  = "chrome://mozapps/locale/update/updates.properties";
 
 const STATE_DOWNLOADING       = "downloading";
 const STATE_PENDING           = "pending";
 const STATE_PENDING_SERVICE   = "pending-service";
 const STATE_PENDING_ELEVATE   = "pending-elevate";
@@ -228,23 +226,17 @@ var gUpdates = {
     if (strings)
       return this.strings.getFormattedString(key, strings);
     return this.strings.getString(key);
   },
 
   never() {
     // If the user clicks "No Thanks", we should not prompt them to update to
     // this version again unless they manually select "Check for Updates..."
-    // which will clear all of the "never" prefs. There are currently two
-    // "never" prefs: the older PREFBRANCH_APP_UPDATE_NEVER as well as the
-    // OSX-only PREF_APP_UPDATE_ELEVATE_NEVER. We set both of these prefs (if
-    // applicable) to ensure that we don't prompt the user regardless of which
-    // pref is checked.
-    let neverPrefName = PREFBRANCH_APP_UPDATE_NEVER + this.update.appVersion;
-    Services.prefs.setBoolPref(neverPrefName, true);
+    // which will clear app.update.elevate.never preference.
     let aus = CoC["@mozilla.org/updates/update-service;1"].
               getService(CoI.nsIApplicationUpdateService);
     if (aus.elevationRequired) {
       Services.prefs.setCharPref(PREF_APP_UPDATE_ELEVATE_NEVER,
                                  this.update.appVersion);
     }
   },
 
@@ -494,21 +486,19 @@ var gCheckingPage = {
 
   /**
    * Initialize
    */
   onPageShow() {
     gUpdates.setButtons(null, null, null, false, true);
     gUpdates.wiz.getButton("cancel").focus();
 
-    // Clear all of the "never" prefs to handle the scenario where the user
-    // clicked "never" for an update, selected "Check for Updates...", and
-    // then canceled.  If we don't clear the "never" prefs future
-    // notifications will never happen.
-    Services.prefs.deleteBranch(PREFBRANCH_APP_UPDATE_NEVER);
+    // Clear elevation never prefs to handle the scenario where the user clicked
+    // "never" for an update and then canceled a manual update check.  If the
+    // preference isn't cleared then future notifications will never happen.
     if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_ELEVATE_NEVER)) {
       Services.prefs.clearUserPref(PREF_APP_UPDATE_ELEVATE_NEVER);
     }
 
     // The user will be notified if there is an error so clear the background
     // check error count.
     if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_BACKGROUNDERRORS)) {
       Services.prefs.clearUserPref(PREF_APP_UPDATE_BACKGROUNDERRORS);
@@ -547,24 +537,29 @@ var gCheckingPage = {
       gUpdates.setUpdate(aus.selectUpdate(updates, updates.length));
       if (gUpdates.update) {
         LOG("gCheckingPage", "onCheckComplete - update found");
         if (gUpdates.update.unsupported) {
           gUpdates.wiz.goTo("unsupported");
           return;
         }
 
-        if (!aus.canApplyUpdates || gUpdates.update.elevationFailure) {
-          // Prevent multiple notifications for the same update when the user is
-          // unable to apply updates.
+        if (gUpdates.update.elevationFailure) {
+          // Prevent multiple notifications for the same update when the client
+          // has had an elevation failure.
           gUpdates.never();
           gUpdates.wiz.goTo("manualUpdate");
           return;
         }
 
+        if (!aus.canApplyUpdates) {
+          gUpdates.wiz.goTo("manualUpdate");
+          return;
+        }
+
         gUpdates.wiz.goTo(gUpdates.updatesFoundPageId);
         return;
       }
 
       LOG("gCheckingPage", "onCheckComplete - no update found");
       gUpdates.wiz.goTo("noupdatesfound");
     },
 
@@ -649,19 +644,18 @@ var gUnsupportedPage = {
  */
 var gUpdatesFoundBasicPage = {
   /**
    * Initialize
    */
   onPageShow() {
     gUpdates.wiz.canRewind = false;
     var update = gUpdates.update;
-    gUpdates.setButtons("askLaterButton",
-                        update.showNeverForVersion ? "noThanksButton" : null,
-                        "updateButton_" + update.type, true);
+    gUpdates.setButtons("askLaterButton", null, "updateButton_" + update.type,
+                        true);
     var btn = gUpdates.wiz.getButton("next");
     btn.focus();
 
     var updateName = update.name;
     if (update.channel == "nightly") {
       updateName = gUpdates.getAUSString("updateNightlyName",
                                          [gUpdates.brandName,
                                           update.displayVersion,
@@ -684,21 +678,16 @@ var gUpdatesFoundBasicPage = {
 
     var updateTitle = gUpdates.getAUSString("updatesfound_" + update.type +
                                             ".title");
     document.getElementById("updatesFoundBasicHeader").setAttribute("label", updateTitle);
   },
 
   onExtra1() {
     gUpdates.wiz.cancel();
-  },
-
-  onExtra2() {
-    gUpdates.never();
-    gUpdates.wiz.cancel();
   }
 };
 
 /**
  * The "Update is Downloading" page - provides feedback for the download
  * process plus a pause/resume UI
  */
 var gDownloadingPage = {
--- a/toolkit/mozapps/update/nsIUpdateService.idl
+++ b/toolkit/mozapps/update/nsIUpdateService.idl
@@ -139,30 +139,16 @@ interface nsIUpdate : nsISupports
   attribute AString serviceURL;
 
   /**
    * The channel used to retrieve this update from the Update Service.
    */
   attribute AString channel;
 
   /**
-   * Whether to show the update prompt which requires user confirmation when an
-   * update is found during a background update check. This overrides the
-   * default setting to download the update in the background.
-   */
-  attribute boolean showPrompt;
-
-  /**
-   * Whether to show the "No Thanks" button in the update prompt. This allows
-   * the user to never receive a notification for that specific update version
-   * again.
-   */
-  attribute boolean showNeverForVersion;
-
-  /**
    * Whether the update is no longer supported on this system.
    */
   attribute boolean unsupported;
   
   /**
    * Allows overriding the default amount of time in seconds before prompting the
    * user to apply an update. If not specified, the value of
    * app.update.promptWaitTime will be used.
@@ -172,23 +158,16 @@ interface nsIUpdate : nsISupports
   /**
    * Whether or not the update being downloaded is a complete replacement of
    * the user's existing installation or a patch representing the difference
    * between the new version and the previous version.
    */
   attribute boolean isCompleteUpdate;
 
   /**
-   * Whether or not the update is a security update or not. If this is true,
-   * then we present more serious sounding user interface messages to the
-   * user.
-   */
-  attribute boolean isSecurityUpdate;
-
-  /**
    * When the update was installed.
    */
   attribute long long installDate;
 
   /**
    * A message associated with this update, if any.
    */
   attribute AString statusText;
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -45,18 +45,16 @@ const PREF_APP_UPDATE_SERVICE_ERRORS    
 const PREF_APP_UPDATE_SERVICE_MAXERRORS    = "app.update.service.maxErrors";
 const PREF_APP_UPDATE_SILENT               = "app.update.silent";
 const PREF_APP_UPDATE_SOCKET_MAXERRORS     = "app.update.socket.maxErrors";
 const PREF_APP_UPDATE_SOCKET_RETRYTIMEOUT  = "app.update.socket.retryTimeout";
 const PREF_APP_UPDATE_STAGING_ENABLED      = "app.update.staging.enabled";
 const PREF_APP_UPDATE_URL                  = "app.update.url";
 const PREF_APP_UPDATE_URL_DETAILS          = "app.update.url.details";
 
-const PREFBRANCH_APP_UPDATE_NEVER = "app.update.never.";
-
 const URI_BRAND_PROPERTIES      = "chrome://branding/locale/brand.properties";
 const URI_UPDATE_HISTORY_DIALOG = "chrome://mozapps/content/update/history.xul";
 const URI_UPDATE_NS             = "http://www.mozilla.org/2005/app-update";
 const URI_UPDATE_PROMPT_DIALOG  = "chrome://mozapps/content/update/updates.xul";
 const URI_UPDATES_PROPERTIES    = "chrome://mozapps/locale/update/updates.properties";
 
 const KEY_UPDROOT         = "UpdRootD";
 const KEY_EXECUTABLE      = "XREExeF";
@@ -1252,18 +1250,16 @@ UpdatePatch.prototype = {
  *          An <update> element to initialize this object with
  * @throws if the update contains no patches
  * @constructor
  */
 function Update(update) {
   this._properties = {};
   this._patches = [];
   this.isCompleteUpdate = false;
-  this.showPrompt = false;
-  this.showNeverForVersion = false;
   this.unsupported = false;
   this.channel = "default";
   this.promptWaitTime = getPref("getIntPref", PREF_APP_UPDATE_PROMPTWAITTIME, 43200);
   this.backgroundInterval = getPref("getIntPref", PREF_APP_UPDATE_BACKGROUNDINTERVAL,
                                     DOWNLOAD_BACKGROUND_INTERVAL);
 
   // Null <update>, assume this is a message container and do no
   // further initialization
@@ -1307,22 +1303,16 @@ function Update(update) {
       this._detailsURL = attr.value;
     } else if (attr.name == "installDate" && attr.value) {
       let val = parseInt(attr.value);
       if (val) {
         this.installDate = val;
       }
     } else if (attr.name == "isCompleteUpdate") {
       this.isCompleteUpdate = attr.value == "true";
-    } else if (attr.name == "isSecurityUpdate") {
-      this.isSecurityUpdate = attr.value == "true";
-    } else if (attr.name == "showNeverForVersion") {
-      this.showNeverForVersion = attr.value == "true";
-    } else if (attr.name == "showPrompt") {
-      this.showPrompt = attr.value == "true";
     } else if (attr.name == "promptWaitTime") {
       if (!isNaN(attr.value)) {
         this.promptWaitTime = parseInt(attr.value);
       }
     } else if (attr.name == "backgroundInterval") {
       if (!isNaN(attr.value)) {
         this.backgroundInterval = parseInt(attr.value);
       }
@@ -1452,18 +1442,16 @@ Update.prototype = {
     update.setAttribute("appVersion", this.appVersion);
     update.setAttribute("buildID", this.buildID);
     update.setAttribute("channel", this.channel);
     update.setAttribute("displayVersion", this.displayVersion);
     update.setAttribute("installDate", this.installDate);
     update.setAttribute("isCompleteUpdate", this.isCompleteUpdate);
     update.setAttribute("name", this.name);
     update.setAttribute("serviceURL", this.serviceURL);
-    update.setAttribute("showNeverForVersion", this.showNeverForVersion);
-    update.setAttribute("showPrompt", this.showPrompt);
     update.setAttribute("promptWaitTime", this.promptWaitTime);
     update.setAttribute("backgroundInterval", this.backgroundInterval);
     update.setAttribute("type", this.type);
 
     if (this.detailsURL) {
       update.setAttribute("detailsURL", this.detailsURL);
     }
     if (this.previousAppVersion) {
@@ -2105,28 +2093,16 @@ UpdateService.prototype = {
           aUpdate.buildID == Services.appinfo.appBuildID) {
         LOG("UpdateService:selectUpdate - skipping update because the " +
             "update's application version is less than the current " +
             "application version");
         lastCheckCode = AUSTLMY.CHK_UPDATE_PREVIOUS_VERSION;
         return;
       }
 
-      // Skip the update if the user responded with "never" to this update's
-      // application version and the update specifies showNeverForVersion
-      // (see bug 350636).
-      let neverPrefName = PREFBRANCH_APP_UPDATE_NEVER + aUpdate.appVersion;
-      if (aUpdate.showNeverForVersion &&
-          getPref("getBoolPref", neverPrefName, false)) {
-        LOG("UpdateService:selectUpdate - skipping update because the " +
-            "preference " + neverPrefName + " is true");
-        lastCheckCode = AUSTLMY.CHK_UPDATE_NEVER_PREF;
-        return;
-      }
-
       switch (aUpdate.type) {
         case "major":
           if (!majorUpdate)
             majorUpdate = aUpdate;
           else if (vc.compare(majorUpdate.appVersion, aUpdate.appVersion) <= 0)
             majorUpdate = aUpdate;
           break;
         case "minor":
@@ -2266,35 +2242,23 @@ UpdateService.prototype = {
     /**
      * From this point on there are two possible outcomes:
      * 1. download and install the update automatically
      * 2. notify the user about the availability of an update
      *
      * Notes:
      * a) if the app.update.auto preference is false then automatic download and
      *    install is disabled and the user will be notified.
-     * b) if the update has a showPrompt attribute the user will be notified.
      *
      * If the update when it is first read does not have an appVersion attribute
      * the following deprecated behavior will occur:
      * Update Type   Outcome
      * Major         Notify
      * Minor         Auto Install
      */
-    if (update.showPrompt) {
-      LOG("UpdateService:_selectAndInstallUpdate - prompting because the " +
-          "update snippet specified showPrompt. Notifying observers. " +
-          "topic: update-available, status: showPrompt");
-      AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_SHOWPROMPT_SNIPPET);
-
-      Services.obs.notifyObservers(update, "update-available", "show-prompt");
-      this._showPrompt(update);
-      return;
-    }
-
     if (!getPref("getBoolPref", PREF_APP_UPDATE_AUTO, true)) {
       LOG("UpdateService:_selectAndInstallUpdate - prompting because silent " +
           "install is disabled. Notifying observers. topic: update-available, " +
           "status: show-prompt");
       AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_SHOWPROMPT_PREF);
 
       Services.obs.notifyObservers(update, "update-available", "show-prompt");
       this._showPrompt(update);