DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (5b81998bb7ab)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
<!DOCTYPE HTML>
<html>
<head>
  <title>Test for Login Manager</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="pwmgr_common.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
Login Manager test: forms with 2 password fields

<p id="display"></p>

<div id="content" style="display: none">


<!-- no username fields -->

<form id='form1' action='formtest.js'> 1
    <!-- simple form, fill in first pw -->
    <input type='password' name='pname' value=''>
    <input type='password' name='qname' value=''>
    <button type='submit'>Submit</button>
</form>

<form id='form2' action='formtest.js'> 2
    <!-- same but reverse pname and qname, field names are ignored. -->
    <input type='password' name='qname' value=''>
    <input type='password' name='pname' value=''>
    <button type='submit'>Submit</button>
</form>

<form id='form3' action='formtest.js'> 3
    <!-- text field after password fields should be ignored, no username. -->
    <input type='password' name='pname' value=''>
    <input type='password' name='qname' value=''>
    <input type='text'     name='uname' value=''>
    <button type='submit'>Submit</button>
</form>

<form id='form4' action='formtest.js'> 4
    <!-- nothing to do, password already present -->
    <input type='password' name='pname' value='testpass'>
    <input type='password' name='qname' value=''>
    <button type='submit'>Submit</button>
</form>

<form id='form5' action='formtest.js'> 5
    <!-- don't clobber an existing unrecognized password -->
    <input type='password' name='pname' value='xxxxxxxx'>
    <input type='password' name='qname' value=''>
    <button type='submit'>Submit</button>
</form>

<form id='form6' action='formtest.js'> 6
    <!-- fill in first field, 2nd field shouldn't be touched anyway. -->
    <input type='password' name='pname' value=''>
    <input type='password' name='qname' value='xxxxxxxx'>
    <button type='submit'>Submit</button>
</form>



<!-- with username fields -->



<form id='form7' action='formtest.js'> 7
    <!-- simple form, should fill in username and first pw -->
    <input type='text'     name='uname' value=''>
    <input type='password' name='pname' value=''>
    <input type='password' name='qname' value=''>
    <button type='submit'>Submit</button>
</form>

<form id='form8' action='formtest.js'> 8
    <!-- reverse pname and qname, field names are ignored. -->
    <input type='text'     name='uname' value=''>
    <input type='password' name='qname' value=''>
    <input type='password' name='pname' value=''>
    <button type='submit'>Submit</button>
</form>

<form id='form9' action='formtest.js'> 9
    <!-- username already filled, so just fill first password -->
    <input type='text'     name='uname' value='testuser'>
    <input type='password' name='pname' value=''>
    <input type='password' name='qname' value=''>
    <button type='submit'>Submit</button>
</form>

<form id='form10' action='formtest.js'> 10
    <!-- unknown username, don't fill in a password -->
    <input type='text'     name='uname' value='xxxxxxxx'>
    <input type='password' name='pname' value=''>
    <input type='password' name='qname' value=''>
    <button type='submit'>Submit</button>
</form>

<form id='form11' action='formtest.js'> 11
    <!-- don't clobber unknown password -->
    <input type='text'     name='uname' value='testuser'>
    <input type='password' name='pname' value='xxxxxxxx'>
    <input type='password' name='qname' value=''>
    <button type='submit'>Submit</button>
</form>

<form id='form12' action='formtest.js'> 12
    <!-- fill in 1st pass, don't clobber 2nd pass -->
    <input type='text'     name='uname' value='testuser'>
    <input type='password' name='pname' value=''>
    <input type='password' name='qname' value='xxxxxxxx'>
    <button type='submit'>Submit</button>
</form>

<form id='form13' action='formtest.js'> 13
    <!-- nothing to do, user and pass prefilled. life is easy. -->
    <input type='text'     name='uname' value='testuser'>
    <input type='password' name='pname' value='testpass'>
    <input type='password' name='qname' value=''>
    <button type='submit'>Submit</button>
</form>

<form id='form14' action='formtest.js'> 14
    <!-- shouldn't fill in username because 1st pw field is unknown. -->
    <input type='text'     name='uname' value=''>
    <input type='password' name='pname' value='xxxxxxxx'>
    <input type='password' name='qname' value='testpass'>
    <button type='submit'>Submit</button>
</form>

<form id='form15' action='formtest.js'> 15
    <!-- textfield in the middle of pw fields should be ignored -->
    <input type='password' name='pname' value=''>
    <input type='text'     name='uname' value=''>
    <input type='password' name='qname' value=''>
    <button type='submit'>Submit</button>
</form>

<form id='form16' action='formtest.js'> 16
    <!-- same, and don't clobber existing unknown password -->
    <input type='password' name='pname' value='xxxxxxxx'>
    <input type='text'     name='uname' value=''>
    <input type='password' name='qname' value=''>
    <button type='submit'>Submit</button>
</form>


</div>

<pre id="test">
<script class="testbody" type="text/javascript">

/** Test for Login Manager: simple form fill **/

commonInit();

function startTest() {
    var f = 1;

    // 1-6 no username
    checkForm(f++, "testpass", "");
    checkForm(f++, "testpass", "");
    checkForm(f++, "testpass", "", "");
    checkForm(f++, "testpass", "");
    checkForm(f++, "xxxxxxxx", "");
    checkForm(f++, "testpass", "xxxxxxxx");

    // 7-15 with username
    checkForm(f++, "testuser", "testpass", "");
    checkForm(f++, "testuser", "testpass", "");
    checkForm(f++, "testuser", "testpass", "");
    checkForm(f++, "xxxxxxxx", "", "");
    checkForm(f++, "testuser", "xxxxxxxx", "");
    checkForm(f++, "testuser", "testpass", "xxxxxxxx");
    checkForm(f++, "testuser", "testpass", "");
    checkForm(f++, "",         "xxxxxxxx", "testpass");
    checkForm(f++, "testpass", "",         "");
    checkForm(f++, "xxxxxxxx", "",         "");

    SimpleTest.finish();
}


window.onload = startTest;

SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>