From 023edd4be5c61c03798c288d06455795a050f807 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Wed, 29 Dec 2010 07:36:38 +0100 Subject: [PATCH] Bug 621732 - Random failure in browser_navigation.js [r=mfinkle] --- mobile/chrome/tests/browser_navigation.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/mobile/chrome/tests/browser_navigation.js b/mobile/chrome/tests/browser_navigation.js index e90222ea6fd6..ce764e1f9c9c 100644 --- a/mobile/chrome/tests/browser_navigation.js +++ b/mobile/chrome/tests/browser_navigation.js @@ -120,10 +120,21 @@ gTests.push({ // Send the string and press return EventUtils.synthesizeString(testURL_02, window); - EventUtils.synthesizeKey("VK_RETURN", {}, window); - // Wait for the tab to load, then do the test - waitFor(gCurrentTest.onPageFinish, pageLoaded(testURL_02)); + // It looks like there is a race condition somewhere that result having + // testURL_01 concatenate with testURL_02 as a urlbar value, so to + // workaround that we're waiting for the readonly state to be fully updated + function URLIsReadWrite() { + return BrowserUI._edit.readOnly == false; + } + + waitFor(function() { + is(BrowserUI._edit.value, testURL_02, "URL value should be equal to the string sent via synthesizeString"); + EventUtils.synthesizeKey("VK_RETURN", {}, window); + + // Wait for the tab to load, then do the test + waitFor(gCurrentTest.onPageFinish, pageLoaded(testURL_02)); + }, URLIsReadWrite); }, onPageFinish: function() {