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 54
<!DOCTYPE HTML>
<html>
<head>
  <title>Test finalization 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: finalization.
<p id="display"></p>
<div id="content" style="display: none">
  
</div>
<pre id="test">
<script class="testbody" type="text/javascript">

/** Test for Login Manager: finalization **/

netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');


// Get the pwmgr service
var Cc_pwmgr = Components.classes["@mozilla.org/login-manager;1"];
ok(Cc_pwmgr != null, "Access Cc[@mozilla.org/login-manager;1]");

var Ci_pwmgr = Components.interfaces.nsILoginManager;
ok(Ci_pwmgr != null, "Access Ci.nsILoginManager");

var pwmgr = Cc_pwmgr.getService(Ci_pwmgr);
ok(pwmgr != null, "pwmgr getService()");


// Remove all logins, so future test runs start off clean.
pwmgr.removeAllLogins();

var logins = pwmgr.getAllLogins();
ok(logins != null, "getAllLogins()");
is(logins.length, 0, "ensure no remaining logins");

// Remove any disabled hosts
var disabledHosts = pwmgr.getAllDisabledHosts();
ok(disabledHosts != null, "getAllDisabledHosts()");
disabledHosts.forEach(function(host) pwmgr.setLoginSavingEnabled(host, true));

disabledHosts = pwmgr.getAllDisabledHosts();
ok(disabledHosts != null, "getAllDisabledHosts()");
is(disabledHosts.length, 0, "ensure no remaining disabled hosts");

</script>
</pre>
</body>
</html>