Bug 1544562 - Call onUnload when about:preferences is closed r=rstrong
authorKirk Steuber <ksteuber@mozilla.com>
Thu, 18 Apr 2019 20:52:02 +0000
changeset 470142 be77d454cbe7e8cf3d619b56d87d399699bd7edd
parent 470141 050964a5e03e9888993e610c10d96ffc68cd9883
child 470143 08e2094f4b6b96b860a023c00c470665d53ce45d
push id112843
push useraiakab@mozilla.com
push dateFri, 19 Apr 2019 09:50:22 +0000
treeherdermozilla-inbound@c06f27cbfe40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrstrong
bugs1544562
milestone68.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 1544562 - Call onUnload when about:preferences is closed r=rstrong Differential Revision: https://phabricator.services.mozilla.com/D27591
browser/base/content/aboutDialog-appUpdater.js
browser/components/preferences/in-content/main.js
--- a/browser/base/content/aboutDialog-appUpdater.js
+++ b/browser/base/content/aboutDialog-appUpdater.js
@@ -15,21 +15,23 @@ ChromeUtils.defineModuleGetter(this, "Up
                                "resource://gre/modules/UpdateUtils.jsm");
 
 const PREF_APP_UPDATE_CANCELATIONS_OSX = "app.update.cancelations.osx";
 const PREF_APP_UPDATE_ELEVATE_NEVER    = "app.update.elevate.never";
 
 var gAppUpdater;
 
 function onUnload(aEvent) {
-  if (gAppUpdater.isChecking)
-    gAppUpdater.checker.stopCurrentCheck();
-  // Safe to call even when there isn't a download in progress.
-  gAppUpdater.removeDownloadListener();
-  gAppUpdater = null;
+  if (gAppUpdater) {
+    if (gAppUpdater.isChecking)
+      gAppUpdater.checker.stopCurrentCheck();
+    // Safe to call even when there isn't a download in progress.
+    gAppUpdater.removeDownloadListener();
+    gAppUpdater = null;
+  }
 }
 
 
 function appUpdater(options = {}) {
   XPCOMUtils.defineLazyServiceGetter(this, "aus",
                                      "@mozilla.org/updates/update-service;1",
                                      "nsIApplicationUpdateService");
   XPCOMUtils.defineLazyServiceGetter(this, "checker",
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -1431,16 +1431,19 @@ var gMainPane = {
   },
 
 
   // EventListener
 
   handleEvent(aEvent) {
     if (aEvent.type == "unload") {
       this.destroy();
+      if (AppConstants.MOZ_UPDATER) {
+        onUnload();
+      }
     }
   },
 
 
   // Composed Model Construction
 
   _loadData() {
     this._loadInternalHandlers();