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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 1999943002: Moving HTTP POST body from StartNavigationParams to CommonNavigationParams. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR feedback from clamy@. 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
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_view_browsertest.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 ed2b611bed047fcbbfaef807bb92a21c478f094b..3bc5e9a151787df1b5d5059f54079f0b825e6e7d 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -547,7 +547,7 @@ WebURLRequest CreateURLRequestForNavigation(
// to the WebURLRequest used to commit the navigation. This ensures that the
// POST data will be in the PageState sent to the browser on commit.
void AddHTTPBodyToRequest(WebURLRequest* request,
- scoped_refptr<ResourceRequestBody> body) {
+ const scoped_refptr<ResourceRequestBody>& body) {
WebHTTPBody http_body;
http_body.initialize();
http_body.setIdentifier(body->identifier());
@@ -639,7 +639,8 @@ CommonNavigationParams MakeCommonNavigationParams(
request->url(), referrer, extra_data->transition_type(),
FrameMsg_Navigate_Type::NORMAL, true, should_replace_current_entry,
ui_timestamp, report_type, GURL(), GURL(), extra_data->lofi_state(),
- base::TimeTicks::Now(), request->httpMethod().latin1());
+ base::TimeTicks::Now(), request->httpMethod().latin1(),
+ GetRequestBodyForWebURLRequest(*request));
}
media::Context3D GetSharedMainThreadContext3D(
@@ -1588,7 +1589,7 @@ void RenderFrameImpl::OnNavigate(
TRACE_EVENT2("navigation", "RenderFrameImpl::OnNavigate", "id", routing_id_,
"url", common_params.url.possibly_invalid_spec());
NavigateInternal(common_params, start_params, request_params,
- std::unique_ptr<StreamOverrideParameters>(), nullptr);
+ std::unique_ptr<StreamOverrideParameters>());
}
void RenderFrameImpl::BindServiceRegistry(
@@ -4726,8 +4727,7 @@ void RenderFrameImpl::OnCommitNavigation(
const ResourceResponseHead& response,
const GURL& stream_url,
const CommonNavigationParams& common_params,
- const RequestNavigationParams& request_params,
- scoped_refptr<ResourceRequestBody> post_data) {
+ const RequestNavigationParams& request_params) {
CHECK(IsBrowserSideNavigationEnabled());
// This will override the url requested by the WebURLLoader, as well as
// provide it with the response to the request.
@@ -4737,7 +4737,7 @@ void RenderFrameImpl::OnCommitNavigation(
stream_override->response = response;
NavigateInternal(common_params, StartNavigationParams(), request_params,
- std::move(stream_override), post_data);
+ std::move(stream_override));
}
// PlzNavigate
@@ -5333,8 +5333,7 @@ void RenderFrameImpl::NavigateInternal(
const CommonNavigationParams& common_params,
const StartNavigationParams& start_params,
const RequestNavigationParams& request_params,
- std::unique_ptr<StreamOverrideParameters> stream_params,
- scoped_refptr<ResourceRequestBody> post_data) {
+ std::unique_ptr<StreamOverrideParameters> stream_params) {
bool browser_side_navigation = IsBrowserSideNavigationEnabled();
// Lower bound for browser initiated navigation start time.
@@ -5395,8 +5394,8 @@ void RenderFrameImpl::NavigateInternal(
CreateURLRequestForNavigation(common_params, std::move(stream_params),
frame_->isViewSourceModeEnabled());
- if (IsBrowserSideNavigationEnabled() && post_data)
- AddHTTPBodyToRequest(&request, post_data);
+ if (IsBrowserSideNavigationEnabled() && common_params.post_data)
+ AddHTTPBodyToRequest(&request, common_params.post_data);
// Used to determine whether this frame is actually loading a request as part
// of a history navigation.
@@ -5487,18 +5486,9 @@ void RenderFrameImpl::NavigateInternal(
}
}
- if (common_params.method == "POST" && !browser_side_navigation) {
- // Set post data.
- WebHTTPBody http_body;
- http_body.initialize();
- const char* data = nullptr;
- if (start_params.browser_initiated_post_data.size()) {
- data = reinterpret_cast<const char*>(
- &start_params.browser_initiated_post_data.front());
- }
- http_body.appendData(
- WebData(data, start_params.browser_initiated_post_data.size()));
- request.setHTTPBody(http_body);
+ if (common_params.method == "POST" && !browser_side_navigation &&
+ common_params.post_data) {
+ AddHTTPBodyToRequest(&request, common_params.post_data);
}
// A session history navigation should have been accompanied by state.
@@ -5757,8 +5747,7 @@ void RenderFrameImpl::BeginNavigation(blink::WebURLRequest* request,
GetLoadFlagsForWebURLRequest(*request),
request->hasUserGesture(),
request->skipServiceWorker(),
- GetRequestContextTypeForWebURLRequest(*request)),
- GetRequestBodyForWebURLRequest(*request)));
+ GetRequestContextTypeForWebURLRequest(*request))));
}
void RenderFrameImpl::LoadDataURL(
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698