merge backout
authorDão Gottwald <dao@mozilla.com>
Mon, 18 Mar 2013 16:46:39 +0100
changeset 125244 867475abb8948a8e585f41f973ea1410968c93b2
parent 125242 240dc14b1b87b21edec6980a89062587268d117c (current diff)
parent 125243 6678ea192a6c07dc9675151a6b94a3f21920e6f4 (diff)
child 125245 ee2e53392df1146327fdf5ea889df45a23333b99
push id24831
push userdgottwald@mozilla.com
push dateMon, 18 Mar 2013 15:46:50 +0000
treeherdermozilla-inbound@867475abb894 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone22.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
merge backout
toolkit/modules/RecentWindow.jsm
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -2,17 +2,17 @@
 # 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/.
 
 let Ci = Components.interfaces;
 let Cu = Components.utils;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/RecentWindow.jsm");
+Cu.import("resource:///modules/RecentWindow.jsm");
 
 const nsIWebNavigation = Ci.nsIWebNavigation;
 
 var gCharsetMenu = null;
 var gLastBrowserCharset = null;
 var gPrevCharset = null;
 var gProxyFavIcon = null;
 var gLastValidURLStr = "";
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -2,17 +2,17 @@
 # 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://gre/modules/RecentWindow.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)
--- a/browser/components/downloads/content/allDownloadsViewOverlay.js
+++ b/browser/components/downloads/content/allDownloadsViewOverlay.js
@@ -18,17 +18,17 @@ Cu.import("resource://gre/modules/NetUti
 Cu.import("resource://gre/modules/DownloadUtils.jsm");
 Cu.import("resource:///modules/DownloadsCommon.jsm");
 Cu.import("resource://gre/modules/PlacesUtils.jsm");
 Cu.import("resource://gre/modules/osfile.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
                                   "resource://gre/modules/PrivateBrowsingUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow",
-                                  "resource://gre/modules/RecentWindow.jsm");
+                                  "resource:///modules/RecentWindow.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
                                   "resource://gre/modules/FileUtils.jsm");
 
 const nsIDM = Ci.nsIDownloadManager;
 
 const DESTINATION_FILE_URI_ANNO  = "downloads/destinationFileURI";
 const DOWNLOAD_META_DATA_ANNO    = "downloads/metaData";
 
--- a/browser/components/downloads/src/DownloadsUI.js
+++ b/browser/components/downloads/src/DownloadsUI.js
@@ -26,17 +26,17 @@ Cu.import("resource://gre/modules/Servic
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "DownloadsCommon",
                                   "resource:///modules/DownloadsCommon.jsm");
 XPCOMUtils.defineLazyServiceGetter(this, "gBrowserGlue",
                                    "@mozilla.org/browser/browserglue;1",
                                    "nsIBrowserGlue");
 XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow",
-                                  "resource://gre/modules/RecentWindow.jsm");
+                                  "resource:///modules/RecentWindow.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
                                   "resource://gre/modules/PrivateBrowsingUtils.jsm");
 
 ////////////////////////////////////////////////////////////////////////////////
 //// DownloadsUI
 
 function DownloadsUI()
 {
--- a/browser/components/nsBrowserContentHandler.js
+++ b/browser/components/nsBrowserContentHandler.js
@@ -3,17 +3,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 Components.utils.import("resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
                                   "resource://gre/modules/PrivateBrowsingUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow",
-                                  "resource://gre/modules/RecentWindow.jsm");
+                                  "resource:///modules/RecentWindow.jsm");
 
 const nsISupports            = Components.interfaces.nsISupports;
 
 const nsIBrowserDOMWindow    = Components.interfaces.nsIBrowserDOMWindow;
 const nsIBrowserHandler      = Components.interfaces.nsIBrowserHandler;
 const nsIBrowserHistory      = Components.interfaces.nsIBrowserHistory;
 const nsIChannel             = Components.interfaces.nsIChannel;
 const nsICommandLine         = Components.interfaces.nsICommandLine;
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -52,17 +52,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 
 XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
                                   "resource://gre/modules/PrivateBrowsingUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "KeywordURLResetPrompter",
                                   "resource:///modules/KeywordURLResetPrompter.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow",
-                                  "resource://gre/modules/RecentWindow.jsm");
+                                  "resource:///modules/RecentWindow.jsm");
 
 const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser";
 const PREF_PLUGINS_UPDATEURL  = "plugins.update.url";
 
 // We try to backup bookmarks at idle times, to avoid doing that at shutdown.
 // Number of idle seconds before trying to backup bookmarks.  15 minutes.
 const BOOKMARKS_BACKUP_IDLE_TIME = 15 * 60;
 // Minimum interval in milliseconds between backups.
--- a/browser/modules/Makefile.in
+++ b/browser/modules/Makefile.in
@@ -20,16 +20,21 @@ EXTRA_JS_MODULES = \
 	SignInToWebsite.jsm \
 	webappsUI.jsm \
 	webrtcUI.jsm \
 	KeywordURLResetPrompter.jsm \
 	Social.jsm \
 	SharedFrame.jsm \
 	$(NULL)
 
+EXTRA_PP_JS_MODULES = \
+	RecentWindow.jsm \
+	$(NULL)
+
+
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
 EXTRA_JS_MODULES += \
 	WindowsPreviewPerTab.jsm \
 	$(NULL)
 EXTRA_PP_JS_MODULES += \
 	WindowsJumpLists.jsm \
 	$(NULL)
 endif
new file mode 100644
--- /dev/null
+++ b/browser/modules/RecentWindow.jsm
@@ -0,0 +1,69 @@
+/* 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/. */
+
+"use strict";
+
+this.EXPORTED_SYMBOLS = ["RecentWindow"];
+
+const Cu = Components.utils;
+
+Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
+
+#ifndef XP_WIN
+#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.
+   */
+  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");
+
+    // if we're lucky, this isn't a popup, and we can just return this
+    if (win && !isSuitableBrowserWindow(win)) {
+      win = null;
+      let windowList = Services.wm.getEnumerator("navigator:browser");
+      // this is oldest to newest, so this gets a bit ugly
+      while (windowList.hasMoreElements()) {
+        let nextWin = windowList.getNext();
+        if (isSuitableBrowserWindow(nextWin))
+          win = nextWin;
+      }
+    }
+    return win;
+#else
+    let windowList = Services.wm.getZOrderDOMWindowEnumerator("navigator:browser", true);
+    while (windowList.hasMoreElements()) {
+      let win = windowList.getNext();
+      if (isSuitableBrowserWindow(win))
+        return win;
+    }
+    return null;
+#endif
+  }
+};
+
--- a/toolkit/content/contentAreaUtils.js
+++ b/toolkit/content/contentAreaUtils.js
@@ -1,16 +1,15 @@
 # -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 
 # 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/.
 
 Components.utils.import("resource://gre/modules/Services.jsm");
 Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
-Components.utils.import("resource://gre/modules/RecentWindow.jsm");
 
 var ContentAreaUtils = {
 
   // this is for backwards compatibility.
   get ioService() {
     return Services.io;
   },
 
@@ -1068,19 +1067,17 @@ function openURL(aURL)
   var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
                               .getService(Components.interfaces.nsIExternalProtocolService);
 
   if (!protocolSvc.isExposedProtocol(uri.scheme)) {
     // If we're not a browser, use the external protocol service to load the URI.
     protocolSvc.loadUrl(uri);
   }
   else {
-    let isPrivate = PrivateBrowsingUtils.isWindowPrivate(window);
-    var recentWindow = RecentWindow.getMostRecentWindow({type: "navigator:browser",
-                                                         private: isPrivate});
+    var recentWindow = Services.wm.getMostRecentWindow("navigator:browser");
     if (recentWindow) {
       var win = recentWindow.browserDOMWindow.openURI(uri, null,
                                                       recentWindow.browserDOMWindow.OPEN_DEFAULTWINDOW,
                                                       recentWindow.browserDOMWindow.OPEN_NEW);
       win.focus();
       return;
     }
 
--- a/toolkit/modules/Makefile.in
+++ b/toolkit/modules/Makefile.in
@@ -11,13 +11,9 @@ include $(DEPTH)/config/autoconf.mk
 
 EXTRA_JS_MODULES := \
   NewTabUtils.jsm \
   Sqlite.jsm \
   TelemetryTimestamps.jsm \
   Timer.jsm \
   $(NULL)
 
-EXTRA_PP_JS_MODULES = \
-  RecentWindow.jsm \
-  $(NULL)
-
 include $(topsrcdir)/config/rules.mk
deleted file mode 100644
--- a/toolkit/modules/RecentWindow.jsm
+++ /dev/null
@@ -1,69 +0,0 @@
-/* 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/. */
-
-"use strict";
-
-this.EXPORTED_SYMBOLS = ["RecentWindow"];
-
-const Cu = Components.utils;
-
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
-
-#ifndef XP_WIN
-#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.
-   */
-  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");
-
-    // if we're lucky, this isn't a popup, and we can just return this
-    if (win && !isSuitableBrowserWindow(win)) {
-      win = null;
-      let windowList = Services.wm.getEnumerator("navigator:browser");
-      // this is oldest to newest, so this gets a bit ugly
-      while (windowList.hasMoreElements()) {
-        let nextWin = windowList.getNext();
-        if (isSuitableBrowserWindow(nextWin))
-          win = nextWin;
-      }
-    }
-    return win;
-#else
-    let windowList = Services.wm.getZOrderDOMWindowEnumerator("navigator:browser", true);
-    while (windowList.hasMoreElements()) {
-      let win = windowList.getNext();
-      if (isSuitableBrowserWindow(win))
-        return win;
-    }
-    return null;
-#endif
-  }
-};
-