toolkit/components/passwordmgr/test/test_bug_242956.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

     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: 242956
    11 <p id="display"></p>
    12 <div id="content" style="display: none">
    13   <!-- pword is not a type=password input -->
    14   <form id="form1" action="formtest.js">
    15     <input  type="text" name="uname">
    16     <input  type="text" name="pword">
    18     <button type="submit">Submit</button>
    19     <button type="reset"> Reset </button>
    20   </form>
    22   <!-- uname is not a type=text input -->
    23   <form id="form2" action="formtest.js">
    24     <input  type="password" name="uname">
    25     <input  type="password" name="pword">
    27     <button type="submit">Submit</button>
    28     <button type="reset"> Reset </button>
    29   </form>
    31   <!-- two "pword" inputs, (text + password) -->
    32   <form id="form3" action="formtest.js">
    33     <input  type="text"       name="uname">
    34     <input  type="text"       name="pword">
    35     <input  type="password"   name="qword">
    37     <button type="submit">Submit</button>
    38     <button type="reset"> Reset </button>
    39   </form>
    41   <!-- same thing, different order -->
    42   <form id="form4" action="formtest.js">
    43     <input  type="text"       name="uname">
    44     <input  type="password"   name="pword">
    45     <input  type="text"       name="qword">
    47     <button type="submit">Submit</button>
    48     <button type="reset"> Reset </button>
    49   </form>
    51   <!-- uname is not a type=text input (try a checkbox just for variety) -->
    52   <form id="form5" action="formtest.js">
    53     <input  type="checkbox" name="uname" value="">
    54     <input  type="password" name="pword">
    56     <button type="submit">Submit</button>
    57     <button type="reset"> Reset </button>
    58   </form>
    60   <!-- pword is not a type=password input (try a checkbox just for variety) -->
    61   <form id="form6" action="formtest.js">
    62     <input  type="text"     name="uname">
    63     <input  type="checkbox" name="pword" value="">
    65     <button type="submit">Submit</button>
    66     <button type="reset"> Reset </button>
    67   </form>
    69   <!-- pword is not a type=password input -->
    70   <form id="form7" action="formtest.js">
    71     <input  type="text" name="uname" value="testuser">
    72     <input  type="text" name="pword">
    74     <button type="submit">Submit</button>
    75     <button type="reset"> Reset </button>
    76   </form>
    79 </div>
    80 <pre id="test">
    81 <script class="testbody" type="text/javascript">
    83 /** Test for Login Manager: 242956 (Stored password is inserted into a
    84     readable text input on a second page) **/
    85 commonInit();
    87 // Make sure that pwmgr only puts passwords into type=password <input>s.
    88 // Might as well test the converse, too (username in password field).
    90 function startTest() {
    91   var form, input;
    93   is($_(1, "uname").value, "", "Checking for unfilled username 1");
    94   is($_(1, "pword").value, "", "Checking for unfilled password 1");
    96   is($_(2, "uname").value, "testpass", "Checking for password not username 2");
    97   is($_(2, "pword").value, "", "Checking for unfilled password 2");
    99   is($_(3, "uname").value, "", "Checking for unfilled username 3");
   100   is($_(3, "pword").value, "testuser", "Checking for unfilled password 3");
   101   is($_(3, "qword").value, "testpass", "Checking for unfilled qassword 3");
   103   is($_(4, "uname").value, "testuser", "Checking for password not username 4");
   104   is($_(4, "pword").value, "testpass", "Checking for unfilled password 4");
   105   is($_(4, "qword").value, "", "Checking for unfilled qassword 4");
   107   is($_(5, "uname").value, "", "Checking for unfilled username 5");
   108   is($_(5, "pword").value, "testpass", "Checking for filled password 5");
   110   is($_(6, "uname").value, "", "Checking for unfilled username 6");
   111   is($_(6, "pword").value, "", "Checking for unfilled password 6");
   113   is($_(7, "uname").value, "testuser", "Checking for unmodified username 7");
   114   is($_(7, "pword").value, "",         "Checking for unfilled password 7");
   118   SimpleTest.finish();
   119 }
   121 window.onload = startTest;
   123 SimpleTest.waitForExplicitFinish();
   125 </script>
   126 </pre>
   127 </body>
   128 </html>

mercurial