Bug 1750539 - Make XDG_CONFIG_HOME lifecycle handled by test harness r=gcp

Differential Revision: https://phabricator.services.mozilla.com/D137706
This commit is contained in:
Alexandre Lissy 2022-02-08 12:48:28 +00:00
Родитель 17ea511a02
Коммит d9b9db2be0
2 изменённых файлов: 2 добавлений и 13 удалений

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

@ -411,20 +411,8 @@ async function testFileAccessLinuxOnly() {
let configDir = GetHomeSubdir(".config");
const xdgConfigHome = GetEnvironmentVariable("XDG_CONFIG_HOME");
let populateFakeXdgConfigHome = async aPath => {
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
await OS.File.makeDir(aPath, { unixMode: OS.Constants.S_IRWXU });
ok(await OS.File.exists(aPath), `XDG_CONFIG_HOME ${aPath} was created`);
};
let unpopulateFakeXdgConfigHome = async aPath => {
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
await OS.File.removeDir(aPath);
};
if (xdgConfigHome.length > 1) {
await populateFakeXdgConfigHome(xdgConfigHome);
configDir = GetDir(xdgConfigHome);
configDir.normalize();
@ -635,7 +623,6 @@ async function testFileAccessLinuxOnly() {
file: configDir,
minLevel: minHomeReadSandboxLevel(),
func: readDir,
cleanup: unpopulateFakeXdgConfigHome,
});
}

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

@ -5,6 +5,8 @@ tags = contentsandbox
support-files =
browser_content_sandbox_utils.js
browser_content_sandbox_fs_tests.js
test-directories =
/tmp/.xdg_config_home_test
environment=XDG_CONFIG_HOME=/tmp/.xdg_config_home_test
[browser_content_sandbox_fs_xdg.js]