Bug 574229: Open new window in the current OS X space when opening from the dock menu. r=gavin
authorJosh Aas <joshmoz@gmail.com>
Tue, 07 Aug 2012 15:28:16 -0400
changeset 101701 257580e4ccef1ae98900359c98bf152a2733068b
parent 101700 0dee35fee53370c66f32bad4feb139c86a110884
child 101702 fd673fa4d1d731749e5f074d737ac96df601d716
push id13127
push userjosh@mozilla.com
push dateTue, 07 Aug 2012 19:28:50 +0000
treeherdermozilla-inbound@257580e4ccef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin
bugs574229
milestone17.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 574229: Open new window in the current OS X space when opening from the dock menu. r=gavin
browser/base/content/macBrowserOverlay.xul
--- a/browser/base/content/macBrowserOverlay.xul
+++ b/browser/base/content/macBrowserOverlay.xul
@@ -22,21 +22,25 @@
 
 # All JS files which are not content (only) dependent that browser.xul
 # wishes to include *must* go into the global-scripts.inc file
 # so that they can be shared by this overlay.
 #include global-scripts.inc
 
 <script type="application/javascript">
   function OpenBrowserWindowFromDockMenu() {
-    let dockSupport = Cc["@mozilla.org/widget/macdocksupport;1"]
-                      .getService(Ci.nsIMacDockSupport);
-    dockSupport.activateApplication(true);
+    let win = OpenBrowserWindow();
+    win.addEventListener("load", function listener() {
+      win.removeEventListener("load", listener);
+      let dockSupport = Cc["@mozilla.org/widget/macdocksupport;1"]
+        .getService(Ci.nsIMacDockSupport);
+      dockSupport.activateApplication(true);
+    });
 
-    return OpenBrowserWindow();
+    return win;
   }
 
   addEventListener("load",   function() { gBrowserInit.nonBrowserWindowStartup()  }, false);
   addEventListener("unload", function() { gBrowserInit.nonBrowserWindowShutdown() }, false);
 </script>
 
 # All sets except for popupsets (commands, keys, stringbundles and broadcasters) *must* go into the 
 # browser-sets.inc file for sharing with hiddenWindow.xul.