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

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: Add TODO 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..da671971bedbf51db408309c87c82800df036f68 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -2243,12 +2243,28 @@ 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.
+ // TODO(creis): Ensure this supports targeted form submissions when
+ // fixing http://crbug.com/101395.
+ if (frame->parent() == NULL) {
+ OpenURL(frame, request.url(), referrer, default_policy);
+ 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 +2294,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 +2307,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 +2360,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