зеркало из https://github.com/mozilla/gecko-dev.git
Bug 620982 - focus is cleared when there is an XHR in the background [r=mfinkle]
This commit is contained in:
Родитель
f39d906efc
Коммит
4b5c314adb
|
@ -246,7 +246,8 @@ let DOMEvents = {
|
|||
// Clear onload focus to prevent the VKB to be shown unexpectingly
|
||||
// but only if the location has really changed and not only the
|
||||
// fragment identifier
|
||||
if (!WebProgressListener.hashChanged) {
|
||||
let contentWindowID = content.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
|
||||
if (!WebProgressListener.hashChanged && contentWindowID == util.currentInnerWindowID) {
|
||||
let focusManager = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
|
||||
focusManager.clearFocus(content);
|
||||
}
|
||||
|
|
|
@ -71,6 +71,8 @@ function FormAssistant() {
|
|||
|
||||
addEventListener("keyup", this, false);
|
||||
addEventListener("focus", this, true);
|
||||
addEventListener("DOMWindowCreated", this, false);
|
||||
addEventListener("pageshow", this, false);
|
||||
|
||||
this._enabled = Services.prefs.getBoolPref("formhelper.enabled");
|
||||
};
|
||||
|
@ -254,10 +256,16 @@ FormAssistant.prototype = {
|
|||
|
||||
focusSync: false,
|
||||
handleEvent: function formHelperHandleEvent(aEvent) {
|
||||
if (!this._enabled || (!this.currentElement && (aEvent.type != "focus" || !this.focusSync)))
|
||||
if (!this._enabled || (!this.currentElement && aEvent.type != "focus") || (aEvent.type == "focus" && !this.focusSync))
|
||||
return;
|
||||
|
||||
switch (aEvent.type) {
|
||||
case "DOMWindowCreated":
|
||||
this.focusSync = false;
|
||||
break;
|
||||
case "pageshow":
|
||||
this.focusSync = true;
|
||||
break;
|
||||
case "focus":
|
||||
let focusedElement = gFocusManager.getFocusedElementForWindow(content, true, {}) || aEvent.target;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче