Bug 1747472 - Remove FileUtils.getFile from uriloader/ r=mak

Differential Revision: https://phabricator.services.mozilla.com/D155891
This commit is contained in:
Barret Rennie 2023-06-09 17:52:12 +00:00
parent f28445335e
commit ad83745f8b
2 changed files with 11 additions and 4 deletions

View File

@ -12,7 +12,9 @@ var gHandlerSvc = Cc["@mozilla.org/uriloader/handler-service;1"].getService(
function createMockedHandlerApp() {
// Mock the executable
let mockedExecutable = FileUtils.getFile("TmpD", ["mockedExecutable"]);
let mockedExecutable = new FileUtils.File(
PathUtils.join(PathUtils.tempDir, "mockedExecutable")
);
if (!mockedExecutable.exists()) {
mockedExecutable.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o755);
}

View File

@ -23,7 +23,7 @@ let localHandlerApp = Cc[
"@mozilla.org/uriloader/local-handler-app;1"
].createInstance(Ci.nsILocalHandlerApp);
localHandlerApp.name = "Local Handler";
localHandlerApp.executable = FileUtils.getFile("TmpD", []);
localHandlerApp.executable = new FileUtils.File(PathUtils.tempDir);
let expectedLocalHandlerApp = {
name: localHandlerApp.name,
executable: localHandlerApp.executable,
@ -275,7 +275,9 @@ add_task(async function test_store_localHandlerApp_missing() {
"@mozilla.org/uriloader/local-handler-app;1"
].createInstance(Ci.nsILocalHandlerApp);
missingHandlerApp.name = "Non-existing Handler";
missingHandlerApp.executable = FileUtils.getFile("TmpD", ["nonexisting"]);
missingHandlerApp.executable = new FileUtils.File(
PathUtils.join(PathUtils.tempDir, "nonexisting")
);
await deleteHandlerStore();
@ -703,7 +705,10 @@ add_task(async function test_store_gioHandlerApp() {
}
// Create dummy exec file that following won't fail because file not found error
let dummyHandlerFile = FileUtils.getFile("TmpD", ["dummyHandler"]);
let dummyHandlerFile = await IOUtils.getFile(
PathUtils.tempDir,
"dummyHandler"
);
dummyHandlerFile.createUnique(
Ci.nsIFile.NORMAL_FILE_TYPE,
parseInt("777", 8)