From 3f48472856f2654ff1e9afcce12198f172d6dc0d Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Thu, 9 Dec 2010 10:58:01 -0500 Subject: [PATCH] Bug 614540 - Form Helper should not close when data are load in the background [r=mfinkle] --- mobile/chrome/content/browser-ui.js | 8 ++++++-- mobile/chrome/content/browser.js | 10 +++++----- mobile/chrome/content/forms.js | 2 ++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/mobile/chrome/content/browser-ui.js b/mobile/chrome/content/browser-ui.js index 05d4965ec40b..e669fd039e0a 100644 --- a/mobile/chrome/content/browser-ui.js +++ b/mobile/chrome/content/browser-ui.js @@ -1737,7 +1737,7 @@ var FindHelperUI = { }, handleEvent: function findHelperHandleEvent(aEvent) { - if (aEvent.type == "TabSelect" || aEvent.type == "URLChanged") + if (aEvent.type == "TabSelect" || (aEvent.type == "URLChanged" && aEvent.target == Browser.selectedBrowser)) this.hide(); }, @@ -1918,10 +1918,14 @@ var FormHelperUI = { switch (aEvent.type) { case "TabSelect": case "TabClose": - case "URLChanged": this.hide(); break; + case "URLChanged": + if (aEvent.target == Browser.selectedBrowser) + this.hide(); + break; + case "resize": setTimeout(function(self) { SelectHelperUI.resize(); diff --git a/mobile/chrome/content/browser.js b/mobile/chrome/content/browser.js index f56cb63527b4..ac1ac5bdf461 100644 --- a/mobile/chrome/content/browser.js +++ b/mobile/chrome/content/browser.js @@ -1870,7 +1870,7 @@ IdentityHandler.prototype = { }, handleEvent: function(aEvent) { - if (aEvent.type == "URLChanged" && !this._identityPopup.hidden) + if (aEvent.type == "URLChanged" && aEvent.target == Browser.selectedBrowser && !this._identityPopup.hidden) this.hide(); } }; @@ -2347,6 +2347,10 @@ ProgressController.prototype = { Browser.scrollContentToTop({ x: 0 }); } } + + let event = document.createEvent("Events"); + event.initEvent("URLChanged", true, false); + this.browser.dispatchEvent(event); }, /** @@ -2391,10 +2395,6 @@ ProgressController.prototype = { if (this._tab.browser.currentURI.spec == "about:blank") BrowserUI.updateURI(); } - - let event = document.createEvent("Events"); - event.initEvent("URLChanged", true, false); - this.browser.dispatchEvent(event); }, _networkStop: function _networkStop() { diff --git a/mobile/chrome/content/forms.js b/mobile/chrome/content/forms.js index c66f79d18e9c..6375746bc096 100644 --- a/mobile/chrome/content/forms.js +++ b/mobile/chrome/content/forms.js @@ -91,7 +91,9 @@ FormAssistant.prototype = { set currentIndex(aIndex) { let element = this._elements[aIndex]; if (element) { + this.focusSync = false; gFocusManager.setFocus(element, Ci.nsIFocusManager.FLAG_NOSCROLL); + this.focusSync = true; this._currentIndex = aIndex; sendAsyncMessage("FormAssist:Show", this._getJSON()); }