toolkit/components/passwordmgr/test/test_basic_form_1pw.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>Test for Login Manager</title>
michael@0 5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 6 <script type="text/javascript" src="pwmgr_common.js"></script>
michael@0 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 8 </head>
michael@0 9 <body>
michael@0 10 Login Manager test: forms with 1 password field
michael@0 11 <p id="display"></p>
michael@0 12
michael@0 13 <div id="content" style="display: none">
michael@0 14
michael@0 15 <!-- no username fields -->
michael@0 16
michael@0 17 <form id='form1' action='formtest.js'> 1
michael@0 18 <!-- Blank, so fill in the password -->
michael@0 19 <input type='password' name='pname' value=''>
michael@0 20 <button type='submit'>Submit</button>
michael@0 21 </form>
michael@0 22
michael@0 23 <form id='form2' action='formtest.js'> 2
michael@0 24 <!-- Already contains the password, so nothing to do. -->
michael@0 25 <input type='password' name='pname' value='testpass'>
michael@0 26 <button type='submit'>Submit</button>
michael@0 27 </form>
michael@0 28
michael@0 29 <form id='form3' action='formtest.js'> 3
michael@0 30 <!-- Contains unknown password, so don't change it -->
michael@0 31 <input type='password' name='pname' value='xxxxxxxx'>
michael@0 32 <button type='submit'>Submit</button>
michael@0 33 </form>
michael@0 34
michael@0 35
michael@0 36 <!-- username fields -->
michael@0 37
michael@0 38 <form id='form4' action='formtest.js'> 4
michael@0 39 <!-- Blanks, so fill in login -->
michael@0 40 <input type='text' name='uname' value=''>
michael@0 41 <input type='password' name='pname' value=''>
michael@0 42 <button type='submit'>Submit</button>
michael@0 43 </form>
michael@0 44
michael@0 45 <form id='form5' action='formtest.js'> 5
michael@0 46 <!-- Username already set, so fill in password -->
michael@0 47 <input type='text' name='uname' value='testuser'>
michael@0 48 <input type='password' name='pname' value=''>
michael@0 49 <button type='submit'>Submit</button>
michael@0 50 </form>
michael@0 51
michael@0 52 <form id='form6' action='formtest.js'> 6
michael@0 53 <!-- Unknown username, so don't fill in password -->
michael@0 54 <input type='text' name='uname' value='xxxxxxxx'>
michael@0 55 <input type='password' name='pname' value=''>
michael@0 56 <button type='submit'>Submit</button>
michael@0 57 </form>
michael@0 58
michael@0 59 <form id='form7' action='formtest.js'> 7
michael@0 60 <!-- Password already set, could fill in username but that's weird so we don't -->
michael@0 61 <input type='text' name='uname' value=''>
michael@0 62 <input type='password' name='pname' value='testpass'>
michael@0 63 <button type='submit'>Submit</button>
michael@0 64 </form>
michael@0 65
michael@0 66 <form id='form8' action='formtest.js'> 8
michael@0 67 <!-- Unknown password, so don't fill in a username -->
michael@0 68 <input type='text' name='uname' value=''>
michael@0 69 <input type='password' name='pname' value='xxxxxxxx'>
michael@0 70 <button type='submit'>Submit</button>
michael@0 71 </form>
michael@0 72
michael@0 73
michael@0 74
michael@0 75 <!-- extra text fields -->
michael@0 76
michael@0 77 <form id='form9' action='formtest.js'> 9
michael@0 78 <!-- text field _after_ password should never be treated as a username field -->
michael@0 79 <input type='password' name='pname' value=''>
michael@0 80 <input type='text' name='uname' value=''>
michael@0 81 <button type='submit'>Submit</button>
michael@0 82 </form>
michael@0 83
michael@0 84 <form id='form10' action='formtest.js'> 10
michael@0 85 <!-- only the first text field before the password should be for username -->
michael@0 86 <input type='text' name='other' value=''>
michael@0 87 <input type='text' name='uname' value=''>
michael@0 88 <input type='password' name='pname' value=''>
michael@0 89 <button type='submit'>Submit</button>
michael@0 90 </form>
michael@0 91
michael@0 92 <form id='form11' action='formtest.js'> 11
michael@0 93 <!-- variation just to make sure extra text field is still ignored -->
michael@0 94 <input type='text' name='uname' value=''>
michael@0 95 <input type='password' name='pname' value=''>
michael@0 96 <input type='text' name='other' value=''>
michael@0 97 <button type='submit'>Submit</button>
michael@0 98 </form>
michael@0 99
michael@0 100
michael@0 101
michael@0 102 <!-- same as last bunch, but with xxxx in the extra field. -->
michael@0 103
michael@0 104 <form id='form12' action='formtest.js'> 12
michael@0 105 <!-- text field _after_ password should never be treated as a username field -->
michael@0 106 <input type='password' name='pname' value=''>
michael@0 107 <input type='text' name='uname' value='xxxxxxxx'>
michael@0 108 <button type='submit'>Submit</button>
michael@0 109 </form>
michael@0 110
michael@0 111 <form id='form13' action='formtest.js'> 13
michael@0 112 <!-- only the first text field before the password should be for username -->
michael@0 113 <input type='text' name='other' value='xxxxxxxx'>
michael@0 114 <input type='text' name='uname' value=''>
michael@0 115 <input type='password' name='pname' value=''>
michael@0 116 <button type='submit'>Submit</button>
michael@0 117 </form>
michael@0 118
michael@0 119 <form id='form14' action='formtest.js'> 14
michael@0 120 <!-- variation just to make sure extra text field is still ignored -->
michael@0 121 <input type='text' name='uname' value=''>
michael@0 122 <input type='password' name='pname' value=''>
michael@0 123 <input type='text' name='other' value='xxxxxxxx'>
michael@0 124 <button type='submit'>Submit</button>
michael@0 125 </form>
michael@0 126
michael@0 127
michael@0 128 </div>
michael@0 129
michael@0 130 <pre id="test">
michael@0 131 <script class="testbody" type="text/javascript">
michael@0 132
michael@0 133 /** Test for Login Manager: simple form fill **/
michael@0 134
michael@0 135 commonInit();
michael@0 136
michael@0 137 function startTest() {
michael@0 138 var f = 1;
michael@0 139
michael@0 140 // 1-3
michael@0 141 checkForm(f++, "testpass");
michael@0 142 checkForm(f++, "testpass");
michael@0 143 checkForm(f++, "xxxxxxxx");
michael@0 144
michael@0 145 // 4-8
michael@0 146 checkForm(f++, "testuser", "testpass");
michael@0 147 checkForm(f++, "testuser", "testpass");
michael@0 148 checkForm(f++, "xxxxxxxx", "");
michael@0 149 checkForm(f++, "", "testpass");
michael@0 150 checkForm(f++, "", "xxxxxxxx");
michael@0 151
michael@0 152 // 9-14
michael@0 153 checkForm(f++, "testpass", "");
michael@0 154 checkForm(f++, "", "testuser", "testpass");
michael@0 155 checkForm(f++, "testuser", "testpass", "");
michael@0 156 checkForm(f++, "testpass", "xxxxxxxx");
michael@0 157 checkForm(f++, "xxxxxxxx", "testuser", "testpass");
michael@0 158 checkForm(f++, "testuser", "testpass", "xxxxxxxx");
michael@0 159
michael@0 160 SimpleTest.finish();
michael@0 161 }
michael@0 162
michael@0 163
michael@0 164 window.onload = startTest;
michael@0 165
michael@0 166 SimpleTest.waitForExplicitFinish();
michael@0 167 </script>
michael@0 168 </pre>
michael@0 169 </body>
michael@0 170 </html>

mercurial