Merge backout of changeset 0e11e454db6c
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 12 May 2010 20:50:00 -0400
changeset 42239 a2d28f1db1ad40d8777ec2919e50d0ada99577df
parent 42237 fb38d987711f5efcb555a49592cda69076b96c03 (current diff)
parent 42238 859847fe87134c90b9a5137fa23340beb4e3f22e (diff)
child 42240 c91fa12e51a481a8c1828fe3a4689b5f8cd626c6
push idunknown
push userunknown
push dateunknown
milestone1.9.3a5pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
Merge backout of changeset 0e11e454db6c
--- a/testing/mochitest/browser-test.js
+++ b/testing/mochitest/browser-test.js
@@ -84,20 +84,30 @@ Tester.prototype = {
         else
           this.dumper.dump("TEST-UNEXPECTED-FAIL | (browser-test.js) | " + msg + "\n");
 
         win.close();
       }
     }
 
     // Make sure the window is raised before each test.
-    let self = this;
-    this.SimpleTest.waitForFocus(function() {
-      aCallback.apply(self);
-    });
+    if (this._fm.activeWindow != window) {
+      this.dumper.dump("TEST-INFO | (browser-test.js) | Waiting for window activation...\n");
+      let self = this;
+      window.addEventListener("activate", function () {
+        window.removeEventListener("activate", arguments.callee, false);
+        setTimeout(function () {
+          aCallback.apply(self);
+        }, 0);
+      }, false);
+      window.focus();
+      return;
+    }
+
+    aCallback.apply(this);
   },
 
   finish: function Tester_finish(aSkipSummary) {
     this._cs.unregisterListener(this);
 
     if (this.tests.length) {
       this.dumper.dump("\nBrowser Chrome Test Summary\n");