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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2004653002: OpenURL post data handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@post-data-my-stuff
Patch Set: Rebasing... Created 4 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
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 60145c2b47d981608ae9c0ab29df9447077b1875..8efe23409d1ca806efc04c843690c20bda6c1624 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -808,6 +808,10 @@ bool IsContentWithCertificateErrorsRelevantToUI(
ssl_status.connection_status);
}
+bool IsHttpPost(const blink::WebURLRequest& request) {
+ return request.httpMethod().utf8() == "POST";
+}
+
#if defined(OS_ANDROID)
// Returns true if WMPI should be used for playback, false otherwise.
//
@@ -2987,8 +2991,9 @@ void RenderFrameImpl::loadURLExternally(const blink::WebURLRequest& request,
request.url(), referrer,
suggested_name));
} else {
- OpenURL(request.url(), referrer, policy, should_replace_current_entry,
- false);
+ OpenURL(request.url(), IsHttpPost(request),
+ GetRequestBodyForWebURLRequest(request), referrer, policy,
+ should_replace_current_entry, false);
}
}
@@ -4888,8 +4893,9 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
if (is_content_initiated && IsTopLevelNavigation(frame_) &&
render_view_->renderer_preferences_
.browser_handles_all_top_level_requests) {
- OpenURL(url, referrer, info.defaultPolicy, info.replacesCurrentHistoryItem,
- false);
+ OpenURL(url, IsHttpPost(info.urlRequest),
+ GetRequestBodyForWebURLRequest(info.urlRequest), referrer,
+ info.defaultPolicy, info.replacesCurrentHistoryItem, false);
return blink::WebNavigationPolicyIgnore; // Suppress the load here.
}
@@ -4898,8 +4904,9 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
// FrameNavigationEntry. If none is found, fall back to the default url.
if (SiteIsolationPolicy::UseSubframeNavigationEntries() &&
info.isHistoryNavigationInNewChildFrame && is_content_initiated) {
- OpenURL(url, referrer, info.defaultPolicy, info.replacesCurrentHistoryItem,
- true);
+ OpenURL(url, IsHttpPost(info.urlRequest),
+ GetRequestBodyForWebURLRequest(info.urlRequest), referrer,
+ info.defaultPolicy, info.replacesCurrentHistoryItem, true);
// Suppress the load in Blink but mark the frame as loading.
return blink::WebNavigationPolicyHandledByClient;
}
@@ -4914,15 +4921,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
// an extension or app origin, leaving a WebUI page, etc). We only care about
// top-level navigations (not iframes). But we sometimes navigate to
// about:blank to clear a tab, and we want to still allow that.
- //
- // Note: this is known to break POST submissions when crossing process
- // boundaries until http://crbug.com/101395 is fixed. This is better for
- // security than loading a WebUI, extension or app page in the wrong process.
- // POST requests don't work because this mechanism does not preserve form
- // POST data. We will need to send the request's httpBody data up to the
- // browser process, and issue a special POST navigation in WebKit (via
- // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl
- // for examples of how to send the httpBody data.
if (!frame_->parent() && is_content_initiated &&
!url.SchemeIs(url::kAboutScheme)) {
bool send_referrer = false;
@@ -4962,7 +4960,9 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
}
if (should_fork) {
- OpenURL(url, send_referrer ? referrer : Referrer(), info.defaultPolicy,
+ OpenURL(url, IsHttpPost(info.urlRequest),
+ GetRequestBodyForWebURLRequest(info.urlRequest),
+ send_referrer ? referrer : Referrer(), info.defaultPolicy,
info.replacesCurrentHistoryItem, false);
return blink::WebNavigationPolicyIgnore; // Suppress the load here.
}
@@ -5002,8 +5002,9 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
if (is_fork) {
// Open the URL via the browser, not via WebKit.
- OpenURL(url, Referrer(), info.defaultPolicy,
- info.replacesCurrentHistoryItem, false);
+ OpenURL(url, IsHttpPost(info.urlRequest),
+ GetRequestBodyForWebURLRequest(info.urlRequest), Referrer(),
+ info.defaultPolicy, info.replacesCurrentHistoryItem, false);
return blink::WebNavigationPolicyIgnore;
}
@@ -5333,13 +5334,18 @@ void RenderFrameImpl::OnSelectPopupMenuItems(
#endif
#endif
-void RenderFrameImpl::OpenURL(const GURL& url,
- const Referrer& referrer,
- WebNavigationPolicy policy,
- bool should_replace_current_entry,
- bool is_history_navigation_in_new_child) {
+void RenderFrameImpl::OpenURL(
+ const GURL& url,
+ bool uses_post,
+ const scoped_refptr<ResourceRequestBodyImpl>& resource_request_body,
+ const Referrer& referrer,
+ WebNavigationPolicy policy,
+ bool should_replace_current_entry,
+ bool is_history_navigation_in_new_child) {
FrameHostMsg_OpenURL_Params params;
params.url = url;
+ params.uses_post = uses_post;
+ params.resource_request_body = resource_request_body;
params.referrer = referrer;
params.disposition = RenderViewImpl::NavigationPolicyToDisposition(policy);
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698