diff --git a/testing/mochitest/browser-test.js b/testing/mochitest/browser-test.js index 13391e736c6d..660cfc62bf8b 100644 --- a/testing/mochitest/browser-test.js +++ b/testing/mochitest/browser-test.js @@ -89,20 +89,10 @@ Tester.prototype = { } // 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) {