Bug 1301941 - hide the dimmed modal highlight of the find toolbar when the last character is removed from the input field. r=jaws

MozReview-Commit-ID: 5I4ggpJ5xQx

--HG--
extra : rebase_source : 7562ada2d57dc00e46c1d0393648c8031f1afd61
This commit is contained in:
Mike de Boer 2016-09-16 11:10:51 +02:00
Родитель 403f14c44f
Коммит efb5105fa5
2 изменённых файлов: 31 добавлений и 3 удалений

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

@ -406,8 +406,7 @@ FinderHighlighter.prototype = {
return;
}
// Place the match placeholder on top of the current found range.
if (data.result == Ci.nsITypeAheadFind.FIND_NOTFOUND || !foundRange) {
if (data.result == Ci.nsITypeAheadFind.FIND_NOTFOUND || !data.searchString || !foundRange) {
this.hide();
return;
}
@ -446,7 +445,7 @@ FinderHighlighter.prototype = {
dict.animation.onfinish = () => dict.animation = null;
}
if (this._highlightAll && data.searchString)
if (this._highlightAll)
this.highlight(true, data.searchString, data.linksOnly);
},

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

@ -390,3 +390,32 @@ add_task(function* testHideOnLocationChange() {
yield BrowserTestUtils.removeTab(tab);
});
add_task(function* testHideOnClear() {
let url = kFixtureBaseURL + "file_FinderSample.html";
yield BrowserTestUtils.withNewTab(url, function* (browser) {
let findbar = gBrowser.getFindBar();
yield promiseOpenFindbar(findbar);
let word = "Roland";
let expectedResult = {
rectCount: 1,
insertCalls: [2, 4],
removeCalls: [1, 2]
};
let promise = promiseTestHighlighterOutput(browser, word, expectedResult);
yield promiseEnterStringIntoFindField(findbar, word);
yield promise;
yield new Promise(resolve => setTimeout(resolve, kIteratorTimeout));
promise = promiseTestHighlighterOutput(browser, "", {
rectCount: 0,
insertCalls: [0, 0],
removeCalls: [1, 2]
});
findbar.clear();
yield promise;
findbar.close(true);
});
});