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

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 Android API, Helper Function and Include_rules 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7872c6a68e5f6df3219eceb33d9eccea5bd1344b..c28815076c43b6d04d097b68a7aed22253c1f871 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 &&
@@ -2884,12 +2882,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() &&
@@ -2900,7 +2901,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(
@@ -2909,7 +2911,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()) {
@@ -2932,6 +2936,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) {
+ 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) {
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698