summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/worker_host/worker_process_host.cc23
-rw-r--r--webkit/fileapi/file_system_path_manager.h4
2 files changed, 27 insertions, 0 deletions
diff --git a/chrome/browser/worker_host/worker_process_host.cc b/chrome/browser/worker_host/worker_process_host.cc
index c8df23d..4bb38c0 100644
--- a/chrome/browser/worker_host/worker_process_host.cc
+++ b/chrome/browser/worker_host/worker_process_host.cc
@@ -37,6 +37,7 @@
#include "net/base/mime_util.h"
#include "ipc/ipc_switches.h"
#include "net/base/registry_controlled_domain.h"
+#include "webkit/fileapi/file_system_path_manager.h"
// Notifies RenderViewHost that one or more worker objects crashed.
class WorkerCrashTask : public Task {
@@ -184,6 +185,28 @@ bool WorkerProcessHost::Init() {
cmd_line);
ChildProcessSecurityPolicy::GetInstance()->Add(id());
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableFileSystem)) {
+ // Grant most file permissions to this worker.
+ // PLATFORM_FILE_TEMPORARY, PLATFORM_FILE_HIDDEN and
+ // PLATFORM_FILE_DELETE_ON_CLOSE are not granted, because no existing API
+ // requests them.
+ ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile(
+ id(),
+ request_context_->file_system_host_context()->
+ path_manager()->base_path(),
+ base::PLATFORM_FILE_OPEN |
+ base::PLATFORM_FILE_CREATE |
+ base::PLATFORM_FILE_OPEN_ALWAYS |
+ base::PLATFORM_FILE_CREATE_ALWAYS |
+ base::PLATFORM_FILE_READ |
+ base::PLATFORM_FILE_WRITE |
+ base::PLATFORM_FILE_EXCLUSIVE_READ |
+ base::PLATFORM_FILE_EXCLUSIVE_WRITE |
+ base::PLATFORM_FILE_ASYNC |
+ base::PLATFORM_FILE_TRUNCATE |
+ base::PLATFORM_FILE_WRITE_ATTRIBUTES);
+ }
return true;
}
diff --git a/webkit/fileapi/file_system_path_manager.h b/webkit/fileapi/file_system_path_manager.h
index 99e0bfc..12104ef 100644
--- a/webkit/fileapi/file_system_path_manager.h
+++ b/webkit/fileapi/file_system_path_manager.h
@@ -70,6 +70,10 @@ class FileSystemPathManager {
static const char kPersistentName[];
static const char kTemporaryName[];
+ const FilePath& base_path() const {
+ return base_path_;
+ }
+
private:
class GetFileSystemRootPathTask;