Bug 1747461 - Remove FileUtils.getFile from browser/components/enterprisepolicies r=mixedpuppy

Differential Revision: https://phabricator.services.mozilla.com/D134894
This commit is contained in:
Barret Rennie
2022-01-19 18:37:24 +00:00
parent 566fe027b9
commit 8c22bbb359
2 changed files with 6 additions and 9 deletions

View File

@@ -2400,7 +2400,10 @@ function clearRunOnceModification(actionName) {
function replacePathVariables(path) {
if (path.includes("${home}")) {
return path.replace("${home}", FileUtils.getFile("Home", []).path);
return path.replace(
"${home}",
Services.dirsvc.get("Home", Ci.nsIFile).path
);
}
return path;
}

View File

@@ -3,12 +3,6 @@
"use strict";
ChromeUtils.defineModuleGetter(
this,
"FileUtils",
"resource://gre/modules/FileUtils.jsm"
);
add_task(async function test_defaultdownload() {
await setupPolicyEngineWithJson({
policies: {
@@ -33,7 +27,7 @@ add_task(async function test_defaultdownload() {
true,
"saveTo should be disabled."
);
let home = FileUtils.getFile("Home", []).path;
let home = Services.dirsvc.get("Home", Ci.nsIFile).path;
is(
Services.prefs.getStringPref("browser.download.dir"),
home + "/Downloads",
@@ -85,7 +79,7 @@ add_task(async function test_download() {
true,
"chooseFolder should be disabled."
);
let home = FileUtils.getFile("Home", []).path;
let home = Services.dirsvc.get("Home", Ci.nsIFile).path;
is(
Services.prefs.getStringPref("browser.download.dir"),
home + "/Documents",