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

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

mercurial