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

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: Attempting to rebase on top of clamy@'s other CL. 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 13970832f8c6f0e11fd72d027212b212bcf4ffcb..45c538e34f99109d31782383b1f63f7c007ad40d 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -81,23 +81,17 @@ std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated(
headers.SetHeaderIfMissing(net::HttpRequestHeaders::kUserAgent,
GetContentClient()->GetUserAgent());
- // Fill POST data in the request body.
- scoped_refptr<ResourceRequestBody> request_body;
- if (frame_entry.method() == "POST") {
- request_body = frame_entry.GetPostData();
- if (!request_body && entry.GetBrowserInitiatedPostData()) {
- request_body = new ResourceRequestBody();
- request_body->AppendBytes(
- reinterpret_cast<const char*>(
- entry.GetBrowserInitiatedPostData()->front()),
- entry.GetBrowserInitiatedPostData()->size());
- }
- }
+ // Fill POST data from the browser in the request body.
+ scoped_refptr<ResourceRequestBody> request_body =
+ entry.ConstructBodyFromBrowserInitiatedPostData();
clamy 2016/05/20 15:49:14 It's very important to check frame_entry.GetPostDa
Łukasz Anforowicz 2016/05/20 22:18:47 Done.
std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest(
- frame_tree_node, entry.ConstructCommonNavigationParams(
- frame_entry, dest_url, dest_referrer,
- navigation_type, lofi_state, navigation_start),
+ frame_tree_node,
+ entry.ConstructCommonNavigationParams(
+ frame_entry,
+ false, // |force_post_method|, ignored in PlzNavigate mode.
+ dest_url, dest_referrer, navigation_type, lofi_state,
+ navigation_start),
BeginNavigationParams(headers.ToString(),
LoadFlagFromNavigationType(navigation_type),
false, // has_user_gestures
@@ -219,8 +213,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