Bug 1772941 - Port osfile.jsm usage to IOUtils in toolkit/content/ r=florian,preferences-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D149303
This commit is contained in:
Barret Rennie 2022-07-09 21:21:31 +00:00
Родитель a63e9a4b4a
Коммит 6d900e020b
13 изменённых файлов: 23 добавлений и 4 удалений

Просмотреть файл

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
const { Sqlite } = ChromeUtils.import("resource://gre/modules/Sqlite.jsm");
XPCOMUtils.defineLazyServiceGetter(

Просмотреть файл

@ -3,6 +3,8 @@
"use strict";
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
let gMimeSvc = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
let gHandlerSvc = Cc["@mozilla.org/uriloader/handler-service;1"].getService(
Ci.nsIHandlerService

Просмотреть файл

@ -3,6 +3,8 @@
"use strict";
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
var MockFilePicker = SpecialPowers.MockFilePicker;
function createTemporarySaveDirectory() {

Просмотреть файл

@ -3,6 +3,8 @@
"use strict";
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
const { HandlerServiceTestUtils } = ChromeUtils.import(
"resource://testing-common/HandlerServiceTestUtils.jsm"
);

Просмотреть файл

@ -11,7 +11,6 @@
var { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
var { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
add_task(async function testCAandTitle() {
let cert = await readCertificate("ca.pem", "CTu,CTu,CTu");

Просмотреть файл

@ -3,6 +3,8 @@
// http://creativecommons.org/publicdomain/zero/1.0/
"use strict";
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
// Tests various scenarios connecting to a server that requires client cert
// authentication. Also tests that nsIClientAuthDialogs.chooseCertificate
// is called at the appropriate times and with the correct arguments.

Просмотреть файл

@ -2,6 +2,8 @@
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
);

Просмотреть файл

@ -3,6 +3,8 @@
/* import-globals-from browser_content_sandbox_utils.js */
"use strict";
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
// Test if the content process can create in $HOME, this should fail
async function createFileInHome() {
let browser = gBrowser.selectedBrowser;

Просмотреть файл

@ -4,6 +4,8 @@
"use strict";
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
const kClsidTestShellEx = "{10a9521e-0205-4cc7-93a1-62f30a9a54b3}";
const kFriendlyName = "Minimum Shell Extension for Firefox testing";
const kExtensionSubkeys = [".zzz\\shellex\\IconHandler"];

Просмотреть файл

@ -62,6 +62,8 @@ ChromeUtils.defineModuleGetter(
"resource://gre/modules/SharedPromptUtils.jsm"
);
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
var PrintUtils = {
SAVE_TO_PDF_PRINTER: "Mozilla Save to PDF",

Просмотреть файл

@ -16,7 +16,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
DownloadPaths: "resource://gre/modules/DownloadPaths.jsm",
DownloadLastDir: "resource://gre/modules/DownloadLastDir.jsm",
FileUtils: "resource://gre/modules/FileUtils.jsm",
OS: "resource://gre/modules/osfile.jsm",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
Deprecated: "resource://gre/modules/Deprecated.jsm",
NetUtil: "resource://gre/modules/NetUtil.jsm",
@ -662,7 +661,7 @@ function promiseTargetFile(
// Default to the user's default downloads directory configured
// through download prefs.
let dirPath = await Downloads.getPreferredDownloadsDirectory();
let dirExists = await OS.File.exists(dirPath);
let dirExists = await IOUtils.exists(dirPath);
let dir = new FileUtils.File(dirPath);
if (useDownloadDir && dirExists) {
@ -687,7 +686,7 @@ function promiseTargetFile(
});
}
});
if (file && (await OS.File.exists(file.path))) {
if (file && (await IOUtils.exists(file.path))) {
dir = file;
dirExists = true;
}

Просмотреть файл

@ -2,6 +2,8 @@
// Test for bug 1170531
// https://bugzilla.mozilla.org/show_bug.cgi?id=1170531
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
add_task(async function() {
// Get a bunch of DOM nodes
let editMenu = document.getElementById("edit-menu");

Просмотреть файл

@ -21,6 +21,8 @@ const {
ExtensionUtils: { promiseEvent, promiseObserved },
} = ChromeUtils.import("resource://gre/modules/ExtensionUtils.jsm");
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
AddonTestUtils.initMochitest(this);
// The response to the discovery API, as documented at: