Bug 827976 - Try to use an existing window first to open preferences. r=Gijs
authorFelipe Gomes <felipc@gmail.com>
Mon, 04 Mar 2019 18:53:05 +0000
changeset 520352 51a46315f6603d062126204778e6d9f002998dc0
parent 520351 e4ff7ce962486dd21c4e4c8bd355f361b3a426de
child 520353 38db33426dd4b23c453875835a4b39e18725d1e5
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs827976
milestone67.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 827976 - Try to use an existing window first to open preferences. r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D21082
browser/components/BrowserGlue.jsm
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -2800,23 +2800,25 @@ BrowserGlue.prototype = {
     prefValue = prefValue || "general:5,suggestion:Infinity";
     Services.prefs.setCharPref(prefName, prefValue);
   },
 
   /**
    * Open preferences even if there are no open windows.
    */
   _openPreferences(...args) {
-    if (Services.appShell.hiddenDOMWindow.openPreferences) {
-      Services.appShell.hiddenDOMWindow.openPreferences(...args);
+    let chromeWindow = BrowserWindowTracker.getTopWindow();
+    if (chromeWindow) {
+      chromeWindow.openPreferences(...args);
       return;
     }
 
-    let chromeWindow = BrowserWindowTracker.getTopWindow();
-    chromeWindow.openPreferences(...args);
+    if (Services.appShell.hiddenDOMWindow.openPreferences) {
+      Services.appShell.hiddenDOMWindow.openPreferences(...args);
+    }
   },
 
   _openURLInNewWindow(url) {
     let urlString = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
     urlString.data = url;
     return new Promise(resolve => {
       let win = Services.ww.openWindow(null, AppConstants.BROWSER_CHROME_URL,
                                        "_blank", "chrome,all,dialog=no", urlString);