Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(736)

Unified Diff: content/browser/fileapi/fileapi_message_filter.cc

Issue 10106017: Allow read access on a root directory of IsolatedFileSystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/fileapi/fileapi_message_filter.cc
diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc
index e3203c2773deaea74ac17b1f5ddc6a8e64ccc8b7..7e1941fe252622d8e8b3aaf7571aaa29ca760a85 100644
--- a/content/browser/fileapi/fileapi_message_filter.cc
+++ b/content/browser/fileapi/fileapi_message_filter.cc
@@ -26,9 +26,11 @@
#include "webkit/blob/blob_data.h"
#include "webkit/blob/blob_storage_controller.h"
#include "webkit/blob/shareable_file_reference.h"
+#include "webkit/fileapi/isolated_context.h"
#include "webkit/fileapi/file_system_context.h"
#include "webkit/fileapi/file_system_operation.h"
#include "webkit/fileapi/file_system_quota_util.h"
+#include "webkit/fileapi/file_system_types.h"
#include "webkit/fileapi/file_system_util.h"
#include "webkit/fileapi/sandbox_mount_point_provider.h"
@@ -645,11 +647,30 @@ bool FileAPIMessageFilter::HasPermissionsForFile(
return false;
}
- FilePath file_path =
- mount_point_provider->GetPathForPermissionsCheck(virtual_path);
- if (file_path.empty()) {
- *error = base::PLATFORM_FILE_ERROR_SECURITY;
- return false;
+ FilePath file_path;
+
+ // Special handling for isolated filesystem: its root path is purely
+ // virtual path and we don't have corresponding platform path with which
+ // we can check the permission. To allow read-access on the virtual root
+ // we always return true if CrackIsolatedPath returns true (i.e. the
+ // isolated filesystem is valid) and the returned path is empty, i.e.
+ // the virtual_path is pointing to the root.
+ if (file_system_type == fileapi::kFileSystemTypeIsolated) {
+ std::string fsid;
+ if (!fileapi::IsolatedContext::GetInstance()->CrackIsolatedPath(
+ virtual_path, &fsid, NULL, &file_path)) {
+ return false;
+ }
+ // The root directory case. Always allow read access as far as the
+ // filesystem is valid.
+ if (file_path.empty())
+ return (permissions == kReadFilePermissions);
+ } else {
+ file_path = mount_point_provider->GetPathForPermissionsCheck(virtual_path);
+ if (file_path.empty()) {
+ *error = base::PLATFORM_FILE_ERROR_SECURITY;
+ return false;
+ }
}
bool success =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698