Bug 729244 - ESC doesn't revert the location bar value anymore. r=gavin

This commit is contained in:
Dão Gottwald 2012-02-24 14:32:00 +01:00
parent 0cc7de4816
commit c06aed28f8
3 changed files with 32 additions and 1 deletions

View File

@ -225,6 +225,7 @@ _BROWSER_FILES = \
browser_tabs_owner.js \
browser_urlbarCopying.js \
browser_urlbarEnter.js \
browser_urlbarRevert.js \
browser_urlbarTrimURLs.js \
browser_urlHighlight.js \
browser_visibleFindSelection.js \

View File

@ -0,0 +1,29 @@
function test() {
waitForExplicitFinish();
let tab = gBrowser.addTab("http://example.com");
gBrowser.selectedTab = tab;
onLoad(function () {
let originalValue = gURLBar.value;
gBrowser.userTypedValue = "foobar";
gBrowser.selectedTab = gBrowser.tabs[0];
gBrowser.selectedTab = tab;
is(gURLBar.value, "foobar", "location bar displays typed value");
gURLBar.focus();
EventUtils.synthesizeKey("VK_ESCAPE", {});
is(gURLBar.value, originalValue, "ESC reverted the location bar value");
gBrowser.removeTab(tab);
finish();
});
}
function onLoad(callback) {
gBrowser.selectedBrowser.addEventListener("pageshow", function loadListener() {
gBrowser.selectedBrowser.removeEventListener("pageshow", loadListener, false);
executeSoon(callback);
});
}

View File

@ -278,7 +278,8 @@
<method name="onTextReverted">
<body><![CDATA[
if (this._textRevertedHandler)
this._textRevertedHandler();
return this._textRevertedHandler();
return false;
]]></body>
</method>