Chromium Code Reviews| Index: content/renderer/render_view_impl.cc |
| diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
| index e85257490bd2194fbdaea628150207a0205cba87..a937429e2fc489f7034710be5d6e451376117796 100644 |
| --- a/content/renderer/render_view_impl.cc |
| +++ b/content/renderer/render_view_impl.cc |
| @@ -2362,14 +2362,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 && |
| + IsNonLocalOrTopLevelNavigation(url, frame); |
| + } |
| + |
| + if (browser_handles_request) { |
| // Reset these counters as the RenderView could be reused for the next |
| // navigation. |
| page_id_ = -1; |
| @@ -5211,8 +5215,21 @@ WebKit::WebUserMediaClient* RenderViewImpl::userMediaClient() { |
| return media_stream_impl_; |
| } |
| +bool RenderViewImpl::IsNonLocalOrTopLevelNavigation( |
|
darin (slow to review)
2012/05/12 00:00:51
it seems like you are using "NonLocal" to mean !sa
Mihai Parparita -not on Chrome
2012/05/15 20:51:46
The problem is that data: URLs are allowed too, so
darin (slow to review)
2012/05/15 23:58:44
What about blob URLs or filesystem URLs? I think
Mihai Parparita -not on Chrome
2012/05/16 00:36:45
Both of those should be allowed (added them to the
|
| + const GURL& url, WebKit::WebFrame* frame) const { |
| + if (frame->parent() == NULL) |
| + return true; |
| + |
| + // data: URLs don't involve remote content either, thus are considered local. |
| + if (url.SchemeIs(chrome::kDataScheme)) |
| + return false; |
| + |
| + return url.GetOrigin() != GURL(frame->top()->document().url()).GetOrigin(); |
|
darin (slow to review)
2012/05/12 00:00:51
why do you check the origin of frame->top() as opp
Mihai Parparita -not on Chrome
2012/05/15 20:51:46
The frame hasn't navigated yet, so it's at about:b
darin (slow to review)
2012/05/15 23:58:44
But what if the top-most frame was created dynamic
Mihai Parparita -not on Chrome
2012/05/16 00:36:45
I've switched to using the document's security ori
|
| +} |
| + |
| 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; |