Bug 623625 - Force window to the front on mac, and make sure the app window is active on all platforms for needs-focus reftests. r=ndeakin
authorJosh Matthews <josh@joshmatthews.net>
Sat, 01 Oct 2011 15:50:19 -0400
changeset 77978 190e4e5b23c3614017f843babace8b24d89a9417
parent 77977 c2931c64df06ab94118c244fce4fa285ff113c6c
child 77979 bbd483aa8883ea9547777d1391c9f7cb795d9515
push id21259
push usermak77@bonardo.net
push dateMon, 03 Oct 2011 13:36:47 +0000
treeherdermozilla-central@a896a9e237a0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersndeakin
bugs623625
milestone10.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 623625 - Force window to the front on mac, and make sure the app window is active on all platforms for needs-focus reftests. r=ndeakin
layout/tools/reftest/reftest.js
--- a/layout/tools/reftest/reftest.js
+++ b/layout/tools/reftest/reftest.js
@@ -877,24 +877,23 @@ function ServeFiles(manifestURL, depth, 
 function Focus()
 {
     // FIXME/bug 583976: focus doesn't yet work with out-of-process
     // content.
     if (gBrowserIsRemote) {
         return false;
     }
 
-    // FIXME/bug 623625: determine if the window is focused and/or try
-    // to acquire focus if it's not.
-    //
-    // NB: we can't add anything here that would return false on
-    // tinderbox, otherwise we could lose testing coverage due to
-    // problems on the test machines.  We might want a require-focus
-    // mode, defaulting to false for developers, but that's true on
-    // tinderbox.
+    var fm = CC["@mozilla.org/focus-manager;1"].getService(CI.nsIFocusManager);
+    fm.activeWindow = window;
+    try {
+        var dock = CC["@mozilla.org/widget/macdocksupport;1"].getService(CI.nsIMacDockSupport);
+        dock.activateApplication(true);
+    } catch(ex) {
+    }
     return true;
 }
 
 function StartCurrentTest()
 {
     gTestLog = [];
 
     // make sure we don't run tests that are expected to kill the browser