Backed out changeset c496f46b0a15 (bug 1617408) fo bc failures on browser_ime_composition.js

CLOSED TREE
This commit is contained in:
Cosmin Sabou 2020-02-26 22:14:05 +02:00
Родитель 047ab655d1
Коммит eb8e6ffa30
2 изменённых файлов: 14 добавлений и 40 удалений

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

@ -1923,10 +1923,10 @@ class UrlbarInput {
}
this.removeAttribute("actiontype");
if (!this.view.isOpen) {
this.view.clear();
} else if (!value && !this.openViewOnFocus) {
if (!this.view.isOpen || !value) {
this.view.clear();
}
if (this.view.isOpen && !value) {
this.view.close();
return;
}

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

@ -18,7 +18,10 @@ add_task(async function test() {
await promiseAutocompleteResultPopup("x", window, true);
await checkResults();
await deleteInput();
// Backspace. The popup should close.
await UrlbarTestUtils.promisePopupClose(window, () =>
EventUtils.synthesizeKey("KEY_Backspace")
);
// Type "x". A new search should start. Don't use
// promiseAutocompleteResultPopup, which has some logic that starts the search
@ -31,16 +34,18 @@ add_task(async function test() {
// Now repeat the backspace + x two more times. Same thing should happen.
for (let i = 0; i < 2; i++) {
await deleteInput();
await UrlbarTestUtils.promisePopupClose(window, () =>
EventUtils.synthesizeKey("KEY_Backspace")
);
EventUtils.synthesizeKey("x");
await UrlbarTestUtils.promiseSearchComplete(window);
await checkResults();
}
await deleteInput();
if (!gURLBar.openViewOnFocus) {
gURLBar.view.close();
}
// Finally, backspace to close the popup.
await UrlbarTestUtils.promisePopupClose(window, () =>
EventUtils.synthesizeKey("KEY_Backspace")
);
});
async function checkResults() {
@ -52,34 +57,3 @@ async function checkResults() {
Assert.equal(details.type, UrlbarUtils.RESULT_TYPE.URL);
Assert.equal(details.url, "http://example.com/");
}
async function deleteInput() {
if (gURLBar.openViewOnFocus) {
// The popup should remain open and show top sites.
while (gURLBar.value.length) {
EventUtils.synthesizeKey("KEY_Backspace");
}
Assert.ok(
window.gURLBar.view.isOpen,
"View should remain open when deleting all input text"
);
let queryContext = await UrlbarTestUtils.promiseSearchComplete(window);
Assert.notEqual(
queryContext.results.length,
0,
"View should show results when deleting all input text"
);
Assert.equal(
queryContext.searchString,
"",
"Results should be for the empty search string (i.e. top sites) when deleting all input text"
);
} else {
// Deleting all text should close the view.
await UrlbarTestUtils.promisePopupClose(window, () => {
while (gURLBar.value.length) {
EventUtils.synthesizeKey("KEY_Backspace");
}
});
}
}