diff options
author | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-05 09:56:51 +0000 |
---|---|---|
committer | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-05 09:56:51 +0000 |
commit | b11694cdbeef8a20328c31398145914fe5d6eda7 (patch) | |
tree | 4b4aae1b8f0cee5d67aed9e161fcae5d90f79360 /android_webview/native | |
parent | a825561a4970fa62929057444b5f3679695d56d7 (diff) | |
download | chromium_src-b11694cdbeef8a20328c31398145914fe5d6eda7.zip chromium_src-b11694cdbeef8a20328c31398145914fe5d6eda7.tar.gz chromium_src-b11694cdbeef8a20328c31398145914fe5d6eda7.tar.bz2 |
[Android webview] Add CPSP config on state restore
When restoring a POST page, the ChildProcessSecurityPolicy will crash
the renderer (hence app in WebView) if the file paths are not setup.
BUG=268222
Review URL: https://chromiumcodereview.appspot.com/22027004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215583 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/native')
-rw-r--r-- | android_webview/native/state_serializer.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/android_webview/native/state_serializer.cc b/android_webview/native/state_serializer.cc index 632737c..6aa3ae1 100644 --- a/android_webview/native/state_serializer.cc +++ b/android_webview/native/state_serializer.cc @@ -9,8 +9,10 @@ #include "base/memory/scoped_vector.h" #include "base/pickle.h" #include "base/time/time.h" +#include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" +#include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/page_state.h" @@ -110,6 +112,23 @@ bool RestoreFromPickle(PickleIterator* iterator, content::NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, &restored_entries.get()); DCHECK_EQ(0u, restored_entries.size()); + + if (controller.GetActiveEntry()) { + // Set up the file access rights for the selected navigation entry. + // TODO(joth): This is duplicated from chrome/.../session_restore.cc and + // should be shared e.g. in NavigationController. http://crbug.com/68222 + const int id = web_contents->GetRenderProcessHost()->GetID(); + const content::PageState& page_state = + controller.GetActiveEntry()->GetPageState(); + const std::vector<base::FilePath>& file_paths = + page_state.GetReferencedFiles(); + for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); + file != file_paths.end(); ++file) { + content::ChildProcessSecurityPolicy::GetInstance()->GrantReadFile(id, + *file); + } + } + controller.LoadIfNecessary(); return true; |