Bug 574229: Open new window in the current OS X space when opening from the dock menu. r=gavin a=gavin
authorJosh Aas <joshmoz@gmail.com>
Tue, 07 Aug 2012 18:39:30 -0400
changeset 102321 0a856c99ad3b313799b0eadf8d7b8fbcc153b690
parent 102320 3c6fe5bff8562e99e39a11c8558ae6c99188f499
child 102322 7f9f10e43508e28821dc9abf7b51a9fd88bc4737
push id1862
push userjosh@mozilla.com
push dateTue, 07 Aug 2012 22:39:51 +0000
treeherdermozilla-aurora@0a856c99ad3b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin, gavin
bugs574229
milestone16.0a2
Bug 574229: Open new window in the current OS X space when opening from the dock menu. r=gavin a=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.