Bug 1289283 - Define the lazy service getters at the beginning of the appUpdater function to ensure that they are available to any code that may reference them. r?rstrong draft
authorJared Wein <jwein@mozilla.com>
Tue, 26 Jul 2016 01:10:49 -0400
changeset 392732 d3bf99b0254117dae1feb037950023cbff7ba0c3
parent 392731 0a3979cf999dd75bb572065363f4f4227c26119c
child 526401 1b07c917d276c982fdce4461f0fd5776f6e035a2
push id24106
push userjwein@mozilla.com
push dateTue, 26 Jul 2016 05:11:49 +0000
reviewersrstrong
bugs1289283
milestone50.0a1
Bug 1289283 - Define the lazy service getters at the beginning of the appUpdater function to ensure that they are available to any code that may reference them. r?rstrong MozReview-Commit-ID: 1YVOCdqkNjd
browser/base/content/aboutDialog-appUpdater.js
--- a/browser/base/content/aboutDialog-appUpdater.js
+++ b/browser/base/content/aboutDialog-appUpdater.js
@@ -21,38 +21,38 @@ function onUnload(aEvent) {
   // Safe to call even when there isn't a download in progress.
   gAppUpdater.removeDownloadListener();
   gAppUpdater = null;
 }
 
 
 function appUpdater()
 {
+  XPCOMUtils.defineLazyServiceGetter(this, "aus",
+                                     "@mozilla.org/updates/update-service;1",
+                                     "nsIApplicationUpdateService");
+  XPCOMUtils.defineLazyServiceGetter(this, "checker",
+                                     "@mozilla.org/updates/update-checker;1",
+                                     "nsIUpdateChecker");
+  XPCOMUtils.defineLazyServiceGetter(this, "um",
+                                     "@mozilla.org/updates/update-manager;1",
+                                     "nsIUpdateManager");
+
   this.updateDeck = document.getElementById("updateDeck");
 
   // Hide the update deck when the update window is already open and it's not
   // already applied, to avoid syncing issues between them. Applied updates
   // don't have any information to sync between the windows as they both just
   // show the "Restart to continue"-type button.
   if (Services.wm.getMostRecentWindow("Update:Wizard") &&
       !this.isApplied) {
     this.updateDeck.hidden = true;
     return;
   }
 
-  XPCOMUtils.defineLazyServiceGetter(this, "aus",
-                                     "@mozilla.org/updates/update-service;1",
-                                     "nsIApplicationUpdateService");
-  XPCOMUtils.defineLazyServiceGetter(this, "checker",
-                                     "@mozilla.org/updates/update-checker;1",
-                                     "nsIUpdateChecker");
-  XPCOMUtils.defineLazyServiceGetter(this, "um",
-                                     "@mozilla.org/updates/update-manager;1",
-                                     "nsIUpdateManager");
-
   this.bundle = Services.strings.
                 createBundle("chrome://browser/locale/browser.properties");
 
   let manualURL = Services.urlFormatter.formatURLPref("app.update.url.manual");
   let manualLink = document.getElementById("manualLink");
   manualLink.value = manualURL;
   manualLink.href = manualURL;
   document.getElementById("failedLink").href = manualURL;