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

Unified Diff: content/browser/frame_host/navigation_handle_impl.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: Rebasing... 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_handle_impl.cc
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc
index 240eba7416107135f096249c2f9b94954e080c84..d7fc3efd32681a33e729ae10a4e8db16279320bf 100644
--- a/content/browser/frame_host/navigation_handle_impl.cc
+++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -12,6 +12,7 @@
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/browser/service_worker/service_worker_navigation_handle.h"
#include "content/common/frame_messages.h"
+#include "content/common/resource_request_body.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/common/browser_side_navigation_policy.h"
#include "content/public/common/content_client.h"
@@ -144,10 +145,10 @@ const base::TimeTicks& NavigationHandleImpl::NavigationStart() {
return navigation_start_;
}
-bool NavigationHandleImpl::IsPost() {
+const std::string& NavigationHandleImpl::GetMethod() {
CHECK_NE(INITIAL, state_)
<< "This accessor should not be called before the request is started.";
- return method_ == "POST";
+ return method_;
}
const Referrer& NavigationHandleImpl::GetReferrer() {
@@ -250,7 +251,7 @@ NavigationHandleImpl::CallWillStartRequestForTesting(
ui::PageTransition transition,
bool is_external_protocol) {
NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER;
- WillStartRequest(is_post ? "POST" : "GET", sanitized_referrer,
+ WillStartRequest(is_post ? "POST" : "GET", nullptr, sanitized_referrer,
has_user_gesture, transition, is_external_protocol,
base::Bind(&UpdateThrottleCheckResult, &result));
@@ -289,6 +290,7 @@ void NavigationHandleImpl::InitServiceWorkerHandle(
void NavigationHandleImpl::WillStartRequest(
const std::string& method,
+ const scoped_refptr<content::ResourceRequestBody>& resource_request_body,
const Referrer& sanitized_referrer,
bool has_user_gesture,
ui::PageTransition transition,
@@ -296,6 +298,7 @@ void NavigationHandleImpl::WillStartRequest(
const ThrottleChecksFinishedCallback& callback) {
// Update the navigation parameters.
clamy 2016/05/26 15:35:23 Add a DCHECK that resource_request_body is null ou
Łukasz Anforowicz 2016/05/26 17:14:02 Done.
method_ = method;
+ resource_request_body_ = resource_request_body;
sanitized_referrer_ = sanitized_referrer;
has_user_gesture_ = has_user_gesture;
transition_ = transition;
@@ -339,6 +342,8 @@ void NavigationHandleImpl::WillRedirectRequest(
is_external_protocol_ = new_is_external_protocol;
response_headers_ = response_headers;
was_redirected_ = true;
+ if (new_method != "POST")
+ resource_request_body_ = nullptr;
state_ = WILL_REDIRECT_REQUEST;
complete_callback_ = callback;

Powered by Google App Engine
This is Rietveld 408576698