From a5006c93ba34f3b80628bcfdb0fcf8711ec21952 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Tue, 21 Dec 2010 19:14:12 +0100 Subject: [PATCH] Bug 620040 - Random failure into browser_forms.js [r=mfinkle] --- mobile/chrome/tests/browser_forms.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mobile/chrome/tests/browser_forms.js b/mobile/chrome/tests/browser_forms.js index 61cb469a50d8..0debd6d14705 100644 --- a/mobile/chrome/tests/browser_forms.js +++ b/mobile/chrome/tests/browser_forms.js @@ -2,23 +2,25 @@ let testURL = chromeRoot + "browser_forms.html"; messageManager.loadFrameScript(chromeRoot + "remote_forms.js", true); let newTab = null; -let isLoading = function() { - return !newTab.isLoading() && newTab.browser.currentURI.spec != "about:blank"; -}; function test() { // This test is async waitForExplicitFinish(); + // Need to wait until the page is loaded + messageManager.addMessageListener("pageshow", function(aMessage) { + if (newTab.browser.currentURI.spec != "about:blank") { + messageManager.removeMessageListener(aMessage.name, arguments.callee); + setTimeout(onTabLoaded, 0); + } + }); + // Add new tab to hold the page newTab = Browser.addTab(testURL, true); - BrowserUI.closeAutoComplete(true); - - // Wait for the tab to load, then do the test - waitFor(onTabLoaded, isLoading); } function onTabLoaded() { + BrowserUI.closeAutoComplete(true); testMouseEvents(); }