Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[embedlite-components] Clear focus when search-in-page is canceled. F…
…ixes JB#24534
  • Loading branch information
rainemak committed Feb 3, 2021
1 parent 143ffbc commit 1aea759
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions jsscripts/embedhelper.js
Expand Up @@ -233,18 +233,18 @@ EmbedHelper.prototype = {
let searchAgain = aMessage.json.again;
let searchBackwards = aMessage.json.backwards;
let result = Ci.nsITypeAheadFind.FIND_NOTFOUND;
if (!this._fastFind) {
if (!searchText && this._fastFind) {
result = this._fastFind.find(searchText, false);
Services.focus.clearFocus(content);
this._fastFind = null;
} else if (!this._fastFind) {
this._fastFind = Cc["@mozilla.org/typeaheadfind;1"].createInstance(Ci.nsITypeAheadFind);
this._fastFind.init(docShell);
result = this._fastFind.find(searchText, false);
}
else {
if (!searchAgain) {
result = this._fastFind.find(searchText, false);
}
else {
result = this._fastFind.findAgain(searchBackwards, false);
}
} else if (!searchAgain) {
result = this._fastFind.find(searchText, false);
} else {
result = this._fastFind.findAgain(searchBackwards, false);
}
sendAsyncMessage("embed:find", { r: result });
break;
Expand Down

0 comments on commit 1aea759

Please sign in to comment.