Bug 629661 - Find in Page does not reset after it is closed [r=mfinkle]
--- a/mobile/chrome/content/common-ui.js
+++ b/mobile/chrome/content/common-ui.js
@@ -455,32 +455,40 @@ var FindHelperUI = {
get status() {
return this._status;
},
set status(val) {
if (val != this._status) {
this._status = val;
- this._textbox.setAttribute("status", val);
+ if (!val)
+ this._textbox.removeAttribute("status");
+ else
+ this._textbox.setAttribute("status", val);
this.updateCommands(this._textbox.value);
}
},
init: function findHelperInit() {
this._textbox = document.getElementById("find-helper-textbox");
this._container = document.getElementById("content-navigator");
this._cmdPrevious = document.getElementById(this.commands.previous);
this._cmdNext = document.getElementById(this.commands.next);
// Listen for form assistant messages from content
messageManager.addMessageListener("FindAssist:Show", this);
messageManager.addMessageListener("FindAssist:Hide", this);
+ // Listen for composition update, some VKB that does suggestions does not
+ // update directly the content of the field but in this case we want to
+ // search as soon as something is entered in the field
+ this._textbox.addEventListener("text", this, false);
+
// Listen for events where form assistant should be closed
document.getElementById("tabs").addEventListener("TabSelect", this, true);
Elements.browsers.addEventListener("URLChanged", this, true);
},
receiveMessage: function findHelperReceiveMessage(aMessage) {
let json = aMessage.json;
switch(aMessage.name) {
@@ -502,16 +510,25 @@ var FindHelperUI = {
case "TabSelect":
this.hide();
break;
case "URLChanged":
if (aEvent.detail && aEvent.target == getBrowser())
this.hide();
break;
+
+ case "text":
+ if (!this._open)
+ return;
+
+ let evt = document.createEvent("Event");
+ evt.initEvent("input", true, false);
+ this._textbox.dispatchEvent(evt);
+ break;
}
},
show: function findHelperShow() {
this._container.show(this);
this.search(this._textbox.value);
this._textbox.select();
this._textbox.focus();