From 3dae802750031204f25908d10b28054bddec4c37 Mon Sep 17 00:00:00 2001 From: Erik Vold Date: Thu, 15 Aug 2013 12:37:55 -0700 Subject: [PATCH] Bug 905472 - Intermittent TEST-UNEXPECTED-FAIL | tests/test-tabs.test window focus changes active tab | the activated tab url is correct. r=Mossop --- .../source/test/tabs/test-firefox-tabs.js | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/addon-sdk/source/test/tabs/test-firefox-tabs.js b/addon-sdk/source/test/tabs/test-firefox-tabs.js index 0798046b7a2a1a..41e5f59795746d 100644 --- a/addon-sdk/source/test/tabs/test-firefox-tabs.js +++ b/addon-sdk/source/test/tabs/test-firefox-tabs.js @@ -843,18 +843,20 @@ exports['test window focus changes active tab'] = function(test) { let win2 = openBrowserWindow(function() { test.pass("window 2 is open"); - tabs.on("activate", function onActivate(tab) { - tabs.removeListener("activate", onActivate); - test.pass("activate was called on windows focus change."); - test.assertEqual(tab.url, url1, 'the activated tab url is correct'); - - close(win2).then(function() { - test.pass('window 2 was closed'); - return close(win1); - }).then(test.done.bind(test)); - }); + focus(win2).then(function() { + tabs.on("activate", function onActivate(tab) { + tabs.removeListener("activate", onActivate); + test.pass("activate was called on windows focus change."); + test.assertEqual(tab.url, url1, 'the activated tab url is correct'); + + close(win2).then(function() { + test.pass('window 2 was closed'); + return close(win1); + }).then(test.done.bind(test)); + }); - win1.focus(); + win1.focus(); + }); }, "data:text/html;charset=utf-8,test window focus changes active tab

Window #2"); }, url1); };