Bug 839961 - Refactor login manager's content actions into a separate JSM. (mobile and metro changes) r=mfinkle

This commit is contained in:
Justin Dolske 2013-06-19 16:30:53 -07:00
parent b0ec143fba
commit 90da7178fc
2 changed files with 27 additions and 1 deletions

View File

@ -28,6 +28,9 @@ XPCOMUtils.defineLazyGetter(this, "Point", function() {
return Point;
});
XPCOMUtils.defineLazyModuleGetter(this, "LoginManagerContent",
"resource://gre/modules/LoginManagerContent.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "gFocusManager",
"@mozilla.org/focus-manager;1", "nsIFocusManager");
@ -136,6 +139,8 @@ let Content = {
// Synchronous events caught during the bubbling phase
addEventListener("MozApplicationManifest", this, false);
addEventListener("DOMContentLoaded", this, false);
addEventListener("DOMAutoComplete", this, false);
addEventListener("blur", this, false);
addEventListener("pagehide", this, false);
// Attach a listener to watch for "click" events bubbling up from error
// pages and other similar page. This lets us fix bugs like 401575 which
@ -183,11 +188,17 @@ let Content = {
else
this._onClickCapture(aEvent);
break;
case "DOMContentLoaded":
LoginManagerContent.onContentLoaded(aEvent);
this._maybeNotifyErrorPage();
break;
case "DOMAutoComplete":
case "blur":
LoginManagerContent.onUsernameInput(aEvent);
break;
case "pagehide":
if (aEvent.target == content.document)
this._resetFontSize();

View File

@ -30,6 +30,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "DebuggerServer",
XPCOMUtils.defineLazyModuleGetter(this, "UserAgentOverrides",
"resource://gre/modules/UserAgentOverrides.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "LoginManagerContent",
"resource://gre/modules/LoginManagerContent.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
@ -2563,6 +2566,8 @@ Tab.prototype = {
this.browser.addEventListener("DOMTitleChanged", this, true);
this.browser.addEventListener("DOMWindowClose", this, true);
this.browser.addEventListener("DOMWillOpenModalDialog", this, true);
this.browser.addEventListener("DOMAutoComplete", this, true);
this.browser.addEventListener("blur", this, true);
this.browser.addEventListener("scroll", this, true);
this.browser.addEventListener("MozScrolledAreaChanged", this, true);
// Note that the XBL binding is untrusted
@ -2712,6 +2717,8 @@ Tab.prototype = {
this.browser.removeEventListener("DOMTitleChanged", this, true);
this.browser.removeEventListener("DOMWindowClose", this, true);
this.browser.removeEventListener("DOMWillOpenModalDialog", this, true);
this.browser.removeEventListener("DOMAutoComplete", this, true);
this.browser.removeEventListener("blur", this, true);
this.browser.removeEventListener("scroll", this, true);
this.browser.removeEventListener("MozScrolledAreaChanged", this, true);
this.browser.removeEventListener("PluginBindingAttached", this, true);
@ -3205,6 +3212,8 @@ Tab.prototype = {
case "DOMContentLoaded": {
let target = aEvent.originalTarget;
LoginManagerContent.onContentLoaded(aEvent);
// ignore on frames and other documents
if (target != this.browser.contentDocument)
return;
@ -3368,6 +3377,12 @@ Tab.prototype = {
break;
}
case "DOMAutoComplete":
case "blur": {
LoginManagerContent.onUsernameInput(aEvent);
break;
}
case "scroll": {
let win = this.browser.contentWindow;
if (this.userScrollPos.x != win.scrollX || this.userScrollPos.y != win.scrollY) {