toolkit/components/passwordmgr/test/test_master_password_cleanup.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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