diff options
author | davidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-19 04:33:42 +0000 |
---|---|---|
committer | davidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-19 04:33:42 +0000 |
commit | 4972fc82e6b6df8da332275d541bcead15d5a65e (patch) | |
tree | adac31a2be698268a6c03599251c4f4601345364 /content/browser/loader/cross_site_resource_handler.cc | |
parent | be12cc446c38f5d149318e8282dd32b726c02640 (diff) | |
download | chromium_src-4972fc82e6b6df8da332275d541bcead15d5a65e.zip chromium_src-4972fc82e6b6df8da332275d541bcead15d5a65e.tar.gz chromium_src-4972fc82e6b6df8da332275d541bcead15d5a65e.tar.bz2 |
Preserve should_replace_current_entry across request transfers.
When a request transfer happens, we lose the should_replace_current_entry bit
of the navigation. This results in us getting history wrong when, say, a hosted
Google Calendar app is installed and we client-redirect to it while not logged
in, triggering a server redirect to accounts.google.com and a request transfer.
Push this state down to the renderer into NavigationState so it can be
stapled to the request, bubbled back up to the CrossSiteResourceHandler and
into the transferred navigation.
Also test and fix a case where the state does not round-trip correctly if a
fresh renderer with a browser-initiated navigation decides to fork the
navigation back up to the browser anyway.
BUG=311721
TEST=SitePerProcessBrowserTest.ReplaceEntryCrossProcessThenTransfers
SitePerProcessBrowserTest.ReplaceEntryInProcessThenTransfers
SitePerProcessBrowserTest.ReplaceEntryCrossProcessTwice
Review URL: https://codereview.chromium.org/71993002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235918 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/loader/cross_site_resource_handler.cc')
-rw-r--r-- | content/browser/loader/cross_site_resource_handler.cc | 63 |
1 files changed, 46 insertions, 17 deletions
diff --git a/content/browser/loader/cross_site_resource_handler.cc b/content/browser/loader/cross_site_resource_handler.cc index f6274bd..c7afeb7 100644 --- a/content/browser/loader/cross_site_resource_handler.cc +++ b/content/browser/loader/cross_site_resource_handler.cc @@ -25,19 +25,47 @@ namespace content { namespace { -void OnCrossSiteResponseHelper(int render_view_id, - const GlobalRequestID& global_request_id, - bool is_transfer, - const std::vector<GURL>& transfer_url_chain, - const Referrer& referrer, - PageTransition page_transition, - int64 frame_id) { +// The parameters to OnCrossSiteResponseHelper exceed the number of arguments +// base::Bind supports. +struct CrossSiteResponseParams { + CrossSiteResponseParams(int render_view_id, + const GlobalRequestID& global_request_id, + bool is_transfer, + const std::vector<GURL>& transfer_url_chain, + const Referrer& referrer, + PageTransition page_transition, + int64 frame_id, + bool should_replace_current_entry) + : render_view_id(render_view_id), + global_request_id(global_request_id), + is_transfer(is_transfer), + transfer_url_chain(transfer_url_chain), + referrer(referrer), + page_transition(page_transition), + frame_id(frame_id), + should_replace_current_entry(should_replace_current_entry) { + } + + int render_view_id; + GlobalRequestID global_request_id; + bool is_transfer; + std::vector<GURL> transfer_url_chain; + Referrer referrer; + PageTransition page_transition; + int64 frame_id; + bool should_replace_current_entry; +}; + +void OnCrossSiteResponseHelper(const CrossSiteResponseParams& params) { RenderViewHostImpl* rvh = - RenderViewHostImpl::FromID(global_request_id.child_id, render_view_id); + RenderViewHostImpl::FromID(params.global_request_id.child_id, + params.render_view_id); if (rvh) { rvh->OnCrossSiteResponse( - global_request_id, is_transfer, transfer_url_chain, referrer, - page_transition, frame_id); + params.global_request_id, params.is_transfer, + params.transfer_url_chain, params.referrer, + params.page_transition, params.frame_id, + params.should_replace_current_entry); } } @@ -244,13 +272,14 @@ void CrossSiteResourceHandler::StartCrossSiteTransition( FROM_HERE, base::Bind( &OnCrossSiteResponseHelper, - info->GetRouteID(), - global_id, - should_transfer, - transfer_url_chain, - referrer, - info->GetPageTransition(), - frame_id)); + CrossSiteResponseParams(info->GetRouteID(), + global_id, + should_transfer, + transfer_url_chain, + referrer, + info->GetPageTransition(), + frame_id, + info->should_replace_current_entry()))); } void CrossSiteResourceHandler::ResumeIfDeferred() { |