Bug 1291060 - Android: When a password field is added to a document (possibly outside of a <form>) the autofill code should run. r=liuche draft
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Tue, 02 Aug 2016 14:20:35 -0700
changeset 395769 edd81b946037e7773e3d8b358a211baa3c4ef463
parent 395760 18496dab4741e5ecf1387c762f0f5bf7194903d7
child 395770 5a91e5440654d48ad52e263abd87e60c58f96187
child 395794 779f40e9887b675d032fdc24c5c5b490d08b65f4
push id24842
push usermozilla@noorenberghe.ca
push dateTue, 02 Aug 2016 21:21:20 +0000
reviewersliuche
bugs1291060, 1168707
milestone51.0a1
Bug 1291060 - Android: When a password field is added to a document (possibly outside of a <form>) the autofill code should run. r=liuche Android version of bug 1168707 MozReview-Commit-ID: 4OZ8Jp9aVgN
mobile/android/chrome/content/browser.js
toolkit/components/passwordmgr/test/mochitest/mochitest.ini
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -3539,16 +3539,17 @@ Tab.prototype = {
                 Ci.nsIWebProgress.NOTIFY_SECURITY;
     this.filter = Cc["@mozilla.org/appshell/component/browser-status-filter;1"].createInstance(Ci.nsIWebProgress);
     this.filter.addProgressListener(this, flags)
     this.browser.addProgressListener(this.filter, flags);
     this.browser.sessionHistory.addSHistoryListener(this);
 
     this.browser.addEventListener("DOMContentLoaded", this, true);
     this.browser.addEventListener("DOMFormHasPassword", this, true);
+    this.browser.addEventListener("DOMInputPasswordAdded", this, true);
     this.browser.addEventListener("DOMLinkAdded", this, true);
     this.browser.addEventListener("DOMLinkChanged", this, true);
     this.browser.addEventListener("DOMMetaAdded", this, false);
     this.browser.addEventListener("DOMTitleChanged", this, true);
     this.browser.addEventListener("DOMAudioPlaybackStarted", this, true);
     this.browser.addEventListener("DOMAudioPlaybackStopped", this, true);
     this.browser.addEventListener("DOMWindowClose", this, true);
     this.browser.addEventListener("DOMWillOpenModalDialog", this, true);
@@ -3652,16 +3653,17 @@ Tab.prototype = {
 
     this.browser.removeProgressListener(this.filter);
     this.filter.removeProgressListener(this);
     this.filter = null;
     this.browser.sessionHistory.removeSHistoryListener(this);
 
     this.browser.removeEventListener("DOMContentLoaded", this, true);
     this.browser.removeEventListener("DOMFormHasPassword", this, true);
+    this.browser.removeEventListener("DOMInputPasswordAdded", this, true);
     this.browser.removeEventListener("DOMLinkAdded", this, true);
     this.browser.removeEventListener("DOMLinkChanged", this, true);
     this.browser.removeEventListener("DOMMetaAdded", this, false);
     this.browser.removeEventListener("DOMTitleChanged", this, true);
     this.browser.removeEventListener("DOMAudioPlaybackStarted", this, true);
     this.browser.removeEventListener("DOMAudioPlaybackStopped", this, true);
     this.browser.removeEventListener("DOMWindowClose", this, true);
     this.browser.removeEventListener("DOMWillOpenModalDialog", this, true);
@@ -4121,16 +4123,21 @@ Tab.prototype = {
           let displayHost = IdentityHandler.getEffectiveHost();
           let title = { text: displayHost, resource: hostname };
           let selectObj = { title: title, logins: foundLogins };
           Messaging.sendRequest({ type: "Doorhanger:Logins", data: selectObj });
         }
         break;
       }
 
+      case "DOMInputPasswordAdded": {
+        LoginManagerContent.onDOMInputPasswordAdded(aEvent,
+                                                    this.browser.contentWindow);
+      }
+
       case "DOMMetaAdded":
         let target = aEvent.originalTarget;
         let browser = BrowserApp.getBrowserForDocument(target.ownerDocument);
 
         switch (target.name) {
           case "msapplication-TileImage":
             this.addMetadata("tileImage", browser.currentURI.resolve(target.content), this.METADATA_GOOD_MATCH);
             break;
--- a/toolkit/components/passwordmgr/test/mochitest/mochitest.ini
+++ b/toolkit/components/passwordmgr/test/mochitest/mochitest.ini
@@ -33,19 +33,17 @@ skip-if = toolkit == 'android' # android
 skip-if = toolkit == 'android' # Tests desktop prompts
 [test_bug_776171.html]
 [test_case_differences.html]
 skip-if = toolkit == 'android' # autocomplete
 [test_form_action_1.html]
 [test_form_action_2.html]
 [test_form_action_javascript.html]
 [test_formless_autofill.html]
-skip-if = toolkit == 'android' # Bug 1259768
 [test_formless_submit.html]
-skip-if = toolkit == 'android' # Bug 1259768
 [test_input_events.html]
 [test_input_events_for_identical_values.html]
 [test_maxlength.html]
 [test_passwords_in_type_password.html]
 [test_prompt.html]
 skip-if = e10s || os == "linux" || toolkit == 'android' # Tests desktop prompts
 [test_recipe_login_fields.html]
 [test_xhr_2.html]