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

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>Test for Login Manager</title>
michael@0 5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 6 <script type="text/javascript" src="pwmgr_common.js"></script>
michael@0 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 8 </head>
michael@0 9 <body>
michael@0 10 Login Manager test: master password cleanup
michael@0 11 <p id="display"></p>
michael@0 12
michael@0 13 <div id="content" style="display: none">
michael@0 14 </div>
michael@0 15
michael@0 16 <pre id="test">
michael@0 17 <script class="testbody" type="text/javascript">
michael@0 18
michael@0 19
michael@0 20 /*
michael@0 21 * The entire purpose of this test is to make sure that, if the previous master
michael@0 22 * password test did not complete successfully, we don't screw up other pwmgr
michael@0 23 * tests by having a master password unexpectedly set.
michael@0 24 */
michael@0 25 function cleanup() {
michael@0 26 ok(true, "ensuring MP is cleared");
michael@0 27
michael@0 28 var pk11db = Cc["@mozilla.org/security/pk11tokendb;1"].
michael@0 29 getService(Ci.nsIPK11TokenDB);
michael@0 30 var token = pk11db.getInternalKeyToken();
michael@0 31
michael@0 32 if (!token.checkPassword("")) {
michael@0 33 ok(true, "Oops! MP still set, clearing it...");
michael@0 34 disableMasterPassword();
michael@0 35 } else {
michael@0 36 ok(true, "Master password already cleared.");
michael@0 37 }
michael@0 38
michael@0 39 ok(true, "done.");
michael@0 40 }
michael@0 41
michael@0 42 const Cc = SpecialPowers.Cc;
michael@0 43 const Ci = SpecialPowers.Ci;
michael@0 44
michael@0 45 cleanup();
michael@0 46 </script>
michael@0 47 </pre>
michael@0 48 </body>
michael@0 49 </html>
michael@0 50

mercurial