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: const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock; michael@0: const nsIPKIParamBlock = Components.interfaces.nsIPKIParamBlock; michael@0: const nsIX509Cert = Components.interfaces.nsIX509Cert; michael@0: michael@0: var pkiParams; michael@0: var params; michael@0: var caName; michael@0: var cert; michael@0: michael@0: function onLoad() michael@0: { michael@0: pkiParams = window.arguments[0].QueryInterface(nsIPKIParamBlock); michael@0: params = pkiParams.QueryInterface(nsIDialogParamBlock); michael@0: var isupport = pkiParams.getISupportAtIndex(1); michael@0: cert = isupport.QueryInterface(nsIX509Cert); michael@0: michael@0: caName = cert.commonName; michael@0: michael@0: var bundle = document.getElementById("pippki_bundle"); michael@0: michael@0: if (!caName.length) michael@0: caName = bundle.getString("unnamedCA"); michael@0: michael@0: var message2 = bundle.getFormattedString("newCAMessage1", [caName]); michael@0: setText("message2", message2); michael@0: } michael@0: michael@0: function viewCert() michael@0: { michael@0: viewCertHelper(window, cert); michael@0: } michael@0: michael@0: function doOK() michael@0: { michael@0: var checkSSL = document.getElementById("trustSSL"); michael@0: var checkEmail = document.getElementById("trustEmail"); michael@0: var checkObjSign = document.getElementById("trustObjSign"); michael@0: if (checkSSL.checked) michael@0: params.SetInt(2,1); michael@0: else michael@0: params.SetInt(2,0); michael@0: if (checkEmail.checked) michael@0: params.SetInt(3,1); michael@0: else michael@0: params.SetInt(3,0); michael@0: if (checkObjSign.checked) michael@0: params.SetInt(4,1); michael@0: else michael@0: params.SetInt(4,0); michael@0: params.SetInt(1,1); michael@0: return true; michael@0: } michael@0: michael@0: function doCancel() michael@0: { michael@0: params.SetInt(1,0); michael@0: return true; michael@0: }