Bug 660806 - Autocomplete shows during history navigation; reland; r=rcampbell,dtownsend

This commit is contained in:
Mihai Sucan 2011-06-23 10:40:38 -03:00
Родитель 8c603c065a
Коммит aaf586a8d1
3 изменённых файлов: 50 добавлений и 0 удалений

Просмотреть файл

@ -4961,6 +4961,7 @@ JSTerm.prototype = {
setInputValue: function JST_setInputValue(aNewValue)
{
this.inputNode.value = aNewValue;
this.lastInputValue = aNewValue;
this.completeNode.value = "";
this.resizeInput();
},

Просмотреть файл

@ -143,6 +143,7 @@ _BROWSER_TEST_FILES = \
browser_webconsole_bug_585991_autocomplete_keys.js \
browser_webconsole_bug_651501_document_body_autocomplete.js \
browser_webconsole_bug_663443_panel_title.js \
browser_webconsole_bug_660806_history_nav.js \
head.js \
$(NULL)

Просмотреть файл

@ -0,0 +1,48 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const TEST_URI = "data:text/html,<p>bug 660806 - history navigation must not show the autocomplete popup";
function test() {
addTab(TEST_URI);
browser.addEventListener("load", tabLoaded, true);
}
function tabLoaded()
{
browser.removeEventListener("load", tabLoaded, true);
openConsole();
content.wrappedJSObject.foobarBug660806 = {
"location": "value0",
"locationbar": "value1",
};
let hudId = HUDService.getHudIdByWindow(content);
let HUD = HUDService.hudReferences[hudId];
let jsterm = HUD.jsterm;
let popup = jsterm.autocompletePopup;
popup._panel.addEventListener("popupshown", function() {
popup._panel.removeEventListener("popupshown", arguments.callee, false);
ok(false, "popup shown");
}, false);
ok(!popup.isOpen, "popup is not open");
ok(!jsterm.lastInputValue, "no lastInputValue");
jsterm.setInputValue("window.foobarBug660806.location");
is(jsterm.lastInputValue, "window.foobarBug660806.location",
"lastInputValue is correct");
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("VK_UP", {});
is(jsterm.lastInputValue, "window.foobarBug660806.location",
"lastInputValue is correct, again");
executeSoon(function() {
ok(!popup.isOpen, "popup is not open");
executeSoon(finishTest);
});
}