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