DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (5b81998bb7ab)

VCS Links

Line Code
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 50 51 52 53
<!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">
<iframe id="iframe1"></iframe>
<iframe id="iframe2"></iframe>
</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.");
}

netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
const Cc = Components.classes;
const Ci = Components.interfaces;

cleanup();
</script>
</pre>
</body>
</html>