|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 let gBugWindow; |
|
6 |
|
7 function onLoad() { |
|
8 gBugWindow.removeEventListener("load", onLoad); |
|
9 gBugWindow.addEventListener("unload", onUnload); |
|
10 gBugWindow.close(); |
|
11 } |
|
12 |
|
13 function onUnload() { |
|
14 gBugWindow.removeEventListener("unload", onUnload); |
|
15 window.focus(); |
|
16 finish(); |
|
17 } |
|
18 |
|
19 // This test opens and then closes the certificate viewer to test that it |
|
20 // does not cause assertion failures. |
|
21 function test() { |
|
22 waitForExplicitFinish(); |
|
23 let certCache = Cc["@mozilla.org/security/nsscertcache;1"] |
|
24 .getService(Ci.nsINSSCertCache); |
|
25 certCache.cacheAllCerts(); |
|
26 let certList = certCache.getX509CachedCerts(); |
|
27 let enumerator = certList.getEnumerator(); |
|
28 ok(enumerator.hasMoreElements(), "we have at least one certificate"); |
|
29 let cert = enumerator.getNext().QueryInterface(Ci.nsIX509Cert); |
|
30 ok(cert, "found a certificate to look at"); |
|
31 info("looking at certificate with nickname " + cert.nickname); |
|
32 let arg = { |
|
33 QueryInterface: function() this, |
|
34 getISupportAtIndex: function() this.cert, |
|
35 cert: cert |
|
36 }; |
|
37 gBugWindow = window.openDialog("chrome://pippki/content/certViewer.xul", |
|
38 "", "", arg); |
|
39 gBugWindow.addEventListener("load", onLoad); |
|
40 } |