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

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: New OpenURL function and DataType Test 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 c4bb81bd89f424e150f7d490c74d6878cc253710..bc3424b573b0b4836ad69d07c9a59ed39237d39c 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 &&
@@ -2857,11 +2855,14 @@ void WebContentsImpl::DocumentOnLoadCompletedInMainFrame(
Details<int>(&page_id));
}
-void WebContentsImpl::RequestOpenURL(RenderViewHost* rvh,
- const GURL& url,
- const Referrer& referrer,
- WindowOpenDisposition disposition,
- int64 source_frame_id) {
+void WebContentsImpl::RequestOpenURL(
+ RenderViewHost* rvh,
+ const GURL& url,
+ const Referrer& referrer,
+ WindowOpenDisposition disposition,
+ int64 source_frame_id,
+ 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() &&
@@ -2872,7 +2873,7 @@ 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());
+ GlobalRequestID(), extra_header, request_body);
}
void WebContentsImpl::RequestTransferURL(
@@ -2880,7 +2881,9 @@ void WebContentsImpl::RequestTransferURL(
const Referrer& referrer,
WindowOpenDisposition disposition,
int64 source_frame_id,
- const GlobalRequestID& old_request_id) {
+ const GlobalRequestID& old_request_id,
+ 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 +2905,11 @@ void WebContentsImpl::RequestTransferURL(
OpenURLParams params(url, referrer, source_frame_id, disposition,
PAGE_TRANSITION_LINK, true /* is_renderer_initiated */);
params.transferred_global_request_id = old_request_id;
+ if(request_body != NULL) {
+ 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