Bug 827976 - Try to use an existing window first to open preferences. r=Gijs
☠☠ backed out by bf3cbcc82527 ☠ ☠
authorFelipe Gomes <felipc@gmail.com>
Fri, 01 Mar 2019 21:07:02 +0000
changeset 519901 fd94066a1d76d155a0edc9a2b9c67bac381fdf58
parent 519900 e253b264e7bdfdf28bfb2f15ab0f22cded77d91c
child 519902 845e1d0b24022796c587f7121825046cbcbc02f9
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);