toolkit/components/passwordmgr/test/test_basic_form_pwevent.html

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:2026534545c1
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 **/
14
15 function startTest() {
16 info("startTest");
17 addForm();
18 }
19
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 }
25
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");
32
33 SpecialPowers.removeChromeEventListener("DOMFormHasPassword", checkForm);
34 SimpleTest.finish();
35 }
36
37 commonInit();
38
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