diff options
author | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-27 22:31:23 +0000 |
---|---|---|
committer | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-27 22:31:23 +0000 |
commit | c9f6f1ac15f4ed6901f4c58b364b6454ea56e54d (patch) | |
tree | d7e2fcd1119005fa18faf5b0a633a2005fdc8547 | |
parent | ac760d5398974a28a2e93f0c8b2bfc443b4519d9 (diff) | |
download | chromium_src-c9f6f1ac15f4ed6901f4c58b364b6454ea56e54d.zip chromium_src-c9f6f1ac15f4ed6901f4c58b364b6454ea56e54d.tar.gz chromium_src-c9f6f1ac15f4ed6901f4c58b364b6454ea56e54d.tar.bz2 |
Merge 132672 - Don't overwrite write permissions granted to renderer when dragging files.
We unconditionally granted the read access to the renderer when dragging in
files. Unfortunately, this breaks things like the File Manager which actually
have write access to certain parts of the filesystem. In order to prevent file
dragging from downgrading child permissions, we first check if the renderer
can already read the file before setting read permissions for it.
BUG=chromium-os:28809
TEST=manual
Review URL: http://codereview.chromium.org/10086020
TBR=dcheng@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10257021
git-svn-id: svn://svn.chromium.org/chrome/branches/1084/src@134374 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/browser/renderer_host/render_view_host_impl.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc index e31de0f..91a217e 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc @@ -498,11 +498,19 @@ void RenderViewHostImpl::DragTargetDragEnter( iter != filtered_data.filenames.end(); ++iter) { FilePath path = FilePath::FromWStringHack(UTF16ToWideHack(*iter)); policy->GrantRequestURL(renderer_id, net::FilePathToFileURL(path)); - policy->GrantReadFile(renderer_id, path); - // Allow dragged directories to be enumerated by the child process. - // Note that we can't tell a file from a directory at this point. - policy->GrantReadDirectory(renderer_id, path); + // If the renderer already has permission to read these paths, we don't need + // to re-grant them. This prevents problems with DnD for files in the CrOS + // file manager--the file manager already had read/write access to those + // directories, but dragging a file would cause the read/write access to be + // overwritten with read-only access, making them impossible to delete or + // rename until the renderer was killed. + if (!policy->CanReadFile(renderer_id, path)) { + policy->GrantReadFile(renderer_id, path); + // Allow dragged directories to be enumerated by the child process. + // Note that we can't tell a file from a directory at this point. + policy->GrantReadDirectory(renderer_id, path); + } filesets.insert(path); } |