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

Unified Diff: content/browser/frame_host/navigation_request.cc

Issue 1956383003: Forwarding POST body into renderer after a cross-site transfer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Extracted a shared NavigationEntryImpl::ConstructResourceRequestBody. Created 4 years, 7 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/frame_host/navigation_request.cc
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
index e79509c978910a56fdf6611bad223a131cd5cb6c..e035df7693224bde2897adbeb9d9a7b0146fcd9c 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -82,19 +82,14 @@ std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated(
GetContentClient()->GetUserAgent());
// Fill POST data from the browser in the request body.
- scoped_refptr<ResourceRequestBody> request_body;
- if (entry.GetHasPostData()) {
- request_body = new ResourceRequestBody();
- request_body->AppendBytes(
- reinterpret_cast<const char *>(
- entry.GetBrowserInitiatedPostData()->front()),
- entry.GetBrowserInitiatedPostData()->size());
- }
+ scoped_refptr<ResourceRequestBody> request_body =
+ entry.ConstructResourceRequestBody();
std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest(
- frame_tree_node, entry.ConstructCommonNavigationParams(
- dest_url, dest_referrer, navigation_type, lofi_state,
- navigation_start),
+ frame_tree_node,
+ entry.ConstructCommonNavigationParams(
+ request_body ? "POST" : "GET", dest_url, dest_referrer,
clamy 2016/05/19 16:08:00 This should be frame_entry.method().
Łukasz Anforowicz 2016/05/19 18:06:58 Arrgh. Thanks for catching this. Done.
+ navigation_type, lofi_state, navigation_start),
BeginNavigationParams(headers.ToString(),
LoadFlagFromNavigationType(navigation_type),
false, // has_user_gestures
@@ -215,8 +210,9 @@ void NavigationRequest::BeginNavigation() {
// TODO(clamy): pass the method to the NavigationHandle instead of a
// boolean.
navigation_handle_->WillStartRequest(
- common_params_.method, Referrer::SanitizeForRequest(
- common_params_.url, common_params_.referrer),
+ common_params_.method, info_->request_body,
+ Referrer::SanitizeForRequest(common_params_.url,
+ common_params_.referrer),
begin_params_.has_user_gesture, common_params_.transition, false,
base::Bind(&NavigationRequest::OnStartChecksComplete,
base::Unretained(this)));

Powered by Google App Engine
This is Rietveld 408576698