Backed out changeset 3f534921cf61
authorDão Gottwald <dao@mozilla.com>
Sun, 17 Mar 2013 22:44:57 +0100
changeset 125166 5b09deb221f94c80cfe3a1a79e4c7e2f22934e25
parent 125148 3f534921cf6188c2af8740f4db99906ed12fb62a
child 125167 3fe35ae2db776d18213e195b631c13fbb6607e46
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
milestone22.0a1
backs out3f534921cf6188c2af8740f4db99906ed12fb62a
Backed out changeset 3f534921cf61
browser/base/content/utilityOverlay.js
browser/modules/RecentWindow.jsm
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -2,17 +2,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // Services = object with smart getters for common XPCOM services
 Components.utils.import("resource://gre/modules/Services.jsm");
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
-Components.utils.import("resource:///modules/RecentWindow.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "BROWSER_NEW_TAB_URL", function () {
   const PREF = "browser.newtab.url";
 
   function getNewTabPageURL() {
     if (!Services.prefs.prefHasUserValue(PREF)) {
       if (PrivateBrowsingUtils.isWindowPrivate(window) &&
           !PrivateBrowsingUtils.permanentPrivateBrowsing)
@@ -54,19 +53,22 @@ function getBrowserURL()
 function getTopWin(skipPopups) {
   // If this is called in a browser window, use that window regardless of
   // whether it's the frontmost window, since commands can be executed in
   // background windows (bug 626148).
   if (top.document.documentElement.getAttribute("windowtype") == "navigator:browser" &&
       (!skipPopups || top.toolbar.visible))
     return top;
 
-  let isPrivate = PrivateBrowsingUtils.isWindowPrivate(window);
-  return RecentWindow.getMostRecentBrowserWindow({private: isPrivate,
-                                                  allowPopups: !skipPopups});
+  if (skipPopups) {
+    return Components.classes["@mozilla.org/browser/browserglue;1"]
+                     .getService(Components.interfaces.nsIBrowserGlue)
+                     .getMostRecentBrowserWindow();
+  }
+  return Services.wm.getMostRecentWindow("navigator:browser");
 }
 
 function openTopWin(url) {
   /* deprecated */
   openUILinkIn(url, "current");
 }
 
 function getBoolPref(prefname, def)
--- a/browser/modules/RecentWindow.jsm
+++ b/browser/modules/RecentWindow.jsm
@@ -15,31 +15,28 @@ Cu.import("resource://gre/modules/Privat
 #define BROKEN_WM_Z_ORDER
 #endif
 
 this.RecentWindow = {
   /*
    * Get the most recent browser window.
    *
    * @param aOptions an object accepting the arguments for the search.
-   *        * private: true to restrict the search to private windows
-   *            only, false to restrict the search to non-private only.
-   *            Omit the property to search in both groups.
-   *        * allowPopups: true if popup windows are permissable.
+   *        Set the private property to true in order to restrict the
+   *        search to private windows only, or to false in order to
+   *        restrict the search to non-private windows only.  To search
+   *        in both groups, don't specify the private property.
    */
   getMostRecentBrowserWindow: function RW_getMostRecentBrowserWindow(aOptions) {
     let checkPrivacy = typeof aOptions == "object" &&
                        "private" in aOptions;
 
-    let allowPopups = typeof aOptions == "object" && !!aOptions.allowPopups;
-
     function isSuitableBrowserWindow(win) {
       return (!win.closed &&
               win.toolbar.visible &&
-              (allowPopups || win.toolbar.visible) &&
               (!checkPrivacy ||
                PrivateBrowsingUtils.permanentPrivateBrowsing ||
                PrivateBrowsingUtils.isWindowPrivate(win) == aOptions.private));
     }
 
 #ifdef BROKEN_WM_Z_ORDER
     let win = Services.wm.getMostRecentWindow("navigator:browser");