bug 714168 - make reftest-remote seems to fail on tablets because nsLocalFileUnix throws exceptions when setting file permissions on a FAT file system r=mossop,unfocussed

This commit is contained in:
Brad Lassey 2012-01-25 03:24:52 -05:00
parent b67c1b14d9
commit 24036897e7

View File

@ -200,6 +200,24 @@ var gIDTest = /^(\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\
return this[aName];
})
}, this);
/**
* Sets permissions on a file
*
* @param aFile
* The file or directory to operate on.
* @param aPermissions
* The permisions to set
*/
function setFilePermissions(aFile, aPermissions) {
try {
aFile.permissions = aPermissions;
}
catch (e) {
WARN("Failed to set permissions " + aPermissions.toString(8) + " on " +
aFile.path, e);
}
}
/**
* A safe way to install a file or the contents of a directory to a new
@ -279,7 +297,7 @@ SafeInstallOperation.prototype = {
// The directory should be empty by this point. If it isn't this will throw
// and all of the operations will be rolled back
try {
aDirectory.permissions = FileUtils.PERMS_DIRECTORY;
setPermissions(aDirectory, FileUtils.PERMS_DIRECTORY);
aDirectory.remove(false);
}
catch (e) {
@ -1085,7 +1103,13 @@ function extractFiles(aZipFile, aDir) {
continue;
zipReader.extract(entryName, target);
target.permissions |= FileUtils.PERMS_FILE;
try {
target.permissions |= FileUtils.PERMS_FILE;
}
catch (e) {
WARN("Failed to set permissions " + aPermissions.toString(8) + " on " +
target.path, e);
}
}
}
finally {
@ -1252,7 +1276,7 @@ function cleanStagingDir(aDir, aLeafNames) {
}
try {
aDir.permissions = FileUtils.PERMS_DIRECTORY;
setPermissions(aDir, FileUtils.PERMS_DIRECTORY);
aDir.remove(false);
}
catch (e) {
@ -1268,8 +1292,8 @@ function cleanStagingDir(aDir, aLeafNames) {
* The nsIFile to remove
*/
function recursiveRemove(aFile) {
aFile.permissions = aFile.isDirectory() ? FileUtils.PERMS_DIRECTORY
: FileUtils.PERMS_FILE;
setPermissions(aFile, aFile.isDirectory() ? FileUtils.PERMS_DIRECTORY
: FileUtils.PERMS_FILE);
try {
aFile.remove(true);
@ -8076,7 +8100,11 @@ DirectoryInstallLocation.prototype = {
let newFile = this._directory.clone().QueryInterface(Ci.nsILocalFile);
newFile.append(aSource.leafName);
newFile.lastModifiedTime = Date.now();
try {
newFile.lastModifiedTime = Date.now();
} catch (e) {
WARN("failed to set lastModifiedTime on " + newFile.path, e);
}
this._FileToIDMap[newFile.path] = aId;
this._IDToFileMap[aId] = newFile;