Bug 1173320 - patch 1/8 - Implement Directory object as string and not as BlobImpl, r=smaug

This commit is contained in:
Andrea Marchesini committed 2016-03-19 22:29:46 +01:00
1 parent 1388b33044
commit 97ca49dfa3
42 files changed
+1579 -883

No files matched your search

+13 -7
View File
@@ -46,17 +46,17 @@ DeviceStorageFileSystem::DeviceStorageFileSystem(
NS_WARN_IF(NS_FAILED(rv));
// Get the local path of the file system root.
// Since the child process is not allowed to access the file system, we only
// do this from the parent process.
if (!XRE_IsParentProcess()) {
return;
}
nsCOMPtr<nsIFile> rootFile;
DeviceStorageFile::GetRootDirectoryForType(aStorageType,
aStorageName,
getter_AddRefs(rootFile));
NS_WARN_IF(!rootFile || NS_FAILED(rootFile->GetPath(mLocalRootPath)));
if (!XRE_IsParentProcess()) {
return;
}
FileSystemUtils::LocalPathToNormalizedPath(mLocalRootPath,
mNormalizedLocalRootPath);
@@ -132,8 +132,14 @@ DeviceStorageFileSystem::IsSafeDirectory(Directory* aDir) const
{
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
MOZ_ASSERT(aDir);
RefPtr<FileSystemBase> fs = aDir->GetFileSystem();
MOZ_ASSERT(fs);
ErrorResult rv;
RefPtr<FileSystemBase> fs = aDir->GetFileSystem(rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return false;
}
// Check if the given directory is from this storage.
return fs->ToString() == mString;
}