1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/base/content/test/general/browser_urlbarRevert.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,29 @@ 1.4 +function test() { 1.5 + waitForExplicitFinish(); 1.6 + 1.7 + let tab = gBrowser.addTab("http://example.com"); 1.8 + gBrowser.selectedTab = tab; 1.9 + 1.10 + onLoad(function () { 1.11 + let originalValue = gURLBar.value; 1.12 + 1.13 + gBrowser.userTypedValue = "foobar"; 1.14 + gBrowser.selectedTab = gBrowser.tabs[0]; 1.15 + gBrowser.selectedTab = tab; 1.16 + is(gURLBar.value, "foobar", "location bar displays typed value"); 1.17 + 1.18 + gURLBar.focus(); 1.19 + EventUtils.synthesizeKey("VK_ESCAPE", {}); 1.20 + is(gURLBar.value, originalValue, "ESC reverted the location bar value"); 1.21 + 1.22 + gBrowser.removeTab(tab); 1.23 + finish(); 1.24 + }); 1.25 +} 1.26 + 1.27 +function onLoad(callback) { 1.28 + gBrowser.selectedBrowser.addEventListener("pageshow", function loadListener() { 1.29 + gBrowser.selectedBrowser.removeEventListener("pageshow", loadListener, false); 1.30 + executeSoon(callback); 1.31 + }); 1.32 +}