зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1772923 - Port osfile.jsm usage to IOUtils in security/manager/ r=keeler
Differential Revision: https://phabricator.services.mozilla.com/D153711
This commit is contained in:
Родитель
82a08acc5c
Коммит
cda27c85fe
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче