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

Unified Diff: content/renderer/render_view_impl.cc

Issue 9706047: Allow targeted links to work on tabs that have swapped out processes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to get 118664 fix. Created 8 years, 9 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
« no previous file with comments | « content/common/swapped_out_messages.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 7cc0a21e7f5bb33127a0c42565d3e81f4a2b1e63..55f04fd46b79fe0433126081bc4e56667525507c 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -2243,12 +2243,26 @@ void RenderViewImpl::loadURLExternally(
WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation(
WebFrame* frame, const WebURLRequest& request, WebNavigationType type,
const WebNode&, WebNavigationPolicy default_policy, bool is_redirect) {
- // TODO(creis): Remove this when we fix OnSwapOut to not need a navigation.
+ Referrer referrer(
+ GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))),
+ GetReferrerPolicyFromRequest(request));
+
if (is_swapped_out_) {
- // It is possible for in-progress navigations to arrive here just after we
- // are swapped out, including iframes. We should cancel them.
- if (request.url() != GURL(chrome::kSwappedOutURL))
+ if (request.url() != GURL(chrome::kSwappedOutURL)) {
+ // Targeted links may try to navigate a swapped out frame. Allow the
+ // browser process to navigate the tab instead. Note that it is also
+ // possible for non-targeted navigations (from this view) to arrive
+ // here just after we are swapped out. It's ok to send them to the
+ // browser, as long as they're for the top level frame.
+ if (frame->parent() == NULL) {
+ OpenURL(frame, request.url(), referrer, default_policy);
darin (slow to review) 2012/03/22 17:23:39 so if this is a POST request, then it will become
Charlie Reis 2012/03/22 18:04:06 That's a fair point. It seems better to convert t
+ return WebKit::WebNavigationPolicyIgnore; // Suppress the load here.
+ }
+
+ // We should otherwise ignore in-process iframe navigations, if they
+ // arrive just after we are swapped out.
return WebKit::WebNavigationPolicyIgnore;
+ }
// Allow chrome::kSwappedOutURL to complete.
return default_policy;
@@ -2278,9 +2292,6 @@ WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation(
// TODO(cevans): revisit whether this origin check is still necessary once
// crbug.com/101395 is fixed.
if (frame_url.GetOrigin() != url.GetOrigin()) {
- Referrer referrer(
- GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))),
- GetReferrerPolicyFromRequest(request));
OpenURL(frame, url, referrer, default_policy);
return WebKit::WebNavigationPolicyIgnore;
}
@@ -2294,9 +2305,6 @@ WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation(
IsNonLocalTopLevelNavigation(url, frame, type);
if (browser_handles_top_level_requests ||
renderer_preferences_.browser_handles_all_requests) {
- Referrer referrer(
- GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))),
- GetReferrerPolicyFromRequest(request));
// Reset these counters as the RenderView could be reused for the next
// navigation.
page_id_ = -1;
@@ -2350,9 +2358,6 @@ WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation(
}
if (should_fork) {
- Referrer referrer(
- GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))),
- GetReferrerPolicyFromRequest(request));
OpenURL(
frame, url, send_referrer ? referrer : Referrer(), default_policy);
return WebKit::WebNavigationPolicyIgnore; // Suppress the load here.
« no previous file with comments | « content/common/swapped_out_messages.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698