Skip to content
Snippets Groups Projects
Commit cda27c85 authored by Barret Rennie's avatar Barret Rennie
Browse files

Bug 1772923 - Port osfile.jsm usage to IOUtils in security/manager/ r=keeler

parent 82a08acc
No related branches found
No related tags found
No related merge requests found
......@@ -10,8 +10,6 @@
* pippki UI js files.
*/
ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
function setText(id, value) {
let element = document.getElementById(id);
if (!element) {
......@@ -159,7 +157,7 @@ async function exportToFile(parent, cert) {
}
break;
case 2:
// OS.File.writeAtomic requires a utf-8 string or a typed array.
// IOUtils.write requires a typed array.
// nsIX509Cert.getRawDER() returns an array (not a typed array), so we
// convert it here.
content = Uint8Array.from(cert.getRawDER());
......@@ -178,7 +176,7 @@ async function exportToFile(parent, cert) {
break;
}
try {
await OS.File.writeAtomic(fp.file.path, content);
await IOUtils.write(fp.file.path, content);
} catch (ex) {
let title = await document.l10n.formatValue("write-file-failure");
alertPromptService(title, ex.toString());
......
......@@ -307,12 +307,10 @@ add_task(async function testClearPrivateBrowsingState() {
// Test that 3rd party certificates are taken into account when filtering client
// certificates based on the acceptible CA list sent by the server.
add_task(async function testCertFilteringWithIntermediate() {
let intermediateBytes = await OS.File.read(
let intermediateBytes = await IOUtils.readUTF8(
getTestFilePath("intermediate.pem")
).then(
data => {
let decoder = new TextDecoder();
let pem = decoder.decode(data);
pem => {
let base64 = pemToBase64(pem);
let bin = atob(base64);
let bytes = [];
......
......@@ -2,8 +2,6 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
var gCertDB = Cc["@mozilla.org/security/x509certdb;1"].getService(
Ci.nsIX509CertDB
);
......@@ -47,7 +45,7 @@ function pemToBase64(pem) {
* A promise that will resolve with a handle to the certificate.
*/
function readCertificate(filename, trustString) {
return OS.File.read(getTestFilePath(filename)).then(
return IOUtils.read(getTestFilePath(filename)).then(
data => {
let decoder = new TextDecoder();
let pem = decoder.decode(data);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment