toolkit/components/passwordmgr/test/test_basic_form_pwevent.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=355063
     5 -->
     6 <head>
     7   <meta charset="utf-8"/>
     8   <title>Test for Bug 355063</title>
     9   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    11   <script type="text/javascript" src="pwmgr_common.js"></script>
    12   <script type="application/javascript">
    13   /** Test for Bug 355063 **/
    15   function startTest() {
    16     info("startTest");
    17     addForm();
    18   }
    20   function addForm() {
    21     info("addForm");
    22     var c = document.getElementById("content");
    23     c.innerHTML = "<form id=form1>form1: <input id=u1><input type=password id=p1></form><br>";
    24   }
    26   function checkForm() {
    27     info("checkForm");
    28     var userField = document.getElementById("u1");
    29     var passField = document.getElementById("p1");
    30     is(userField.value, "testuser", "checking filled username");
    31     is(passField.value, "testpass", "checking filled password");
    33     SpecialPowers.removeChromeEventListener("DOMFormHasPassword", checkForm);
    34     SimpleTest.finish();
    35   }
    37   commonInit();
    39   // Password Manager's own listener should always have been added first, so
    40   // the test's listener should be called after the pwmgr's listener fills in
    41   // a login.
    42   //
    43   SpecialPowers.addChromeEventListener("DOMFormHasPassword", checkForm);
    44   window.addEventListener("load", startTest);
    45   SimpleTest.waitForExplicitFinish();
    46 </script>
    47 </head>
    48 <body>
    49 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=355063">Mozilla Bug 355063</a>
    50 <p id="display"></p>
    51 <div id="content">
    52 forms go here!
    53 </div>
    54 <pre id="test">
    55 </pre>
    56 </body>
    57 </html>

mercurial