Bug 543278 - Try to use a more robust way of making sure that the main browser window is focused before running the next browser-chrome test; r=Mossop
☠☠ backed out by 859847fe8713 ☠ ☠
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 12 May 2010 18:51:04 -0400
changeset 42236 0e11e454db6c4134825bf0629cccbf1ef52bbddb
parent 42235 fbca3a801c22288c7df56434f5a1c2ec378f6f26
child 42237 fb38d987711f5efcb555a49592cda69076b96c03
child 42238 859847fe87134c90b9a5137fa23340beb4e3f22e
push idunknown
push userunknown
push dateunknown
reviewersMossop
bugs543278
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
Bug 543278 - Try to use a more robust way of making sure that the main browser window is focused before running the next browser-chrome test; r=Mossop
testing/mochitest/browser-test.js
--- a/testing/mochitest/browser-test.js
+++ b/testing/mochitest/browser-test.js
@@ -84,30 +84,20 @@ 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.
-    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);
+    let self = this;
+    this.SimpleTest.waitForFocus(function() {
+      aCallback.apply(self);
+    });
   },
 
   finish: function Tester_finish(aSkipSummary) {
     this._cs.unregisterListener(this);
 
     if (this.tests.length) {
       this.dumper.dump("\nBrowser Chrome Test Summary\n");