зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1541508 - Use Services.env in uriloader/ r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D160151
This commit is contained in:
Родитель
bff6b9dd65
Коммит
3250d6ee4d
|
@ -18,14 +18,11 @@ add_task(async function test_check_download_dir() {
|
|||
// system download dir to fail:
|
||||
let newXDGRoot = FileTestUtils.getTempFile("xdgstuff");
|
||||
newXDGRoot.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
|
||||
const gEnv = Cc["@mozilla.org/process/environment;1"].getService(
|
||||
Ci.nsIEnvironment
|
||||
);
|
||||
let oldXDG = gEnv.exists("XDG_CONFIG_HOME")
|
||||
? gEnv.get("XDG_CONFIG_HOME")
|
||||
let oldXDG = Services.env.exists("XDG_CONFIG_HOME")
|
||||
? Services.env.get("XDG_CONFIG_HOME")
|
||||
: "";
|
||||
registerCleanupFunction(() => gEnv.set("XDG_CONFIG_HOME", oldXDG));
|
||||
gEnv.set("XDG_CONFIG_HOME", newXDGRoot.path + "/");
|
||||
registerCleanupFunction(() => Services.env.set("XDG_CONFIG_HOME", oldXDG));
|
||||
Services.env.set("XDG_CONFIG_HOME", newXDGRoot.path + "/");
|
||||
|
||||
let propBundle = Services.strings.createBundle(
|
||||
"chrome://mozapps/locale/downloads/downloads.properties"
|
||||
|
|
|
@ -99,22 +99,18 @@ function run_test() {
|
|||
outFile.append(kOutputFile);
|
||||
|
||||
// Set an environment variable for WriteArgument to pick up
|
||||
var envSvc = Cc["@mozilla.org/process/environment;1"].getService(
|
||||
Ci.nsIEnvironment
|
||||
);
|
||||
|
||||
// The Write Argument file needs to know where its libraries are, so
|
||||
// just force the path variable
|
||||
// For mac
|
||||
var greDir = Services.dirsvc.get("GreD", Ci.nsIFile);
|
||||
|
||||
envSvc.set("DYLD_LIBRARY_PATH", greDir.path);
|
||||
Services.env.set("DYLD_LIBRARY_PATH", greDir.path);
|
||||
// For Linux
|
||||
envSvc.set("LD_LIBRARY_PATH", greDir.path);
|
||||
Services.env.set("LD_LIBRARY_PATH", greDir.path);
|
||||
// XXX: handle windows
|
||||
|
||||
// Now tell it where we want the file.
|
||||
envSvc.set("WRITE_ARGUMENT_FILE", outFile.path);
|
||||
Services.env.set("WRITE_ARGUMENT_FILE", outFile.path);
|
||||
|
||||
var uri = ioService.newURI(kTestURI);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче