OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 2003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2014 bool is_content_initiated = | 2014 bool is_content_initiated = |
2015 NavigationState::FromDataSource(frame->provisionalDataSource())-> | 2015 NavigationState::FromDataSource(frame->provisionalDataSource())-> |
2016 is_content_initiated(); | 2016 is_content_initiated(); |
2017 | 2017 |
2018 // Experimental: | 2018 // Experimental: |
2019 // If --enable-strict-site-isolation is enabled, send all top-level | 2019 // If --enable-strict-site-isolation is enabled, send all top-level |
2020 // navigations to the browser to let it swap processes when crossing site | 2020 // navigations to the browser to let it swap processes when crossing site |
2021 // boundaries. This is currently expected to break some script calls and | 2021 // boundaries. This is currently expected to break some script calls and |
2022 // navigations, such as form submissions. | 2022 // navigations, such as form submissions. |
2023 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 2023 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
2024 if (!frame->parent() && (is_content_initiated || is_redirect) && | 2024 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) && |
2025 command_line.HasSwitch(switches::kEnableStrictSiteIsolation)) { | 2025 !frame->parent() && (is_content_initiated || is_redirect)) { |
2026 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2026 WebString origin_str = frame->document().securityOrigin().toString(); |
2027 OpenURL(frame, url, referrer, default_policy); | 2027 GURL frame_url(origin_str.utf8().data()); |
2028 return WebKit::WebNavigationPolicyIgnore; | 2028 // TODO(cevans): revisit whether this workaround is still necessary once |
Charlie Reis
2011/11/22 19:06:59
nit: workaround -> origin check
| |
2029 // crbug.com/101395 is fixed. | |
2030 if (frame_url.GetOrigin() != url.GetOrigin()) { | |
2031 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); | |
2032 OpenURL(frame, url, referrer, default_policy); | |
2033 return WebKit::WebNavigationPolicyIgnore; | |
2034 } | |
2029 } | 2035 } |
2030 | 2036 |
2031 // If the browser is interested, then give it a chance to look at top level | 2037 // If the browser is interested, then give it a chance to look at top level |
2032 // navigations. | 2038 // navigations. |
2033 if (is_content_initiated && | 2039 if (is_content_initiated && |
2034 renderer_preferences_.browser_handles_top_level_requests && | 2040 renderer_preferences_.browser_handles_top_level_requests && |
2035 IsNonLocalTopLevelNavigation(url, frame, type)) { | 2041 IsNonLocalTopLevelNavigation(url, frame, type)) { |
2036 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2042 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); |
2037 // Reset these counters as the RenderView could be reused for the next | 2043 // Reset these counters as the RenderView could be reused for the next |
2038 // navigation. | 2044 // navigation. |
(...skipping 2665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4704 return webview()->settings()->useThreadedCompositor(); | 4710 return webview()->settings()->useThreadedCompositor(); |
4705 } | 4711 } |
4706 | 4712 |
4707 void RenderViewImpl::OnJavaBridgeInit( | 4713 void RenderViewImpl::OnJavaBridgeInit( |
4708 const IPC::ChannelHandle& channel_handle) { | 4714 const IPC::ChannelHandle& channel_handle) { |
4709 DCHECK(!java_bridge_dispatcher_.get()); | 4715 DCHECK(!java_bridge_dispatcher_.get()); |
4710 #if defined(ENABLE_JAVA_BRIDGE) | 4716 #if defined(ENABLE_JAVA_BRIDGE) |
4711 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); | 4717 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); |
4712 #endif | 4718 #endif |
4713 } | 4719 } |
OLD | NEW |