michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: let gBugWindow; michael@0: michael@0: function onLoad() { michael@0: gBugWindow.removeEventListener("load", onLoad); michael@0: gBugWindow.addEventListener("unload", onUnload); michael@0: gBugWindow.close(); michael@0: } michael@0: michael@0: function onUnload() { michael@0: gBugWindow.removeEventListener("unload", onUnload); michael@0: window.focus(); michael@0: finish(); michael@0: } michael@0: michael@0: // This test opens and then closes the certificate viewer to test that it michael@0: // does not cause assertion failures. michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: let certCache = Cc["@mozilla.org/security/nsscertcache;1"] michael@0: .getService(Ci.nsINSSCertCache); michael@0: certCache.cacheAllCerts(); michael@0: let certList = certCache.getX509CachedCerts(); michael@0: let enumerator = certList.getEnumerator(); michael@0: ok(enumerator.hasMoreElements(), "we have at least one certificate"); michael@0: let cert = enumerator.getNext().QueryInterface(Ci.nsIX509Cert); michael@0: ok(cert, "found a certificate to look at"); michael@0: info("looking at certificate with nickname " + cert.nickname); michael@0: let arg = { michael@0: QueryInterface: function() this, michael@0: getISupportAtIndex: function() this.cert, michael@0: cert: cert michael@0: }; michael@0: gBugWindow = window.openDialog("chrome://pippki/content/certViewer.xul", michael@0: "", "", arg); michael@0: gBugWindow.addEventListener("load", onLoad); michael@0: }