Bug 910412 - Filesystem API permission request and checks. r=dhylands

This commit is contained in:
Yuan Xulei
2014-03-05 11:24:19 +08:00
parent 1106e41f30
commit c7cb4300e9
17 changed files with 419 additions and 4 deletions

View File

@@ -47,6 +47,24 @@ FileSystemUtils::NormalizedPathToLocalPath(const nsAString& aNorm,
aLocal = result;
}
// static
bool
FileSystemUtils::IsDescendantPath(const nsAString& aPath,
const nsAString& aDescendantPath)
{
// The descendant path should begin with its ancestor path.
nsAutoString prefix;
prefix = aPath + NS_LITERAL_STRING(FILESYSTEM_DOM_PATH_SEPARATOR);
// Check the sub-directory path to see if it has the parent path as prefix.
if (aDescendantPath.Length() < prefix.Length() ||
!StringBeginsWith(aDescendantPath, prefix)) {
return false;
}
return true;
}
// static
bool
FileSystemUtils::IsParentProcess()