toolkit/components/passwordmgr/test/test_master_password_cleanup.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:fb5d6f360ff8
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>
12
13 <div id="content" style="display: none">
14 </div>
15
16 <pre id="test">
17 <script class="testbody" type="text/javascript">
18
19
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");
27
28 var pk11db = Cc["@mozilla.org/security/pk11tokendb;1"].
29 getService(Ci.nsIPK11TokenDB);
30 var token = pk11db.getInternalKeyToken();
31
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 }
38
39 ok(true, "done.");
40 }
41
42 const Cc = SpecialPowers.Cc;
43 const Ci = SpecialPowers.Ci;
44
45 cleanup();
46 </script>
47 </pre>
48 </body>
49 </html>
50

mercurial