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.

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

mercurial