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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 8496027: Enhance --enable-strict-site-isolation to prevent a site-isolated renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/public/common/content_switches.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1972 matching lines...) Expand 10 before | Expand all | Expand 10 after
1983 bool is_content_initiated = 1983 bool is_content_initiated =
1984 DocumentState::FromDataSource(frame->provisionalDataSource())-> 1984 DocumentState::FromDataSource(frame->provisionalDataSource())->
1985 navigation_state()->is_content_initiated(); 1985 navigation_state()->is_content_initiated();
1986 1986
1987 // Experimental: 1987 // Experimental:
1988 // If --enable-strict-site-isolation is enabled, send all top-level 1988 // If --enable-strict-site-isolation is enabled, send all top-level
1989 // navigations to the browser to let it swap processes when crossing site 1989 // navigations to the browser to let it swap processes when crossing site
1990 // boundaries. This is currently expected to break some script calls and 1990 // boundaries. This is currently expected to break some script calls and
1991 // navigations, such as form submissions. 1991 // navigations, such as form submissions.
1992 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 1992 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
1993 if (!frame->parent() && (is_content_initiated || is_redirect) && 1993 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) &&
1994 command_line.HasSwitch(switches::kEnableStrictSiteIsolation)) { 1994 !frame->parent() && (is_content_initiated || is_redirect)) {
1995 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); 1995 WebString origin_str = frame->document().securityOrigin().toString();
1996 OpenURL(frame, url, referrer, default_policy); 1996 GURL frame_url(origin_str.utf8().data());
1997 return WebKit::WebNavigationPolicyIgnore; 1997 // TODO(cevans): revisit whether this origin check is still necessary once
1998 // crbug.com/101395 is fixed.
1999 if (frame_url.GetOrigin() != url.GetOrigin()) {
2000 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer")));
2001 OpenURL(frame, url, referrer, default_policy);
2002 return WebKit::WebNavigationPolicyIgnore;
2003 }
1998 } 2004 }
1999 2005
2000 // If the browser is interested, then give it a chance to look at top level 2006 // If the browser is interested, then give it a chance to look at top level
2001 // navigations. 2007 // navigations.
2002 if (is_content_initiated && 2008 if (is_content_initiated &&
2003 renderer_preferences_.browser_handles_top_level_requests && 2009 renderer_preferences_.browser_handles_top_level_requests &&
2004 IsNonLocalTopLevelNavigation(url, frame, type)) { 2010 IsNonLocalTopLevelNavigation(url, frame, type)) {
2005 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); 2011 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer")));
2006 // Reset these counters as the RenderView could be reused for the next 2012 // Reset these counters as the RenderView could be reused for the next
2007 // navigation. 2013 // navigation.
(...skipping 2713 matching lines...) Expand 10 before | Expand all | Expand 10 after
4721 return !!RenderThreadImpl::current()->compositor_thread(); 4727 return !!RenderThreadImpl::current()->compositor_thread();
4722 } 4728 }
4723 4729
4724 void RenderViewImpl::OnJavaBridgeInit( 4730 void RenderViewImpl::OnJavaBridgeInit(
4725 const IPC::ChannelHandle& channel_handle) { 4731 const IPC::ChannelHandle& channel_handle) {
4726 DCHECK(!java_bridge_dispatcher_.get()); 4732 DCHECK(!java_bridge_dispatcher_.get());
4727 #if defined(ENABLE_JAVA_BRIDGE) 4733 #if defined(ENABLE_JAVA_BRIDGE)
4728 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); 4734 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle));
4729 #endif 4735 #endif
4730 } 4736 }
OLDNEW
« no previous file with comments | « content/public/common/content_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698