1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/passwordmgr/test/test_master_password_cleanup.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,50 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 + <title>Test for Login Manager</title> 1.8 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.9 + <script type="text/javascript" src="pwmgr_common.js"></script> 1.10 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.11 +</head> 1.12 +<body> 1.13 +Login Manager test: master password cleanup 1.14 +<p id="display"></p> 1.15 + 1.16 +<div id="content" style="display: none"> 1.17 +</div> 1.18 + 1.19 +<pre id="test"> 1.20 +<script class="testbody" type="text/javascript"> 1.21 + 1.22 + 1.23 +/* 1.24 + * The entire purpose of this test is to make sure that, if the previous master 1.25 + * password test did not complete successfully, we don't screw up other pwmgr 1.26 + * tests by having a master password unexpectedly set. 1.27 + */ 1.28 +function cleanup() { 1.29 + ok(true, "ensuring MP is cleared"); 1.30 + 1.31 + var pk11db = Cc["@mozilla.org/security/pk11tokendb;1"]. 1.32 + getService(Ci.nsIPK11TokenDB); 1.33 + var token = pk11db.getInternalKeyToken(); 1.34 + 1.35 + if (!token.checkPassword("")) { 1.36 + ok(true, "Oops! MP still set, clearing it..."); 1.37 + disableMasterPassword(); 1.38 + } else { 1.39 + ok(true, "Master password already cleared."); 1.40 + } 1.41 + 1.42 + ok(true, "done."); 1.43 +} 1.44 + 1.45 +const Cc = SpecialPowers.Cc; 1.46 +const Ci = SpecialPowers.Ci; 1.47 + 1.48 +cleanup(); 1.49 +</script> 1.50 +</pre> 1.51 +</body> 1.52 +</html> 1.53 +