1 // -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
2 // This Source Code Form is subject to the terms of the Mozilla Public
3 // License, v. 2.0. If a copy of the MPL was not distributed with this
4 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 // Tests to make sure that the certificate DB works with non-ASCII paths.
10 // Append a single quote and non-ASCII characters to the profile path.
11 let profd = Services.env.get("XPCSHELL_TEST_PROFILE_DIR");
12 let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
13 file.initWithPath(profd);
15 Services.env.set("XPCSHELL_TEST_PROFILE_DIR", file.path);
17 file = do_get_profile(); // must be called before getting nsIX509CertDB
19 /[^\x20-\x7f]/.test(file.path),
20 "the profile path should contain a non-ASCII character"
23 // Restore the original value.
24 Services.env.set("XPCSHELL_TEST_PROFILE_DIR", profd);
26 const certdb = Cc["@mozilla.org/security/x509certdb;1"].getService(
30 function load_cert(cert_name, trust_string) {
31 let cert_filename = cert_name + ".pem";
32 return addCertFromFile(
34 "test_cert_trust/" + cert_filename,
40 let certList = ["ca", "int", "ee"];
42 for (let certName of certList) {
43 loadedCerts.push(load_cert(certName, ",,"));
46 let ca_cert = loadedCerts[0];
47 notEqual(ca_cert, null, "CA cert should have successfully loaded");
48 let int_cert = loadedCerts[1];
49 notEqual(int_cert, null, "Intermediate cert should have successfully loaded");
50 let ee_cert = loadedCerts[2];
51 notEqual(ee_cert, null, "EE cert should have successfully loaded");