Index: content/renderer/render_view_impl.cc |
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
index 58cdf35d89b74a57b91cfe0ad80556ae4178ba2b..037051ccae222984b2e032fd313544598ce97746 100644 |
--- a/content/renderer/render_view_impl.cc |
+++ b/content/renderer/render_view_impl.cc |
@@ -2372,14 +2372,18 @@ WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( |
} |
} |
- // If the browser is interested, then give it a chance to look at top level |
- // navigations. |
+ // If the browser is interested, then give it a chance to look at the request. |
if (is_content_initiated) { |
- bool browser_handles_top_level_requests = |
+ bool browser_handles_request = |
renderer_preferences_.browser_handles_top_level_requests && |
IsNonLocalTopLevelNavigation(url, frame, type); |
- if (browser_handles_top_level_requests || |
- renderer_preferences_.browser_handles_all_requests) { |
+ if (!browser_handles_request) { |
+ browser_handles_request = renderer_preferences_. |
+ browser_handles_all_top_level_or_non_local_requests && |
+ IsRemoteOrTopLevelNavigation(url, frame); |
+ } |
+ |
+ if (browser_handles_request) { |
// Reset these counters as the RenderView could be reused for the next |
// navigation. |
page_id_ = -1; |
@@ -5304,8 +5308,23 @@ WebKit::WebUserMediaClient* RenderViewImpl::userMediaClient() { |
return media_stream_impl_; |
} |
+bool RenderViewImpl::IsRemoteOrTopLevelNavigation( |
abarth-chromium
2012/05/18 18:34:07
"remote" is sort of a funny term to use here. For
|
+ const GURL& url, WebKit::WebFrame* frame) const { |
+ if (frame->parent() == NULL) |
+ return true; |
+ |
+ // blob: and data: URLs don't involve remote content either, thus are |
+ // considered local. |
+ if (url.SchemeIs(chrome::kBlobScheme) || url.SchemeIs(chrome::kDataScheme)) |
abarth-chromium
2012/05/18 18:34:07
Presumably filesystem is in this category too.
|
+ return false; |
+ |
+ return url.GetOrigin() != |
+ GURL(frame->document().securityOrigin().toString().utf8()); |
+} |
+ |
bool RenderViewImpl::IsNonLocalTopLevelNavigation( |
- const GURL& url, WebKit::WebFrame* frame, WebKit::WebNavigationType type) { |
+ const GURL& url, WebKit::WebFrame* frame, WebKit::WebNavigationType type) |
+ const { |
// Must be a top level frame. |
if (frame->parent() != NULL) |
return false; |