Loading toolkit/components/passwordmgr/LoginManagerContent.jsm +5 −6 Original line number Diff line number Diff line Loading @@ -250,7 +250,7 @@ var LoginManagerContent = { let doc = form.ownerDocument; let autofillForm = gAutofillForms && !PrivateBrowsingUtils.isContentWindowPrivate(doc.defaultView); this._fillForm(form, autofillForm, false, false, false, loginsFound); this._fillForm(form, autofillForm, false, false, loginsFound); }, /* Loading Loading @@ -293,7 +293,7 @@ var LoginManagerContent = { if (usernameField == acInputField && passwordField) { this._asyncFindLogins(acForm, { showMasterPassword: false }) .then(({ form, loginsFound }) => { this._fillForm(form, true, true, true, true, loginsFound); this._fillForm(form, true, true, true, loginsFound); }) .then(null, Cu.reportError); } else { Loading Loading @@ -564,14 +564,13 @@ var LoginManagerContent = { * [success, foundLogins]. * * - autofillForm denotes if we should fill the form in automatically * - ignoreAutocomplete denotes if we should ignore autocomplete=off * attributes * - userTriggered is an indication of whether this filling was triggered by * the user * - foundLogins is an array of nsILoginInfo for optimization */ _fillForm : function (form, autofillForm, ignoreAutocomplete, clobberPassword, userTriggered, foundLogins) { _fillForm : function (form, autofillForm, clobberPassword, userTriggered, foundLogins) { let ignoreAutocomplete = true; // Heuristically determine what the user/pass fields are // We do this before checking to see if logins are stored, // so that the user isn't prompted for a master password Loading toolkit/components/passwordmgr/nsLoginManager.js +1 −2 Original line number Diff line number Diff line Loading @@ -587,8 +587,7 @@ LoginManager.prototype = { log("fillForm processing form[ id:", form.id, "]"); return LoginManagerContent._asyncFindLogins(form, { showMasterPassword: true }) .then(function({ form, loginsFound }) { return LoginManagerContent._fillForm(form, true, true, false, false, loginsFound)[0]; return LoginManagerContent._fillForm(form, true, false, false, loginsFound)[0]; }); }, Loading toolkit/components/passwordmgr/test/mochitest.ini +0 −2 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ skip-if = toolkit == 'android' [test_case_differences.html] skip-if = toolkit == 'android' [test_basic_form_html5.html] [test_basic_form_observer_autocomplete.html] [test_basic_form_observer_autofillForms.html] [test_basic_form_observer_foundLogins.html] [test_basic_form_pwevent.html] Loading @@ -49,7 +48,6 @@ skip-if = toolkit == 'android' # This test doesn't pass because we can't ensure a cross-platform event that # occurs between DOMContentLoaded and Pageload skip-if = true [test_bug_227640.html] [test_bug_242956.html] [test_bug_360493_1.html] [test_bug_360493_2.html] Loading toolkit/components/passwordmgr/test/test_basic_form_autocomplete.html +5 −5 Original line number Diff line number Diff line Loading @@ -558,13 +558,13 @@ function* runTest() { yield runNextTest(); /* Tests for single-user forms with autocomplete=off */ /* Tests for single-user forms for ignoring autocomplete=off */ /* test 100 */ // Turn our attention to form2 uname = $_(2, "uname"); pword = $_(2, "pword"); checkACForm("", ""); checkACForm("singleuser5", "singlepass5"); // Trigger autocomplete popup restoreForm(); Loading @@ -585,7 +585,7 @@ function* runTest() { // Turn our attention to form3 uname = $_(3, "uname"); pword = $_(3, "pword"); checkACForm("", ""); checkACForm("singleuser5", "singlepass5"); // Trigger autocomplete popup restoreForm(); Loading @@ -605,7 +605,7 @@ function* runTest() { // Turn our attention to form4 uname = $_(4, "uname"); pword = $_(4, "pword"); checkACForm("", ""); checkACForm("singleuser5", "singlepass5"); // Trigger autocomplete popup restoreForm(); Loading @@ -625,7 +625,7 @@ function* runTest() { // Turn our attention to form5 uname = $_(5, "uname"); pword = $_(5, "pword"); checkACForm("", ""); checkACForm("singleuser5", "singlepass5"); // Trigger autocomplete popup restoreForm(); Loading toolkit/components/passwordmgr/test/test_basic_form_observer_autocomplete.htmldeleted 100644 → 0 +0 −103 Original line number Diff line number Diff line <!DOCTYPE HTML> <html> <head> <title>Test for Login Manager</title> <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> <script type="text/javascript" src="pwmgr_common.js"></script> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> </head> <body> Login Manager test: simple form with autocomplete off and notifying observers & normal form <script> const Cc = SpecialPowers.Cc; const Ci = SpecialPowers.Ci; commonInit(); SimpleTest.waitForExplicitFinish(); </script> <p id="display"></p> <div id="content" style="display: block"> <form id="form1" action="formtest.js" autocomplete="off"> <p>This is form 1.</p> <input type="text" name="uname"> <input type="password" name="pword"> <button type="submit">Submit</button> <button type="reset"> Reset </button> </form> <form id="form2" action="formtest.js"> <p>This is form 2.</p> <input type="text" name="uname"> <input type="password" name="pword"> <button type="submit">Submit</button> <button type="reset"> Reset </button> </form> </div> <pre id="test"> <script class="testbody" type="text/javascript"> /** Test for Login Manager: simple form with autocomplete off and notifying observers & normal form **/ var TestObserver = { receivedNotification1 : false, receivedNotification2 : false, data1 : "", data2 : "", observe : function (subject, topic, data) { var pwmgr = Cc["@mozilla.org/login-manager;1"]. getService(Ci.nsILoginManager); if (topic == "passwordmgr-found-form") { if (subject.id == "form1") { this.receivedNotification1 = true; this.data1 = data; } else if (subject.id == "form2") { this.receivedNotification2 = true; this.data2 = data; } // Now fill the form pwmgr.fillForm(subject) .then(startTest); } } }; // Add the observer SpecialPowers.addObserver(TestObserver, "passwordmgr-found-form", false); function startTest(){ // Test that observer is notified & got correct data is(TestObserver.receivedNotification1, true, "Checking observer was notified"); is(TestObserver.data1, "autocompleteOff", "Checking observer got correct data"); // Check that form1 was filled is($_(1, "uname").value, "testuser", "Checking for filled username 1"); is($_(1, "pword").value, "testpass", "Checking for filled password 1"); // Test that observer wasn't notified & didn't get data is(TestObserver.receivedNotification2, false, "Checking observer was not notified"); is(TestObserver.data2, "", "Checking observer didn't get data"); // Check that form2 was filled is($_(2, "uname").value, "testuser", "Checking for filled username 2"); is($_(2, "pword").value, "testpass", "Checking for filled password 2"); // Remove the observer try { SpecialPowers.removeObserver(TestObserver, "passwordmgr-found-form"); } catch (e) { ok(false, SpecialPowers.wrap(e)); } SimpleTest.finish(); } </script> </pre> </body> </html> Loading
toolkit/components/passwordmgr/LoginManagerContent.jsm +5 −6 Original line number Diff line number Diff line Loading @@ -250,7 +250,7 @@ var LoginManagerContent = { let doc = form.ownerDocument; let autofillForm = gAutofillForms && !PrivateBrowsingUtils.isContentWindowPrivate(doc.defaultView); this._fillForm(form, autofillForm, false, false, false, loginsFound); this._fillForm(form, autofillForm, false, false, loginsFound); }, /* Loading Loading @@ -293,7 +293,7 @@ var LoginManagerContent = { if (usernameField == acInputField && passwordField) { this._asyncFindLogins(acForm, { showMasterPassword: false }) .then(({ form, loginsFound }) => { this._fillForm(form, true, true, true, true, loginsFound); this._fillForm(form, true, true, true, loginsFound); }) .then(null, Cu.reportError); } else { Loading Loading @@ -564,14 +564,13 @@ var LoginManagerContent = { * [success, foundLogins]. * * - autofillForm denotes if we should fill the form in automatically * - ignoreAutocomplete denotes if we should ignore autocomplete=off * attributes * - userTriggered is an indication of whether this filling was triggered by * the user * - foundLogins is an array of nsILoginInfo for optimization */ _fillForm : function (form, autofillForm, ignoreAutocomplete, clobberPassword, userTriggered, foundLogins) { _fillForm : function (form, autofillForm, clobberPassword, userTriggered, foundLogins) { let ignoreAutocomplete = true; // Heuristically determine what the user/pass fields are // We do this before checking to see if logins are stored, // so that the user isn't prompted for a master password Loading
toolkit/components/passwordmgr/nsLoginManager.js +1 −2 Original line number Diff line number Diff line Loading @@ -587,8 +587,7 @@ LoginManager.prototype = { log("fillForm processing form[ id:", form.id, "]"); return LoginManagerContent._asyncFindLogins(form, { showMasterPassword: true }) .then(function({ form, loginsFound }) { return LoginManagerContent._fillForm(form, true, true, false, false, loginsFound)[0]; return LoginManagerContent._fillForm(form, true, false, false, loginsFound)[0]; }); }, Loading
toolkit/components/passwordmgr/test/mochitest.ini +0 −2 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ skip-if = toolkit == 'android' [test_case_differences.html] skip-if = toolkit == 'android' [test_basic_form_html5.html] [test_basic_form_observer_autocomplete.html] [test_basic_form_observer_autofillForms.html] [test_basic_form_observer_foundLogins.html] [test_basic_form_pwevent.html] Loading @@ -49,7 +48,6 @@ skip-if = toolkit == 'android' # This test doesn't pass because we can't ensure a cross-platform event that # occurs between DOMContentLoaded and Pageload skip-if = true [test_bug_227640.html] [test_bug_242956.html] [test_bug_360493_1.html] [test_bug_360493_2.html] Loading
toolkit/components/passwordmgr/test/test_basic_form_autocomplete.html +5 −5 Original line number Diff line number Diff line Loading @@ -558,13 +558,13 @@ function* runTest() { yield runNextTest(); /* Tests for single-user forms with autocomplete=off */ /* Tests for single-user forms for ignoring autocomplete=off */ /* test 100 */ // Turn our attention to form2 uname = $_(2, "uname"); pword = $_(2, "pword"); checkACForm("", ""); checkACForm("singleuser5", "singlepass5"); // Trigger autocomplete popup restoreForm(); Loading @@ -585,7 +585,7 @@ function* runTest() { // Turn our attention to form3 uname = $_(3, "uname"); pword = $_(3, "pword"); checkACForm("", ""); checkACForm("singleuser5", "singlepass5"); // Trigger autocomplete popup restoreForm(); Loading @@ -605,7 +605,7 @@ function* runTest() { // Turn our attention to form4 uname = $_(4, "uname"); pword = $_(4, "pword"); checkACForm("", ""); checkACForm("singleuser5", "singlepass5"); // Trigger autocomplete popup restoreForm(); Loading @@ -625,7 +625,7 @@ function* runTest() { // Turn our attention to form5 uname = $_(5, "uname"); pword = $_(5, "pword"); checkACForm("", ""); checkACForm("singleuser5", "singlepass5"); // Trigger autocomplete popup restoreForm(); Loading
toolkit/components/passwordmgr/test/test_basic_form_observer_autocomplete.htmldeleted 100644 → 0 +0 −103 Original line number Diff line number Diff line <!DOCTYPE HTML> <html> <head> <title>Test for Login Manager</title> <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> <script type="text/javascript" src="pwmgr_common.js"></script> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> </head> <body> Login Manager test: simple form with autocomplete off and notifying observers & normal form <script> const Cc = SpecialPowers.Cc; const Ci = SpecialPowers.Ci; commonInit(); SimpleTest.waitForExplicitFinish(); </script> <p id="display"></p> <div id="content" style="display: block"> <form id="form1" action="formtest.js" autocomplete="off"> <p>This is form 1.</p> <input type="text" name="uname"> <input type="password" name="pword"> <button type="submit">Submit</button> <button type="reset"> Reset </button> </form> <form id="form2" action="formtest.js"> <p>This is form 2.</p> <input type="text" name="uname"> <input type="password" name="pword"> <button type="submit">Submit</button> <button type="reset"> Reset </button> </form> </div> <pre id="test"> <script class="testbody" type="text/javascript"> /** Test for Login Manager: simple form with autocomplete off and notifying observers & normal form **/ var TestObserver = { receivedNotification1 : false, receivedNotification2 : false, data1 : "", data2 : "", observe : function (subject, topic, data) { var pwmgr = Cc["@mozilla.org/login-manager;1"]. getService(Ci.nsILoginManager); if (topic == "passwordmgr-found-form") { if (subject.id == "form1") { this.receivedNotification1 = true; this.data1 = data; } else if (subject.id == "form2") { this.receivedNotification2 = true; this.data2 = data; } // Now fill the form pwmgr.fillForm(subject) .then(startTest); } } }; // Add the observer SpecialPowers.addObserver(TestObserver, "passwordmgr-found-form", false); function startTest(){ // Test that observer is notified & got correct data is(TestObserver.receivedNotification1, true, "Checking observer was notified"); is(TestObserver.data1, "autocompleteOff", "Checking observer got correct data"); // Check that form1 was filled is($_(1, "uname").value, "testuser", "Checking for filled username 1"); is($_(1, "pword").value, "testpass", "Checking for filled password 1"); // Test that observer wasn't notified & didn't get data is(TestObserver.receivedNotification2, false, "Checking observer was not notified"); is(TestObserver.data2, "", "Checking observer didn't get data"); // Check that form2 was filled is($_(2, "uname").value, "testuser", "Checking for filled username 2"); is($_(2, "pword").value, "testpass", "Checking for filled password 2"); // Remove the observer try { SpecialPowers.removeObserver(TestObserver, "passwordmgr-found-form"); } catch (e) { ok(false, SpecialPowers.wrap(e)); } SimpleTest.finish(); } </script> </pre> </body> </html>