Bug 893781 - Defect - Restart after update button no longer works. r=timA
authorBrian R. Bondy <netzen@gmail.com>
Wed, 24 Jul 2013 16:09:36 -0400
changeset 153132 1ae3aef92373907750726448d1c19aebbca8062c
parent 153131 bc2a7cfd52089d1d4009b5e892a54529cb60b927
child 153133 0593679c47a90ff9144ba9d8568706352d8eabec
push id382
push userakeybl@mozilla.com
push dateMon, 21 Oct 2013 21:47:13 +0000
treeherdermozilla-release@5f1868ee45cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstimA
bugs893781
milestone25.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 893781 - Defect - Restart after update button no longer works. r=timA
browser/metro/base/content/browser.xul
browser/metro/base/content/flyouts/aboutFlyout.js
--- a/browser/metro/base/content/browser.xul
+++ b/browser/metro/base/content/browser.xul
@@ -398,17 +398,17 @@
       <label id="about-product-label" value="&aboutHeader.product.label;"/>
       <label value="&aboutHeader.company.label;"/>
 #expand <label id="about-version-label">__MOZ_APP_VERSION__</label>
       <vbox id="updateBox">
 #ifdef MOZ_UPDATER
         <deck id="updateDeck" orient="vertical">
           <hbox id="updateButtonBox" align="center">
             <button id="updateButton" align="start"
-                    oncommand="gAppUpdater.buttonOnCommand();"/>
+                    oncommand="FlyoutPanelsUI.AboutFlyout.appUpdater.buttonOnCommand();"/>
             <spacer flex="1"/>
           </hbox>
           <hbox id="checkingForUpdates" align="center">
             <image class="update-throbber"/><label>&update.checkingForUpdates;</label>
           </hbox>
           <hbox id="checkingAddonCompat" align="center">
             <image class="update-throbber"/><label>&update.checkingAddonCompat;</label>
           </hbox>
--- a/browser/metro/base/content/flyouts/aboutFlyout.js
+++ b/browser/metro/base/content/flyouts/aboutFlyout.js
@@ -47,17 +47,18 @@ let AboutFlyout = {
 #endif
   },
 
   handleEvent: function Appbar_handleEvent(aEvent) {
     switch (aEvent.type) {
       case 'MozFlyoutPanelShowing':
 #ifdef MOZ_UPDATER
         onUnload();
-        gAppUpdater = new appUpdater();
+        this.appUpdater = new appUpdater();
+        gAppUpdater = this.appUpdater;
 #endif
         break;
     }
   }
 };
 
 #ifdef MOZ_UPDATER
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
@@ -69,16 +70,17 @@ function onUnload(aEvent) {
     return;
   }
 
   if (gAppUpdater.isChecking)
     gAppUpdater.checker.stopChecking(Components.interfaces.nsIUpdateChecker.CURRENT_CHECK);
   // Safe to call even when there isn't a download in progress.
   gAppUpdater.removeDownloadListener();
   gAppUpdater = null;
+  AboutFlyout.appUpdater = null;
 }
 
 function appUpdater()
 {
   this.updateDeck = document.getElementById("updateDeck");
 
   XPCOMUtils.defineLazyServiceGetter(this, "aus",
                                      "@mozilla.org/updates/update-service;1",
@@ -542,17 +544,17 @@ appUpdater.prototype =
       // Do not remove UI listener since the user may resume downloading again.
       break;
     case Components.results.NS_OK:
       this.removeDownloadListener();
       if (this.backgroundUpdateEnabled) {
         this.selectPanel("applying");
         let update = this.um.activeUpdate;
         let self = this;
-        Services.obs.addObserver(function (aSubject, aTopic, aData) {
+        Services.obs.addObserver(function updateStaged(aSubject, aTopic, aData) {
           // Update the UI when the background updater is finished
           let status = aData;
           if (status == "applied" || status == "applied-service" ||
               status == "pending" || status == "pending-service") {
             // If the update is successfully applied, or if the updater has
             // fallen back to non-staged updates, show the Restart to Update
             // button.
             self.selectPanel("updateButtonBox");
@@ -564,17 +566,17 @@ appUpdater.prototype =
             self.selectPanel("downloadFailed");
           } else if (status == "downloading") {
             // We've fallen back to downloading the full update because the
             // partial update failed to get staged in the background.
             // Therefore we need to keep our observer.
             self.setupDownloadingUI();
             return;
           }
-          Services.obs.removeObserver(arguments.callee, "update-staged");
+          Services.obs.removeObserver(updateStaged, "update-staged");
         }, "update-staged", false);
       } else {
         this.selectPanel("updateButtonBox");
         this.setupUpdateButton("update.restart." +
                                (this.isMajor ? "upgradeButton" : "updateButton"));
       }
       break;
     default: