Backed out changeset 63ccd00a399a (bug 898315) for causing failures in test_no_window_update_restart.py CLOSED TREE

This commit is contained in:
Noemi Erli 2023-06-15 03:21:27 +03:00
parent 8820a3ea9e
commit 37e0c3eb20
52 changed files with 131 additions and 154 deletions

View File

@ -28,16 +28,13 @@ add_task(
"Untracked URI, no pref set"
);
let dir1 = FileUtils.getDir("TmpD", ["dir1"]);
dir1.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let dir1 = FileUtils.getDir("TmpD", ["dir1"], true);
let uri1 = Services.io.newURI("https://test1.moz.org");
downloadLastDir.setFile(uri1, dir1);
let dir2 = FileUtils.getDir("TmpD", ["dir2"]);
dir2.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let dir2 = FileUtils.getDir("TmpD", ["dir2"], true);
let uri2 = Services.io.newURI("https://test2.moz.org");
downloadLastDir.setFile(uri2, dir2);
let dir3 = FileUtils.getDir("TmpD", ["dir3"]);
dir3.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let dir3 = FileUtils.getDir("TmpD", ["dir3"], true);
downloadLastDir.setFile(null, dir3);
Assert.equal(
(await downloadLastDir.getFileAsync(uri1)).path,
@ -79,8 +76,7 @@ add_task(
// file: URIs should all point to the same folder.
let fileUri1 = Services.io.newURI("file:///c:/test.txt");
downloadLastDir.setFile(uri1, dir3);
let dir4 = FileUtils.getDir("TmpD", ["dir4"]);
dir4.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let dir4 = FileUtils.getDir("TmpD", ["dir4"], true);
let fileUri2 = Services.io.newURI("file:///d:/test.png");
downloadLastDir.setFile(uri1, dir4);
Assert.equal(

View File

@ -53,8 +53,7 @@ async function installTestAddon(addonId, unpacked = false) {
// in XPInstall.jsm).
const random = Math.round(Math.random() * 36 ** 3).toString(36);
const tmpDirName = `mochitest_unpacked_addons_${random}`;
let tmpExtPath = FileUtils.getDir("TmpD", [tmpDirName]);
tmpExtPath.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let tmpExtPath = FileUtils.getDir("TmpD", [tmpDirName], true);
registerCleanupFunction(() => {
tmpExtPath.remove(true);
});

View File

@ -9,8 +9,11 @@ async function testReturnStatus(expectedStatus) {
"http://example.net/"
);
let saveDir = FileUtils.getDir("TmpD", [`testSaveDir-${Math.random()}`]);
saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let saveDir = FileUtils.getDir(
"TmpD",
[`testSaveDir-${Math.random()}`],
true
);
let saveFile = saveDir.clone();
saveFile.append("testSaveFile.pdf");
@ -116,8 +119,11 @@ async function testFileName(expectedFileName) {
"http://example.net/"
);
let saveDir = FileUtils.getDir("TmpD", [`testSaveDir-${Math.random()}`]);
saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let saveDir = FileUtils.getDir(
"TmpD",
[`testSaveDir-${Math.random()}`],
true
);
let saveFile = saveDir.clone();
saveFile.append(expectedFileName);

View File

@ -86,10 +86,11 @@ Bookmarks.prototype = {
// Thus, we must create a map from bookmark URLs -> their favicon entry's UUID.
let bookmarkURLToUUIDMap = new Map();
const faviconFolder = FileUtils.getDir("ULibDir", [
"Safari",
"Favicon Cache",
]).path;
const faviconFolder = FileUtils.getDir(
"ULibDir",
["Safari", "Favicon Cache"],
false
).path;
let dbPath = PathUtils.join(faviconFolder, "favicons.db");
try {
@ -271,10 +272,11 @@ Bookmarks.prototype = {
let favicons = [];
let convertedEntries = [];
const faviconFolder = FileUtils.getDir("ULibDir", [
"Safari",
"Favicon Cache",
]).path;
const faviconFolder = FileUtils.getDir(
"ULibDir",
["Safari", "Favicon Cache"],
false
).path;
for (const entry of entries) {
let type = entry.get("WebBookmarkType");
@ -347,7 +349,11 @@ Bookmarks.prototype = {
};
async function GetHistoryResource() {
let dbPath = FileUtils.getDir("ULibDir", ["Safari", "History.db"]).path;
let dbPath = FileUtils.getDir(
"ULibDir",
["Safari", "History.db"],
false
).path;
let maxAge = msToNSDate(
Date.now() - MigrationUtils.HISTORY_MAX_AGE_IN_MILLISECONDS
);
@ -534,7 +540,7 @@ export class SafariProfileMigrator extends MigratorBase {
}
async getResources() {
let profileDir = FileUtils.getDir("ULibDir", ["Safari"]);
let profileDir = FileUtils.getDir("ULibDir", ["Safari"], false);
if (!profileDir.exists()) {
return null;
}
@ -570,7 +576,7 @@ export class SafariProfileMigrator extends MigratorBase {
}
async getLastUsedDate() {
const profileDir = FileUtils.getDir("ULibDir", ["Safari"]);
const profileDir = FileUtils.getDir("ULibDir", ["Safari"], false);
const dates = await Promise.all(
["Bookmarks.plist", "History.db"].map(file => {
const path = PathUtils.join(profileDir.path, file);
@ -588,15 +594,16 @@ export class SafariProfileMigrator extends MigratorBase {
return true;
}
// Check if we have access to both bookmarks and favicons:
let bookmarkTarget = FileUtils.getDir("ULibDir", [
"Safari",
"Bookmarks.plist",
]);
let faviconTarget = FileUtils.getDir("ULibDir", [
"Safari",
"Favicon Cache",
"favicons.db",
]);
let bookmarkTarget = FileUtils.getDir(
"ULibDir",
["Safari", "Bookmarks.plist"],
false
);
let faviconTarget = FileUtils.getDir(
"ULibDir",
["Safari", "Favicon Cache", "favicons.db"],
false
);
try {
// 'stat' is always allowed, but reading is somehow not, if the user hasn't
// allowed it:
@ -617,7 +624,7 @@ export class SafariProfileMigrator extends MigratorBase {
// The title (second arg) is not displayed on macOS, so leave it blank.
fp.init(win, "", Ci.nsIFilePicker.modeGetFolder);
fp.filterIndex = 1;
fp.displayDirectory = FileUtils.getDir("ULibDir", [""]);
fp.displayDirectory = FileUtils.getDir("ULibDir", [""], false);
// Now wait for the filepicker to open and close. If the user picks
// the Safari folder, macOS will grant us read access to everything
// inside, so we don't need to check or do anything else with what's
@ -633,7 +640,7 @@ export class SafariProfileMigrator extends MigratorBase {
get mainPreferencesPropertyList() {
if (this._mainPreferencesPropertyList === undefined) {
let file = FileUtils.getDir("UsrPrfs", []);
let file = FileUtils.getDir("UsrPrfs", [], false);
if (file.exists()) {
file.append("com.apple.Safari.plist");
if (file.exists()) {

View File

@ -1,6 +1,6 @@
"use strict";
let tmpFile = FileUtils.getDir("TmpD", []);
let tmpFile = FileUtils.getDir("TmpD", [], true);
let dbConn;
add_task(async function setup() {

View File

@ -48,7 +48,7 @@ async function runTest() {
"resource://gre/modules/DownloadLastDir.sys.mjs"
);
let tmpDir = FileUtils.getDir("TmpD", []);
let tmpDir = FileUtils.getDir("TmpD", [], true);
let dir1 = newDirectory();
let dir2 = newDirectory();
let dir3 = newDirectory();

View File

@ -24,7 +24,7 @@ function test() {
let launcherDialog = Cc["@mozilla.org/helperapplauncherdialog;1"].getService(
Ci.nsIHelperAppLauncherDialog
);
let tmpDir = FileUtils.getDir("TmpD", []);
let tmpDir = FileUtils.getDir("TmpD", [], true);
let dir1 = newDirectory();
let dir2 = newDirectory();
let dir3 = newDirectory();

View File

@ -19,7 +19,7 @@ function test() {
let validateFileNameToRestore = validateFileName;
let prefs = Services.prefs.getBranch("browser.download.");
let tmpDir = FileUtils.getDir("TmpD", []);
let tmpDir = FileUtils.getDir("TmpD", [], true);
let dir1 = newDirectory();
let dir2 = newDirectory();
let dir3 = newDirectory();

View File

@ -4,7 +4,7 @@
* on how it behaves when private browsing windows open.
*/
add_task(async function test_downloads_last_dir_toggle() {
let tmpDir = FileUtils.getDir("TmpD", []);
let tmpDir = FileUtils.getDir("TmpD", [], true);
let dir1 = newDirectory();
registerCleanupFunction(function () {

View File

@ -66,7 +66,9 @@ async function openTabAndWaitForRender() {
}
function newDirectory() {
let dir = FileUtils.getDir("TmpD", ["testdir"]);
let tmpDir = FileUtils.getDir("TmpD", [], true);
let dir = tmpDir.clone();
dir.append("testdir");
dir.createUnique(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
return dir;
}

View File

@ -26,7 +26,11 @@ const SERVER_URL =
function getPendingCrashReportDir() {
// The fake UAppData directory that makeFakeAppDir provides
// is just UAppData under the profile directory.
return FileUtils.getDir("ProfD", ["UAppData", "Crash Reports", "pending"]);
return FileUtils.getDir(
"ProfD",
["UAppData", "Crash Reports", "pending"],
false
);
}
/**

View File

@ -37,7 +37,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=702949
var i = document.getElementsByTagName('input')[0];
var file = FileUtils.getDir("TmpD", []);
var file = FileUtils.getDir("TmpD", [], false);
file.append("testfile");
file.createUnique(SpecialPowers.Ci.nsIFile.NORMAL_FILE_TYPE, 0o644);

View File

@ -131,7 +131,7 @@ add_task(async function test_SharedLogs() {
// A little helper to test what log files exist. We expect exactly zero (if
// prefix is null) or exactly one with the specified prefix.
function checkLogFile(prefix) {
let logsdir = FileUtils.getDir("ProfD", ["weave", "logs"]);
let logsdir = FileUtils.getDir("ProfD", ["weave", "logs"], true);
let entries = logsdir.directoryEntries;
if (!prefix) {
// expecting no files.
@ -278,7 +278,7 @@ add_task(async function test_logFileError() {
});
function countLogFiles() {
let logsdir = FileUtils.getDir("ProfD", ["weave", "logs"]);
let logsdir = FileUtils.getDir("ProfD", ["weave", "logs"], true);
let count = 0;
for (let entry of logsdir.directoryEntries) {
void entry;

View File

@ -46,8 +46,7 @@ Services.prefs.setBoolPref("extensions.experiments.enabled", true);
const SYSTEM_ADDON_ID = "system1@tests.mozilla.org";
add_task(async function setupSystemAddon() {
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"], true);
AddonTestUtils.registerDirectory("XREAppFeat", distroDir);
let xpi = await AddonTestUtils.createTempWebExtensionFile({

View File

@ -22,8 +22,7 @@ registerCleanupFunction(function () {
});
});
const logsdir = FileUtils.getDir("ProfD", ["weave", "logs"]);
logsdir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
const logsdir = FileUtils.getDir("ProfD", ["weave", "logs"], true);
function removeLogFiles() {
let entries = logsdir.directoryEntries;

View File

@ -13,8 +13,7 @@ const { FileUtils } = ChromeUtils.importESModule(
"resource://gre/modules/FileUtils.sys.mjs"
);
const logsdir = FileUtils.getDir("ProfD", ["weave", "logs"]);
logsdir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
const logsdir = FileUtils.getDir("ProfD", ["weave", "logs"], true);
// Delay to wait before cleanup, to allow files to age.
// This is so large because the file timestamp granularity is per-second, and

View File

@ -93,7 +93,7 @@ export var MockFilePicker = {
},
useAnyFile() {
var file = lazy.FileUtils.getDir("TmpD", []);
var file = lazy.FileUtils.getDir("TmpD", [], false);
file.append("testfile");
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o644);
let promise = this.window.File.createFromNsIFile(file)

View File

@ -4,8 +4,11 @@
"use strict";
async function testAppliedFilters(ext, expectedFilter, expectedFilterCount) {
let tempDir = FileUtils.getDir("TmpD", [`testDownloadDir-${Math.random()}`]);
tempDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let tempDir = FileUtils.getDir(
"TmpD",
[`testDownloadDir-${Math.random()}`],
true
);
let filterCount = 0;

View File

@ -300,8 +300,7 @@ add_task(
// in XPInstall.jsm).
const random = Math.round(Math.random() * 36 ** 3).toString(36);
const tmpDirName = `xpcshelltest_unpacked_addons_${random}`;
let tmpExtPath = FileUtils.getDir("TmpD", [tmpDirName]);
tmpExtPath.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let tmpExtPath = FileUtils.getDir("TmpD", [tmpDirName], true);
registerCleanupFunction(() => {
tmpExtPath.remove(true);
});

View File

@ -291,7 +291,7 @@ async function loadAddonManager(...args) {
// As we're not running in application, we need to setup the features directory
// used by system add-ons.
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"]);
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"], true);
AddonTestUtils.registerDirectory("XREAppFeat", distroDir);
await AddonTestUtils.overrideBuiltIns({
system: ["tel-system-xpi@tests.mozilla.org"],

View File

@ -139,8 +139,7 @@ add_task(async function setup() {
Services.fog.initializeFOG();
// The system add-on must be installed before AddonManager is started.
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"], true);
do_get_file("system.xpi").copyTo(
distroDir,
"tel-system-xpi@tests.mozilla.org.xpi"

View File

@ -33,8 +33,7 @@ add_task(async function setup() {
Services.fog.initializeFOG();
// The system add-on must be installed before AddonManager is started.
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"], true);
do_get_file("system.xpi").copyTo(
distroDir,
"tel-system-xpi@tests.mozilla.org.xpi"

View File

@ -21,12 +21,10 @@ var { PageThumbsStorageMigrator } = tmp;
*/
function* runTests() {
// Prepare a local profile directory.
let localProfile = FileUtils.getDir("ProfD", ["local-test"]);
localProfile.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let localProfile = FileUtils.getDir("ProfD", ["local-test"], true);
changeLocation("ProfLD", localProfile);
let roaming = FileUtils.getDir("ProfD", [THUMBNAIL_DIRECTORY]);
roaming.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let roaming = FileUtils.getDir("ProfD", [THUMBNAIL_DIRECTORY], true);
// Set up some data in the roaming profile.
let name = PageThumbsStorageService.getLeafNameForURL(URL);

View File

@ -65,7 +65,7 @@ async function do_test(test) {
let MockFilePicker = SpecialPowers.MockFilePicker;
MockFilePicker.init(window);
MockFilePicker.returnValue = MockFilePicker.returnOK;
MockFilePicker.displayDirectory = FileUtils.getDir("TmpD", []);
MockFilePicker.displayDirectory = FileUtils.getDir("TmpD", [], false);
MockFilePicker.setFiles([tempFile]);
MockFilePicker.afterOpenCallback = MockFilePicker.cleanup;
@ -124,7 +124,7 @@ async function do_test(test) {
}
function createTempFile() {
let file = FileUtils.getDir("TmpD", []);
let file = FileUtils.getDir("TmpD", [], false);
file.append("testfile_bug1251809");
file.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o644);
return file;

View File

@ -21,7 +21,9 @@ async function setFile(downloadLastDir, aURI, aValue) {
}
function newDirectory() {
let dir = FileUtils.getDir("TmpD", ["testdir"]);
let tmpDir = FileUtils.getDir("TmpD", [], true);
let dir = tmpDir.clone();
dir.append("testdir");
dir.createUnique(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
return dir;
}
@ -50,7 +52,7 @@ add_task(async function () {
"http://mochi.test:8888/browser/toolkit/content/tests/browser/doggy.png";
await BrowserTestUtils.withNewTab(IMAGE_URL, async function (browser) {
let tmpDir = FileUtils.getDir("TmpD", []);
let tmpDir = FileUtils.getDir("TmpD", [], true);
let dir = newDirectory();
let downloadLastDir = new DownloadLastDir(null);
// Set the desired target directory for the IMAGE_URL

View File

@ -80,8 +80,7 @@ add_test(function test_getDir_nonexistentDir() {
});
add_test(function test_getDir_shouldCreate() {
let dir = FileUtils.getDir("ProfD", ["c", "d", "foodir"]);
dir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let dir = FileUtils.getDir("ProfD", ["c", "d", "foodir"], true);
Assert.ok(dir instanceof Ci.nsIFile);
Assert.ok(dir.exists());

View File

@ -942,7 +942,7 @@ async function test_checkForAddons_installAddon(
wantInstallReject
);
let httpServer = new HttpServer();
let dir = FileUtils.getDir("TmpD", []);
let dir = FileUtils.getDir("TmpD", [], true);
httpServer.registerDirectory("/", dir);
httpServer.start(-1);
let testserverPort = httpServer.identity.primaryPort;
@ -1184,8 +1184,7 @@ add_task(async function test_GMPExtractor_paths() {
"dummy_gmp.zip"
);
let tempDirName = "TmpDir#猫";
let tempDir = FileUtils.getDir("TmpD", [tempDirName]);
tempDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let tempDir = FileUtils.getDir("TmpD", [tempDirName], true);
let zipPath = PathUtils.join(tempDir.path, "dummy_gmp.zip");
await IOUtils.copy(srcPath, zipPath);
// The path inside the profile dir we'll extract to. Make sure we handle

View File

@ -132,13 +132,10 @@ function getSystemAddonXPI(num, version) {
}
async function initSystemAddonDirs() {
let hiddenSystemAddonDir = FileUtils.getDir("ProfD", [
"sysfeatures",
"hidden",
]);
hiddenSystemAddonDir.create(
Ci.nsIFile.DIRECTORY_TYPE,
FileUtils.PERMS_DIRECTORY
let hiddenSystemAddonDir = FileUtils.getDir(
"ProfD",
["sysfeatures", "hidden"],
true
);
let system1_1 = await getSystemAddonXPI(1, "1.0");
system1_1.copyTo(hiddenSystemAddonDir, "system1@tests.mozilla.org.xpi");
@ -146,13 +143,10 @@ async function initSystemAddonDirs() {
let system2_1 = await getSystemAddonXPI(2, "1.0");
system2_1.copyTo(hiddenSystemAddonDir, "system2@tests.mozilla.org.xpi");
let prefilledSystemAddonDir = FileUtils.getDir("ProfD", [
"sysfeatures",
"prefilled",
]);
prefilledSystemAddonDir.create(
Ci.nsIFile.DIRECTORY_TYPE,
FileUtils.PERMS_DIRECTORY
let prefilledSystemAddonDir = FileUtils.getDir(
"ProfD",
["sysfeatures", "prefilled"],
true
);
let system2_2 = await getSystemAddonXPI(2, "2.0");
system2_2.copyTo(prefilledSystemAddonDir, "system2@tests.mozilla.org.xpi");
@ -164,7 +158,7 @@ async function initSystemAddonDirs() {
* Returns current system add-on update directory (stored in pref).
*/
function getCurrentSystemAddonUpdatesDir() {
const updatesDir = FileUtils.getDir("ProfD", ["features"]);
const updatesDir = FileUtils.getDir("ProfD", ["features"], false);
let dir = updatesDir.clone();
let set = JSON.parse(Services.prefs.getCharPref(PREF_SYSTEM_ADDON_SET));
dir.append(set.directory);
@ -175,7 +169,7 @@ function getCurrentSystemAddonUpdatesDir() {
* Removes all files from system add-on update directory.
*/
function clearSystemAddonUpdatesDir() {
const updatesDir = FileUtils.getDir("ProfD", ["features"]);
const updatesDir = FileUtils.getDir("ProfD", ["features"], false);
// Delete any existing directories
if (updatesDir.exists()) {
updatesDir.remove(true);
@ -195,8 +189,7 @@ async function buildPrefilledUpdatesDir() {
clearSystemAddonUpdatesDir();
// Build the test set
let dir = FileUtils.getDir("ProfD", ["features", "prefilled"]);
dir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let dir = FileUtils.getDir("ProfD", ["features", "prefilled"], true);
let xpi = await getSystemAddonXPI(2, "2.0");
xpi.copyTo(dir, "system2@tests.mozilla.org.xpi");
@ -296,7 +289,7 @@ async function checkInstalledSystemAddons(conditions, distroDir) {
* Returns all system add-on updates directories.
*/
async function getSystemAddonDirectories() {
const updatesDir = FileUtils.getDir("ProfD", ["features"]);
const updatesDir = FileUtils.getDir("ProfD", ["features"], false);
let subdirs = [];
if (await IOUtils.exists(updatesDir.path)) {

View File

@ -37,8 +37,7 @@ Services.prefs.setIntPref(
// test_builtin_system_location tests the (isSystem && isBuiltin) combination
// (i.e. KEY_APP_SYSTEM_DEFAULTS). That location only exists if this directory
// is found:
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures"], true);
registerDirectory("XREAppFeat", distroDir);
function getInstallLocation({

View File

@ -5,8 +5,7 @@
// This test verifies that hidden add-ons cannot be user disabled.
// for system add-ons
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures"], true);
registerDirectory("XREAppFeat", distroDir);
const NORMAL_ID = "normal@tests.mozilla.org";

View File

@ -5,8 +5,7 @@ createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "0");
// Ensure that only allowed add-ons are loaded.
add_task(async function test_allowed_addons() {
// Build the test set
var distroDir = FileUtils.getDir("ProfD", ["sysfeatures"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
var distroDir = FileUtils.getDir("ProfD", ["sysfeatures"], true);
let xpi = await getSystemAddonXPI(1, "1.0");
xpi.copyTo(distroDir, "system1@tests.mozilla.org.xpi");

View File

@ -18,8 +18,7 @@ const DEFER2_ID = "system_delay_defer2@tests.mozilla.org";
const DEFER_ALSO_ID = "system_delay_defer_also@tests.mozilla.org";
const NORMAL_ID = "system1@tests.mozilla.org";
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures"], true);
registerDirectory("XREAppFeat", distroDir);
registerCleanupFunction(() => {

View File

@ -10,8 +10,7 @@ createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "0");
// Test with a missing features directory
add_task(async function test_app_addons() {
// Build the test set
var distroDir = FileUtils.getDir("ProfD", ["sysfeatures"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
var distroDir = FileUtils.getDir("ProfD", ["sysfeatures"], true);
let xpi = await getSystemAddonXPI(1, "1.0");
xpi.copyTo(distroDir, "system1@tests.mozilla.org.xpi");

View File

@ -7,24 +7,21 @@ AddonTestUtils.usePrivilegedSignatures = id => "system";
add_task(async function setup() {
// Build the test sets
let dir = FileUtils.getDir("ProfD", ["sysfeatures", "app1"]);
dir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let dir = FileUtils.getDir("ProfD", ["sysfeatures", "app1"], true);
let xpi = await getSystemAddonXPI(1, "1.0");
xpi.copyTo(dir, "system1@tests.mozilla.org.xpi");
xpi = await getSystemAddonXPI(2, "1.0");
xpi.copyTo(dir, "system2@tests.mozilla.org.xpi");
dir = FileUtils.getDir("ProfD", ["sysfeatures", "app2"]);
dir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
dir = FileUtils.getDir("ProfD", ["sysfeatures", "app2"], true);
xpi = await getSystemAddonXPI(1, "2.0");
xpi.copyTo(dir, "system1@tests.mozilla.org.xpi");
xpi = await getSystemAddonXPI(3, "1.0");
xpi.copyTo(dir, "system3@tests.mozilla.org.xpi");
dir = FileUtils.getDir("ProfD", ["sysfeatures", "app3"]);
dir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
dir = FileUtils.getDir("ProfD", ["sysfeatures", "app3"], true);
xpi = await getSystemAddonXPI(1, "1.0");
xpi.copyTo(dir, "system1@tests.mozilla.org.xpi");
@ -32,8 +29,7 @@ add_task(async function setup() {
xpi.copyTo(dir, "system3@tests.mozilla.org.xpi");
});
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"], true);
registerDirectory("XREAppFeat", distroDir);
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "0");
@ -207,8 +203,7 @@ add_task(async function test_downgrade() {
add_task(async function test_updated() {
// Create a random dir to install into
let dirname = makeUUID();
let dir = FileUtils.getDir("ProfD", ["features", dirname]);
dir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
FileUtils.getDir("ProfD", ["features", dirname], true);
updatesDir.append(dirname);
// Copy in the system add-ons
@ -496,8 +491,7 @@ add_task(async function test_bad_app_cert() {
add_task(async function test_updated_bad_update_set() {
// Create a random dir to install into
let dirname = makeUUID();
let dir = FileUtils.getDir("ProfD", ["features", dirname]);
dir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
FileUtils.getDir("ProfD", ["features", dirname], true);
updatesDir.append(dirname);
// Copy in the system add-ons

View File

@ -2,8 +2,7 @@
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2");
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"], true);
registerDirectory("XREAppFeat", distroDir);
AddonTestUtils.usePrivilegedSignatures = id => "system";

View File

@ -2,8 +2,7 @@
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2");
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"], true);
registerDirectory("XREAppFeat", distroDir);
AddonTestUtils.usePrivilegedSignatures = id => "system";

View File

@ -2,8 +2,7 @@
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2");
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"], true);
registerDirectory("XREAppFeat", distroDir);
AddonTestUtils.usePrivilegedSignatures = id => "system";

View File

@ -2,8 +2,7 @@
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2");
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"], true);
registerDirectory("XREAppFeat", distroDir);
AddonTestUtils.usePrivilegedSignatures = id => "system";

View File

@ -13,8 +13,7 @@ Services.policies; // Load policy engine
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2");
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"], true);
registerDirectory("XREAppFeat", distroDir);
add_task(() => initSystemAddonDirs());

View File

@ -2,8 +2,7 @@
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2");
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"], true);
registerDirectory("XREAppFeat", distroDir);
add_task(() => initSystemAddonDirs());

View File

@ -3,8 +3,7 @@
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2");
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"], true);
registerDirectory("XREAppFeat", distroDir);
AddonTestUtils.usePrivilegedSignatures = id => "system";

View File

@ -2,8 +2,7 @@
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2");
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"], true);
registerDirectory("XREAppFeat", distroDir);
AddonTestUtils.usePrivilegedSignatures = id => "system";

View File

@ -2,8 +2,7 @@
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2");
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"], true);
registerDirectory("XREAppFeat", distroDir);
add_task(() => initSystemAddonDirs());

View File

@ -2,8 +2,7 @@
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2");
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"], true);
registerDirectory("XREAppFeat", distroDir);
AddonTestUtils.usePrivilegedSignatures = "system";

View File

@ -2,8 +2,7 @@
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2");
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"], true);
registerDirectory("XREAppFeat", distroDir);
AddonTestUtils.usePrivilegedSignatures = id => "system";

View File

@ -13,11 +13,11 @@ AddonTestUtils.createAppInfo(
BootstrapMonitor.init();
// A test directory for default/builtin system addons.
const systemDefaults = FileUtils.getDir("ProfD", [
"app-system-defaults",
"features",
]);
systemDefaults.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
const systemDefaults = FileUtils.getDir(
"ProfD",
["app-system-defaults", "features"],
true
);
registerDirectory("XREAppFeat", systemDefaults);
AddonTestUtils.usePrivilegedSignatures = id => "system";

View File

@ -6,8 +6,7 @@
// are honored during startup/restarts/upgrades.
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2");
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"], true);
registerDirectory("XREAppFeat", distroDir);
AddonTestUtils.usePrivilegedSignatures = "system";

View File

@ -2,8 +2,7 @@
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2");
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"]);
distroDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "empty"], true);
registerDirectory("XREAppFeat", distroDir);
AddonTestUtils.usePrivilegedSignatures = "system";

View File

@ -550,7 +550,7 @@ export var BackgroundUpdate = {
// put a log file in the specified location. But just to be safe,
// we'll do some cleanup when we re-register the task to make sure
// that no log file is hanging around in the old location.
let oldUpdateDir = lazy.FileUtils.getDir("OldUpdRootD", []);
let oldUpdateDir = lazy.FileUtils.getDir("OldUpdRootD", [], false);
let oldLog = oldUpdateDir.clone();
oldLog.append("backgroundupdate.moz_log");

View File

@ -60,7 +60,7 @@ function getUpdateBaseDirNoCreate() {
}
}
return FileUtils.getDir(KEY_UPDROOT, []);
return FileUtils.getDir(KEY_UPDROOT, [], false);
}
export function UpdateServiceStub() {
@ -146,8 +146,8 @@ function deactivateUpdateLogFile() {
function migrateUpdateDirectory() {
LOG("UpdateServiceStub:migrateUpdateDirectory Performing migration");
let sourceRootDir = FileUtils.getDir(KEY_OLD_UPDROOT, []);
let destRootDir = FileUtils.getDir(KEY_UPDROOT, []);
let sourceRootDir = FileUtils.getDir(KEY_OLD_UPDROOT, [], false);
let destRootDir = FileUtils.getDir(KEY_UPDROOT, [], false);
let hash = destRootDir.leafName;
if (!sourceRootDir.exists()) {

View File

@ -190,7 +190,7 @@ update directory:
.. code::
ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs").FileUtils.getDir("UpdRootD", []).path
ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs").FileUtils.getDir("UpdRootD", [], false).path
Once you have determined the update directory, close Firefox, browse to
the directory and remove the subdirectory called ``updates``.

View File

@ -142,8 +142,7 @@ class TestNoWindowUpdateRestart(MarionetteTestCase):
# skipped, allowing us to look at the update status file directly.
update_status_path = self.marionette.execute_script(
"""
let statusFile = FileUtils.getDir("UpdRootD", ["updates", "0"]);
statusFile.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let statusFile = FileUtils.getDir("UpdRootD", ["updates", "0"], true);
statusFile.append("update.status");
return statusFile.path;
"""