Backed out changeset 3f534921cf61

This commit is contained in:
Dão Gottwald 2013-03-17 22:44:57 +01:00
Родитель 870c8b66d3
Коммит ccb7ee887a
2 изменённых файлов: 10 добавлений и 11 удалений

Просмотреть файл

@ -7,7 +7,6 @@
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";
@ -59,9 +58,12 @@ function getTopWin(skipPopups) {
(!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) {

Просмотреть файл

@ -20,21 +20,18 @@ 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));