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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 11193051: To fix the cross-site post submission bug. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Comments Created 8 years, 1 month 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/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index df435f0bfa05a9d567fd257c0a140c05d1db9df1..936c380930f2ea2cf7e898e0560d4bbece51f1aa 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -135,6 +135,7 @@
// it, but if so, the existing frame relationships will be maintained.
using webkit_glue::WebPreferences;
+using webkit_glue::ResourceRequestBody;
namespace content {
namespace {
@@ -212,11 +213,8 @@ void MakeNavigateParams(const NavigationEntryImpl& entry,
params->allow_download = !entry.IsViewSourceMode();
params->is_post = entry.GetHasPostData();
if(entry.GetBrowserInitiatedPostData()) {
- params->browser_initiated_post_data.assign(
- entry.GetBrowserInitiatedPostData()->front(),
- entry.GetBrowserInitiatedPostData()->front() +
- entry.GetBrowserInitiatedPostData()->size());
-
+ params->browser_initiated_post_data =
+ entry.GetBrowserInitiatedPostData();
}
if (reload_type == NavigationControllerImpl::RELOAD_ORIGINAL_REQUEST_URL &&
@@ -2854,12 +2852,15 @@ void WebContentsImpl::DocumentOnLoadCompletedInMainFrame(
Details<int>(&page_id));
}
-void WebContentsImpl::RequestOpenURL(RenderViewHost* rvh,
- const GURL& url,
- const Referrer& referrer,
- WindowOpenDisposition disposition,
- int64 source_frame_id,
- bool is_cross_site_redirect) {
+void WebContentsImpl::RequestOpenURL(
+ RenderViewHost* rvh,
+ const GURL& url,
+ const Referrer& referrer,
+ WindowOpenDisposition disposition,
+ int64 source_frame_id,
+ bool is_cross_site_redirect,
+ std::string extra_header,
+ scoped_refptr<ResourceRequestBody> request_body) {
// If this came from a swapped out RenderViewHost, we only allow the request
// if we are still in the same BrowsingInstance.
if (static_cast<RenderViewHostImpl*>(rvh)->is_swapped_out() &&
@@ -2870,7 +2871,8 @@ void WebContentsImpl::RequestOpenURL(RenderViewHost* rvh,
// Delegate to RequestTransferURL because this is just the generic
// case where |old_request_id| is empty.
RequestTransferURL(url, referrer, disposition, source_frame_id,
- GlobalRequestID(), is_cross_site_redirect);
+ GlobalRequestID(), is_cross_site_redirect,
+ extra_header, request_body);
}
void WebContentsImpl::RequestTransferURL(
@@ -2879,7 +2881,9 @@ void WebContentsImpl::RequestTransferURL(
WindowOpenDisposition disposition,
int64 source_frame_id,
const GlobalRequestID& old_request_id,
- bool is_cross_site_redirect) {
+ bool is_cross_site_redirect,
+ std::string extra_header,
+ scoped_refptr<ResourceRequestBody> request_body) {
WebContents* new_contents = NULL;
PageTransition transition_type = PAGE_TRANSITION_LINK;
if (render_manager_.web_ui()) {
@@ -2902,6 +2906,11 @@ void WebContentsImpl::RequestTransferURL(
PAGE_TRANSITION_LINK, true /* is_renderer_initiated */);
params.transferred_global_request_id = old_request_id;
params.is_cross_site_redirect = is_cross_site_redirect;
+ if(request_body != NULL) {
Charlie Reis 2012/11/20 05:46:03 nit: Space after if. nit: Don't need "!= NULL"
irobert 2012/11/22 01:37:00 Done.
+ params.transition = content::PAGE_TRANSITION_FORM_SUBMIT;
+ params.extra_headers = extra_header;
+ params.browser_initiated_post_data = request_body;
+ }
new_contents = OpenURL(params);
}
if (new_contents) {

Powered by Google App Engine
This is Rietveld 408576698