mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
28 lines
992 B
JavaScript
28 lines
992 B
JavaScript
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||
|
*/
|
||
|
"use strict";
|
||
|
|
||
|
const { 'classes': Cc, 'interfaces': Ci, 'utils': Cu, 'results': Cr } = Components;
|
||
|
|
||
|
let { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});
|
||
|
|
||
|
Cu.import("resource://gre/modules/FileUtils.jsm"); // XXX: tempScope?
|
||
|
Cu.import("resource://gre/modules/Services.jsm"); // XXX: tempScope?
|
||
|
|
||
|
function readFile(file) {
|
||
|
let fstream = Cc["@mozilla.org/network/file-input-stream;1"]
|
||
|
.createInstance(Ci.nsIFileInputStream);
|
||
|
fstream.init(file, -1, 0, 0);
|
||
|
let data = NetUtil.readInputStreamToString(fstream, fstream.available());
|
||
|
fstream.close();
|
||
|
return data;
|
||
|
}
|
||
|
|
||
|
function addCertFromFile(certdb, filename, trustString) {
|
||
|
let certFile = do_get_file(filename, false);
|
||
|
let der = readFile(certFile);
|
||
|
certdb.addCert(der, trustString, null);
|
||
|
}
|