Bug 1025703 - Ignore autocomplete=off for filling login forms.r=dolske
authorAllison Naaktgeboren <ally@mozilla.com>
Tue, 17 Feb 2015 13:52:44 -0800
changeset 229479 bce595d4ed1c851c7b6fb1ccef1b3dfce2f0c92c
parent 229478 9d7cc5a9570f382d9ab6408ccec3ed8b00044c12
child 229480 3fe14625f9543330393d8b91628e5d9d1c9e776f
push id11355
push useranaaktgeboren@mozilla.com
push dateTue, 17 Feb 2015 21:53:17 +0000
treeherderfx-team@bce595d4ed1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske
bugs1025703
milestone38.0a1
Bug 1025703 - Ignore autocomplete=off for filling login forms.r=dolske
toolkit/components/passwordmgr/LoginManagerContent.jsm
toolkit/components/passwordmgr/nsLoginManager.js
toolkit/components/passwordmgr/test/mochitest.ini
toolkit/components/passwordmgr/test/test_basic_form_autocomplete.html
toolkit/components/passwordmgr/test/test_basic_form_observer_autocomplete.html
toolkit/components/passwordmgr/test/test_basic_form_observer_foundLogins.html
toolkit/components/passwordmgr/test/test_bug_227640.html
--- a/toolkit/components/passwordmgr/LoginManagerContent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm
@@ -245,17 +245,17 @@ var LoginManagerContent = {
         .then(this.loginsFound.bind(this))
         .then(null, Cu.reportError);
   },
 
   loginsFound: function({ form, loginsFound }) {
     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);
   },
 
   /*
    * onUsernameInput
    *
    * Listens for DOMAutoComplete and blur events on an input field.
    */
   onUsernameInput : function(event) {
@@ -288,17 +288,17 @@ var LoginManagerContent = {
 
     // Make sure the username field fillForm will use is the
     // same field as the autocomplete was activated on.
     var [usernameField, passwordField, ignored] =
         this._getFormFields(acForm, false);
     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 {
       // Ignore the event, it's for some input we don't care about.
     }
   },
 
 
@@ -559,24 +559,23 @@ var LoginManagerContent = {
    *
    * Fill the form with login information if we can find it. This will find
    * an array of logins if not given any, otherwise it will use the logins
    * passed in. The logins are returned so they can be reused for
    * optimization. Success of action is also returned in format
    * [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
     // without need.
     var [usernameField, passwordField, ignored] =
         this._getFormFields(form, false);
 
     // Need a valid password field to do anything.
--- a/toolkit/components/passwordmgr/nsLoginManager.js
+++ b/toolkit/components/passwordmgr/nsLoginManager.js
@@ -582,16 +582,15 @@ LoginManager.prototype = {
    * fillForm
    *
    * Fill the form with login information if we can find it.
    */
   fillForm : function (form) {
     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];
     });
   },
 
 }; // end of LoginManager implementation
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([LoginManager]);
--- a/toolkit/components/passwordmgr/test/mochitest.ini
+++ b/toolkit/components/passwordmgr/test/mochitest.ini
@@ -35,26 +35,24 @@ support-files =
 [test_basic_form_2pw_1.html]
 [test_basic_form_2pw_2.html]
 [test_basic_form_3pw_1.html]
 [test_basic_form_autocomplete.html]
 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]
 [test_basic_form_pwonly.html]
 [test_bug_221634.html]
 # 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]
 [test_bug_391514.html]
 [test_bug_427033.html]
 [test_bug_444968.html]
 [test_bug_627616.html]
 skip-if = toolkit == 'android' #TIMED_OUT
--- a/toolkit/components/passwordmgr/test/test_basic_form_autocomplete.html
+++ b/toolkit/components/passwordmgr/test/test_basic_form_autocomplete.html
@@ -553,23 +553,23 @@ function* runTest() {
   checkACForm("", "");
   numLogins = pwmgr.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
   is(numLogins, 1, "Correct number of logins after deleting one");
   pwmgr.removeLogin(login0); // remove the login that's not shown in the list.
   testNum = 99;
   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();
   doKey("down");
   yield runNextTest("expect popup");
 
   /* test 101 */
   // Check first entry
@@ -580,18 +580,18 @@ function* runTest() {
   checkACForm("singleuser5", "singlepass5");
   restoreForm(); // clear field, so reloading test doesn't fail
   yield runNextTest();
 
   /* test 102 */
   // Turn our attention to form3
   uname = $_(3, "uname");
   pword = $_(3, "pword");
-  checkACForm("", "");
-
+  checkACForm("singleuser5", "singlepass5");
+  
   // Trigger autocomplete popup
   restoreForm();
   doKey("down");
   yield runNextTest("expect popup");
 
   /* test 103 */
   // Check first entry
   doKey("down");
@@ -600,17 +600,17 @@ function* runTest() {
   yield waitForCompletion();
   checkACForm("singleuser5", "singlepass5");
   yield runNextTest();
 
   /* test 104 */
   // Turn our attention to form4
   uname = $_(4, "uname");
   pword = $_(4, "pword");
-  checkACForm("", "");
+  checkACForm("singleuser5", "singlepass5");
 
   // Trigger autocomplete popup
   restoreForm();
   doKey("down");
   yield runNextTest("expect popup");
 
   /* test 105 */
   // Check first entry
@@ -620,17 +620,17 @@ function* runTest() {
   yield waitForCompletion();
   checkACForm("singleuser5", "singlepass5");
   yield runNextTest();
 
   /* test 106 */
   // Turn our attention to form5
   uname = $_(5, "uname");
   pword = $_(5, "pword");
-  checkACForm("", "");
+  checkACForm("singleuser5", "singlepass5");
 
   // Trigger autocomplete popup
   restoreForm();
   doKey("down");
   yield runNextTest("expect popup");
 
   /* test 107 */
   // Check first entry
deleted file mode 100644
--- a/toolkit/components/passwordmgr/test/test_basic_form_observer_autocomplete.html
+++ /dev/null
@@ -1,103 +0,0 @@
-<!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>
--- a/toolkit/components/passwordmgr/test/test_basic_form_observer_foundLogins.html
+++ b/toolkit/components/passwordmgr/test/test_basic_form_observer_foundLogins.html
@@ -39,17 +39,17 @@ var TestObserver = {
       var id = formInfo.get("passwordField").form.id;
       this.results[id].receivedNotification = true;
       this.results[id].data = formInfo;
     }
   }
 };
 
 // Initialize the object that stores the results of notifications.
-for (var formID of ["form1", "form2", "form3", "form4", "form5"])
+for (var formID of ["form1", "form2", "form3", "form5"])
   TestObserver.results[formID] = { receivedNotification: false, data: null };
 
 // Add the observer
 SpecialPowers.addObserver(TestObserver, "passwordmgr-found-logins", false);
 </script>
 
 <p id="display"></p>
 
@@ -77,25 +77,16 @@ SpecialPowers.addObserver(TestObserver, 
     <p>This is form 3.</p>
     <input  type="text"       name="uname">
     <input  type="password"   name="pword" value="existing">
 
     <button type="submit">Submit</button>
     <button type="reset"> Reset </button>
   </form>
 
-  <form id="form4" action="formtest.js" autocomplete="off">
-    <p>This is form 4.</p>
-    <input  type="text"       name="uname">
-    <input  type="password"   name="pword">
-
-    <button type="submit">Submit</button>
-    <button type="reset"> Reset </button>
-  </form>
-
   <form id="form5" action="http://www.example.com">
     <p>This is form 5.</p>
     <input  type="text"       name="uname">
     <input  type="password"   name="pword">
 
     <button type="submit">Submit</button>
     <button type="reset"> Reset </button>
   </form>
@@ -134,27 +125,16 @@ function startTest(){
   is(TestObserver.results["form3"].receivedNotification, true, "Checking observer was notified");
   is(TestObserver.results["form3"].data.get("didntFillReason"), "existingPassword", "Checking didntFillReason is existingPassword");
   is(SpecialPowers.unwrap(TestObserver.results["form3"].data.get("usernameField")), $_(3, "uname"), "Checking username field is correct");
   is(SpecialPowers.unwrap(TestObserver.results["form3"].data.get("passwordField")), $_(3, "pword"), "Checking password field is correct");
   is(TestObserver.results["form3"].data.get("foundLogins").constructor.name, "Array", "Checking foundLogins is array");
   is(TestObserver.results["form3"].data.get("foundLogins").length, 1, "Checking foundLogins contains one login");
   is(TestObserver.results["form3"].data.get("selectedLogin"), null, "Checking selectedLogin is null");
 
-  // Test notification of a form that wasn't filled because autocomplete is off.
-  is(TestObserver.results["form4"].receivedNotification, true, "Checking observer was notified");
-  is(TestObserver.results["form4"].data.get("didntFillReason"), "autocompleteOff", "Checking didntFillReason is autocompleteOff");
-  is(SpecialPowers.unwrap(TestObserver.results["form4"].data.get("usernameField")), $_(4, "uname"), "Checking username field is correct");
-  is(SpecialPowers.unwrap(TestObserver.results["form4"].data.get("passwordField")), $_(4, "pword"), "Checking password field is correct");
-  is(TestObserver.results["form4"].data.get("foundLogins").constructor.name, "Array", "Checking foundLogins is array");
-  is(TestObserver.results["form4"].data.get("foundLogins").length, 1, "Checking foundLogins contains one login");
-  ok(TestObserver.results["form4"].data.get("selectedLogin").QueryInterface(Ci.nsILoginInfo), "Checking selectedLogin is nsILoginInfo");
-  ok(TestObserver.results["form4"].data.get("selectedLogin").equals(TestObserver.results["form4"].data.get("foundLogins")[0]),
-     "Checking selectedLogin is found login");
-
   // Test notification of a form that wasn't filled because multiple logins
   // are available for the form.
   is(TestObserver.results["form5"].receivedNotification, true, "Checking observer was notified");
   is(TestObserver.results["form5"].data.get("didntFillReason"), "multipleLogins", "Checking didntFillReason is multipleLogins");
   is(SpecialPowers.unwrap(TestObserver.results["form5"].data.get("usernameField")), $_(5, "uname"), "Checking username field is correct");
   is(SpecialPowers.unwrap(TestObserver.results["form5"].data.get("passwordField")), $_(5, "pword"), "Checking password field is correct");
   is(TestObserver.results["form5"].data.get("foundLogins").constructor.name, "Array", "Checking foundLogins is array");
   is(TestObserver.results["form5"].data.get("foundLogins").length, 2, "Checking foundLogins contains two logins");
deleted file mode 100644
--- a/toolkit/components/passwordmgr/test/test_bug_227640.html
+++ /dev/null
@@ -1,243 +0,0 @@
-<!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: 227640
-<script>
-commonInit();
-SimpleTest.waitForExplicitFinish();
-
-var pwmgr = SpecialPowers.Cc["@mozilla.org/login-manager;1"]
-                         .getService(SpecialPowers.Ci.nsILoginManager);
-</script>
-
-<p id="display"></p>
-<div id="content" style="display: none">
-
-  <!-- no autocomplete for password field -->
-  <form id="form1" onsubmit="return checkSubmit(1)" method="get">
-    <input  type="text"       name="uname" value="">
-    <input  type="password"   name="pword" value="" autocomplete=off>
-
-    <button type="submit">Submit</button>
-    <button type="reset"> Reset </button>
-  </form>
-
-  <!-- no autocomplete for username field -->
-  <form id="form2" onsubmit="return checkSubmit(2);" method="get">
-    <input  type="text"       name="uname" value="" autocomplete=off>
-    <input  type="password"   name="pword" value="">
-
-    <button type="submit">Submit</button>
-    <button type="reset"> Reset </button>
-  </form>
-
-  <!-- no autocomplete for username or password fields -->
-  <form id="form3" onsubmit="return checkSubmit(3);" method="get">
-    <input  type="text"       name="uname" value="" autocomplete=off>
-    <input  type="password"   name="pword" value="" autocomplete=off>
-
-    <button type="submit">Submit</button>
-    <button type="reset"> Reset </button>
-  </form>
-
-  <!-- no autocomplete for entire form -->
-  <form id="form4" onsubmit="return checkSubmit(4);" method="get" autocomplete=off>
-    <input  type="text"       name="uname" value="">
-    <input  type="password"   name="pword" value="">
-
-    <button type="submit">Submit</button>
-    <button type="reset"> Reset </button>
-  </form>
-
-  <!-- no autocomplete for entire form and password field -->
-  <form id="form5" onsubmit="return checkSubmit(5);" method="get">
-    <input  type="text"       name="uname" value="">
-    <input  type="password"   name="pword" value="" autocomplete=off>
-
-    <button type="submit">Submit</button>
-    <button type="reset"> Reset </button>
-  </form>
-
-  <!-- no autocomplete for entire form and username field -->
-  <form id="form6" onsubmit="return checkSubmit(6);" method="get">
-    <input  type="text"       name="uname" value="" autocomplete=off>
-    <input  type="password"   name="pword" value="">
-
-    <button type="submit">Submit</button>
-    <button type="reset"> Reset </button>
-  </form>
-
-  <!-- no autocomplete for entire form, userfield, and password field -->
-  <form id="form7" onsubmit="return checkSubmit(7);" method="get" autocomplete=off>
-    <input  type="text"       name="uname" value="" autocomplete=off>
-    <input  type="password"   name="pword" value="" autocomplete=off>
-
-    <button type="submit">Submit</button>
-    <button type="reset"> Reset </button>
-  </form>
-
-
-  <!-- ===== repeat, but with logins not previously stored ===== -->
-
-
-  <!-- no autocomplete for password field -->
-  <form id="form8" onsubmit="return checkSubmit(8);" method="get">
-    <input  type="text"       name="xxxuname" value="newuser">
-    <input  type="password"   name="xxxpword" value="newpass" autocomplete=off>
-
-    <button type="submit">Submit</button>
-    <button type="reset"> Reset </button>
-  </form>
-
-  <!-- no autocomplete for username field -->
-  <form id="form9" onsubmit="return checkSubmit(9);" method="get">
-    <input  type="text"       name="xxxuname" value="newuser" autocomplete=off>
-    <input  type="password"   name="xxxpword" value="newpass">
-
-    <button type="submit">Submit</button>
-    <button type="reset"> Reset </button>
-  </form>
-
-  <!-- no autocomplete for username or password fields -->
-  <form id="form10" onsubmit="return checkSubmit(10);" method="get">
-    <input  type="text"       name="xxxuname" value="newuser" autocomplete=off>
-    <input  type="password"   name="xxxpword" value="newpass" autocomplete=off>
-
-    <button type="submit">Submit</button>
-    <button type="reset"> Reset </button>
-  </form>
-
-  <!-- no autocomplete for entire form -->
-  <form id="form11" onsubmit="return checkSubmit(11);" method="get" autocomplete=off>
-    <input  type="text"       name="xxxuname" value="newuser">
-    <input  type="password"   name="xxxpword" value="newpass">
-
-    <button type="submit">Submit</button>
-    <button type="reset"> Reset </button>
-  </form>
-
-  <!-- no autocomplete for entire form and password field -->
-  <form id="form12" onsubmit="return checkSubmit(12);" method="get">
-    <input  type="text"       name="xxxuname" value="newuser">
-    <input  type="password"   name="xxxpword" value="newpass" autocomplete=off>
-
-    <button type="submit">Submit</button>
-    <button type="reset"> Reset </button>
-  </form>
-
-  <!-- no autocomplete for entire form and username field -->
-  <form id="form13" onsubmit="return checkSubmit(13);" method="get">
-    <input  type="text"       name="xxxuname" value="newuser" autocomplete=off>
-    <input  type="password"   name="xxxpword" value="newpass">
-
-    <button type="submit">Submit</button>
-    <button type="reset"> Reset </button>
-  </form>
-
-  <!-- no autocomplete for entire form, userfield, and password field -->
-  <form id="form14" onsubmit="return checkSubmit(14);" method="get" autocomplete=off>
-    <input  type="text"       name="xxxuname" value="newuser" autocomplete=off>
-    <input  type="password"   name="xxxpword" value="newpass" autocomplete=off>
-
-    <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: 227640 (password is saved even when the
-    password field has autocomplete="off") **/
-
-// This test ensures that pwmgr does not save a username or password when
-// autocomplete=off is present.
-
-var numStartingLogins = 0;
-var numSubmittedForms = 0;
-
-function startTest() {
-  // Get current number of logins, so we can know if some accidently get
-  // added during the test.
-  numStartingLogins = countLogins();
-  ok(numStartingLogins > 0, "counting logins at start");
-
-  // Check first set of forms, which should not be filled by pwmgr.
-  for (var i = 1; i <= 7; i++) {
-    is($_(i, "uname").value, "", "Checking for unfilled username " + i);
-    is($_(i, "pword").value, "", "Checking for unfilled password " + i);
-    // Set the field values to that of an existing login
-    $_(i, "uname").value = "testuser";
-    $_(i, "pword").value = "testpass";
-  }
-
-  // Check second set of forms, which should have preset values (and are unknown to pwmgr).
-  for (var i = 8; i <= 14; i++) {
-    is($_(i, "xxxuname").value, "newuser", "Checking unmodified username " + i);
-    is($_(i, "xxxpword").value, "newpass", "Checking unmodified password " + i);
-  }
-
-  var button = getFormSubmitButton(1);
-
-  // submit the first form.
-  button.click();
-}
-
-
-// Called by each form's onsubmit handler.
-function checkSubmit(formNum) {
-  numSubmittedForms++;
-
-  // End the test at the last form.
-  if (formNum == 14) {
-    is(numSubmittedForms, 14, "Ensuring all forms were submitted.");;
-
-    var numEndingLogins = countLogins();
-    ok(numEndingLogins > 0, "counting logins at end");
-
-    is(numStartingLogins, numEndingLogins, "counting logins at end");
-
-    SimpleTest.finish();
-    return false; // return false to cancel current form submission
-  }
-
-  var button = getFormSubmitButton(formNum + 1);
-
-  // submit the next form.
-  button.click();
-
-  return false; // return false to cancel current form submission
-}
-
-
-function getFormSubmitButton(formNum) {
-  var form = $("form" + formNum); // by id, not name
-  ok(form != null, "getting form " + formNum);
-
-  // we can't just call form.submit(), because that doesn't seem to
-  // invoke the form onsubmit handler.
-  var button = form.firstChild;
-  while (button && button.type != "submit") { button = button.nextSibling; }
-  ok(button != null, "getting form submit button");
-
-  return button;
-}
-
-// Counts the number of logins currently stored by password manager.
-function countLogins() {
-  var logins = pwmgr.getAllLogins();
-
-  return logins.length;
-}
-window.addEventListener("runTests", startTest);
-</script>
-</pre>
-</body>
-</html>
-