1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/passwordmgr/test/test_bug_242956.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,128 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 + <title>Test for Login Manager</title> 1.8 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.9 + <script type="text/javascript" src="pwmgr_common.js"></script> 1.10 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.11 +</head> 1.12 +<body> 1.13 +Login Manager test: 242956 1.14 +<p id="display"></p> 1.15 +<div id="content" style="display: none"> 1.16 + <!-- pword is not a type=password input --> 1.17 + <form id="form1" action="formtest.js"> 1.18 + <input type="text" name="uname"> 1.19 + <input type="text" name="pword"> 1.20 + 1.21 + <button type="submit">Submit</button> 1.22 + <button type="reset"> Reset </button> 1.23 + </form> 1.24 + 1.25 + <!-- uname is not a type=text input --> 1.26 + <form id="form2" action="formtest.js"> 1.27 + <input type="password" name="uname"> 1.28 + <input type="password" name="pword"> 1.29 + 1.30 + <button type="submit">Submit</button> 1.31 + <button type="reset"> Reset </button> 1.32 + </form> 1.33 + 1.34 + <!-- two "pword" inputs, (text + password) --> 1.35 + <form id="form3" action="formtest.js"> 1.36 + <input type="text" name="uname"> 1.37 + <input type="text" name="pword"> 1.38 + <input type="password" name="qword"> 1.39 + 1.40 + <button type="submit">Submit</button> 1.41 + <button type="reset"> Reset </button> 1.42 + </form> 1.43 + 1.44 + <!-- same thing, different order --> 1.45 + <form id="form4" action="formtest.js"> 1.46 + <input type="text" name="uname"> 1.47 + <input type="password" name="pword"> 1.48 + <input type="text" name="qword"> 1.49 + 1.50 + <button type="submit">Submit</button> 1.51 + <button type="reset"> Reset </button> 1.52 + </form> 1.53 + 1.54 + <!-- uname is not a type=text input (try a checkbox just for variety) --> 1.55 + <form id="form5" action="formtest.js"> 1.56 + <input type="checkbox" name="uname" value=""> 1.57 + <input type="password" name="pword"> 1.58 + 1.59 + <button type="submit">Submit</button> 1.60 + <button type="reset"> Reset </button> 1.61 + </form> 1.62 + 1.63 + <!-- pword is not a type=password input (try a checkbox just for variety) --> 1.64 + <form id="form6" action="formtest.js"> 1.65 + <input type="text" name="uname"> 1.66 + <input type="checkbox" name="pword" value=""> 1.67 + 1.68 + <button type="submit">Submit</button> 1.69 + <button type="reset"> Reset </button> 1.70 + </form> 1.71 + 1.72 + <!-- pword is not a type=password input --> 1.73 + <form id="form7" action="formtest.js"> 1.74 + <input type="text" name="uname" value="testuser"> 1.75 + <input type="text" name="pword"> 1.76 + 1.77 + <button type="submit">Submit</button> 1.78 + <button type="reset"> Reset </button> 1.79 + </form> 1.80 + 1.81 + 1.82 +</div> 1.83 +<pre id="test"> 1.84 +<script class="testbody" type="text/javascript"> 1.85 + 1.86 +/** Test for Login Manager: 242956 (Stored password is inserted into a 1.87 + readable text input on a second page) **/ 1.88 +commonInit(); 1.89 + 1.90 +// Make sure that pwmgr only puts passwords into type=password <input>s. 1.91 +// Might as well test the converse, too (username in password field). 1.92 + 1.93 +function startTest() { 1.94 + var form, input; 1.95 + 1.96 + is($_(1, "uname").value, "", "Checking for unfilled username 1"); 1.97 + is($_(1, "pword").value, "", "Checking for unfilled password 1"); 1.98 + 1.99 + is($_(2, "uname").value, "testpass", "Checking for password not username 2"); 1.100 + is($_(2, "pword").value, "", "Checking for unfilled password 2"); 1.101 + 1.102 + is($_(3, "uname").value, "", "Checking for unfilled username 3"); 1.103 + is($_(3, "pword").value, "testuser", "Checking for unfilled password 3"); 1.104 + is($_(3, "qword").value, "testpass", "Checking for unfilled qassword 3"); 1.105 + 1.106 + is($_(4, "uname").value, "testuser", "Checking for password not username 4"); 1.107 + is($_(4, "pword").value, "testpass", "Checking for unfilled password 4"); 1.108 + is($_(4, "qword").value, "", "Checking for unfilled qassword 4"); 1.109 + 1.110 + is($_(5, "uname").value, "", "Checking for unfilled username 5"); 1.111 + is($_(5, "pword").value, "testpass", "Checking for filled password 5"); 1.112 + 1.113 + is($_(6, "uname").value, "", "Checking for unfilled username 6"); 1.114 + is($_(6, "pword").value, "", "Checking for unfilled password 6"); 1.115 + 1.116 + is($_(7, "uname").value, "testuser", "Checking for unmodified username 7"); 1.117 + is($_(7, "pword").value, "", "Checking for unfilled password 7"); 1.118 + 1.119 + 1.120 + 1.121 + SimpleTest.finish(); 1.122 +} 1.123 + 1.124 +window.onload = startTest; 1.125 + 1.126 +SimpleTest.waitForExplicitFinish(); 1.127 + 1.128 +</script> 1.129 +</pre> 1.130 +</body> 1.131 +</html>