Bug 1459206 - Use FileSystemSecurity in ContentParent::RecvGetFilesRequest, r=ehsan

This commit is contained in:
Andrea Marchesini 2018-05-10 11:24:25 +02:00
parent 913f117401
commit bb4ddb115c
2 changed files with 9 additions and 0 deletions

View File

@ -151,6 +151,7 @@ function test_changeDataWhileWorking() {
function test_setup() {
SpecialPowers.pushPrefEnv({"set": [["dom.input.dirpicker", true],
["dom.filesystem.pathcheck.disabled", true],
["dom.webkitBlink.dirPicker.enabled", true]]}, next);
}

View File

@ -5249,6 +5249,14 @@ ContentParent::RecvGetFilesRequest(const nsID& aUUID,
{
MOZ_ASSERT(!mGetFilesPendingRequests.GetWeak(aUUID));
if (!mozilla::Preferences::GetBool("dom.filesystem.pathcheck.disabled", false)) {
RefPtr<FileSystemSecurity> fss = FileSystemSecurity::Get();
if (NS_WARN_IF(!fss ||
!fss->ContentProcessHasAccessTo(ChildID(), aDirectoryPath))) {
return IPC_FAIL_NO_REASON(this);
}
}
ErrorResult rv;
RefPtr<GetFilesHelper> helper =
GetFilesHelperParent::Create(aUUID, aDirectoryPath, aRecursiveFlag, this,