toolkit/components/passwordmgr/test/test_master_password_cleanup.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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: master password cleanup
    11 <p id="display"></p>
    13 <div id="content" style="display: none">
    14 </div>
    16 <pre id="test">
    17 <script class="testbody" type="text/javascript">
    20 /*
    21  * The entire purpose of this test is to make sure that, if the previous master
    22  * password test did not complete successfully, we don't screw up other pwmgr
    23  * tests by having a master password unexpectedly set.
    24  */
    25 function cleanup() {
    26     ok(true, "ensuring MP is cleared");
    28     var pk11db = Cc["@mozilla.org/security/pk11tokendb;1"].
    29                  getService(Ci.nsIPK11TokenDB);
    30     var token = pk11db.getInternalKeyToken();
    32     if (!token.checkPassword("")) {
    33         ok(true, "Oops! MP still set, clearing it...");
    34         disableMasterPassword();
    35     } else {
    36         ok(true, "Master password already cleared.");
    37     }
    39   ok(true, "done.");
    40 }
    42 const Cc = SpecialPowers.Cc;
    43 const Ci = SpecialPowers.Ci;
    45 cleanup();
    46 </script>
    47 </pre>
    48 </body>
    49 </html>

mercurial