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

Unified Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 10544175: Add an ability to call WebKit's WebFrame::loadData via NavigationController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamings for clarity Created 8 years, 6 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
Index: content/browser/renderer_host/render_view_host_impl.cc
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index f2910cedff5063a1c9d90746329e716726840547..2c2a1b68ca66e1b83049a23a7bc8fbce8cf7acdd 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -303,6 +303,22 @@ void RenderViewHostImpl::SyncRendererPrefs() {
void RenderViewHostImpl::Navigate(const ViewMsg_Navigate_Params& params) {
ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL(
GetProcess()->GetID(), params.url);
+ if (!params.base_url_for_data_url.is_empty() &&
+ params.url.SchemeIs(chrome::kDataScheme)) {
+ // If 'data:' scheme is used, and we have a base url, grant access to
+ // local files if baseUrl specifies a scheme other than 'http', 'https',
+ // 'ftp', 'about' or 'javascript'.
Charlie Reis 2012/07/03 17:54:37 This doesn't make sense to me. Why would we grant
mnaganov (inactive) 2012/07/04 15:25:57 This is according to http://goo.gl/X8HOs. As the m
Charlie Reis 2012/07/10 20:54:19 Hmm. This sounds like it's following the letter o
mnaganov (inactive) 2012/07/23 14:02:29 I agree -- whitelisting allowed schemes is more se
+ if (!params.base_url_for_data_url.SchemeIs(chrome::kHttpScheme) &&
+ !params.base_url_for_data_url.SchemeIs(chrome::kHttpsScheme) &&
+ !params.base_url_for_data_url.SchemeIs(chrome::kFtpScheme) &&
+ !params.base_url_for_data_url.SchemeIs(chrome::kAboutScheme) &&
+ !params.base_url_for_data_url.SchemeIs(chrome::kJavaScriptScheme)) {
+ std::string file_url(chrome::kFileScheme);
+ file_url += content::kStandardSchemeSeparator;
+ ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL(
+ GetProcess()->GetID(), GURL(file_url));
+ }
+ }
ViewMsg_Navigate* nav_message = new ViewMsg_Navigate(GetRoutingID(), params);

Powered by Google App Engine
This is Rietveld 408576698