mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
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:
parent
17ea511a02
commit
d9b9db2be0
@ -411,20 +411,8 @@ async function testFileAccessLinuxOnly() {
|
|||||||
let configDir = GetHomeSubdir(".config");
|
let configDir = GetHomeSubdir(".config");
|
||||||
|
|
||||||
const xdgConfigHome = GetEnvironmentVariable("XDG_CONFIG_HOME");
|
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) {
|
if (xdgConfigHome.length > 1) {
|
||||||
await populateFakeXdgConfigHome(xdgConfigHome);
|
|
||||||
|
|
||||||
configDir = GetDir(xdgConfigHome);
|
configDir = GetDir(xdgConfigHome);
|
||||||
configDir.normalize();
|
configDir.normalize();
|
||||||
|
|
||||||
@ -635,7 +623,6 @@ async function testFileAccessLinuxOnly() {
|
|||||||
file: configDir,
|
file: configDir,
|
||||||
minLevel: minHomeReadSandboxLevel(),
|
minLevel: minHomeReadSandboxLevel(),
|
||||||
func: readDir,
|
func: readDir,
|
||||||
cleanup: unpopulateFakeXdgConfigHome,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ tags = contentsandbox
|
|||||||
support-files =
|
support-files =
|
||||||
browser_content_sandbox_utils.js
|
browser_content_sandbox_utils.js
|
||||||
browser_content_sandbox_fs_tests.js
|
browser_content_sandbox_fs_tests.js
|
||||||
|
test-directories =
|
||||||
|
/tmp/.xdg_config_home_test
|
||||||
environment=XDG_CONFIG_HOME=/tmp/.xdg_config_home_test
|
environment=XDG_CONFIG_HOME=/tmp/.xdg_config_home_test
|
||||||
|
|
||||||
[browser_content_sandbox_fs_xdg.js]
|
[browser_content_sandbox_fs_xdg.js]
|
||||||
|
Loading…
Reference in New Issue
Block a user