Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use appropriate site instance for cross-site nav's #15821

Merged
merged 19 commits into from Dec 5, 2018
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
cb2d31c
fix: use Chromium's determined new site instance as candidate when na…
ppontes Oct 17, 2018
7530af6
Revert "fix: use Chromium's determined new site instance as candidate…
ppontes Oct 18, 2018
6e03731
fix: delegate site instance creation back to content when sandboxed.
ppontes Oct 18, 2018
694e51b
fix: ensure site isolation is on
ppontes Oct 30, 2018
bd857e9
test: adapt ut for cross-site navigation
ppontes Oct 30, 2018
e799fe0
fix: register pending processes during a navigation.
ppontes Nov 7, 2018
9271a39
refactor: dont call loadURL for a window constructed from an existing…
ppontes Nov 7, 2018
5aae695
test: add sandboxed affinity UT's.
ppontes Nov 9, 2018
2225c0b
fix: check affinity before deciding if to force a new site instance.
ppontes Nov 9, 2018
6d02359
chore: adapt subsequent patch.
ppontes Nov 23, 2018
f85ad5c
refactor: constify logically const methods.
ppontes Nov 23, 2018
220b722
fix: do not reuse site instances when navigation redirects cross-site.
ppontes Nov 23, 2018
f4e3036
test: ensure localStorage accessible after x-site redirect.
ppontes Nov 26, 2018
c30f003
test: adapt localStorage acess denied UT for site isolation.
ppontes Nov 26, 2018
d8d16a5
fix: do not send render-view-deleted for speculative frames.
ppontes Nov 29, 2018
9829b19
chore: amend tests after rebase.
ppontes Nov 29, 2018
c56311f
test: add ut for webContents' render-view-deleted emission
ppontes Nov 30, 2018
14daf67
fix: introduce current-render-view-deleted for current RVH's deletions.
ppontes Nov 30, 2018
8b4e030
refactor: style and comments fixed.
ppontes Dec 1, 2018
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

fix: delegate site instance creation back to content when sandboxed.

  • Loading branch information...
ppontes committed Oct 18, 2018
commit 6e03731682124815667a1faaed0b352cfbaf9ed1
@@ -198,7 +198,11 @@ bool AtomBrowserClient::ShouldCreateNewSiteInstance(
return false;

int process_id = current_instance->GetProcess()->GetID();
if (!IsRendererSandboxed(process_id)) {
if (IsRendererSandboxed(process_id)) {
// Renderer is sandboxed, delegate the decision to the content layer for all
// origins.
return false;
} else {
if (!RendererUsesNativeWindowOpen(process_id)) {
// non-sandboxed renderers without native window.open should always create
// a new SiteInstance
@@ -1,4 +1,4 @@
From 4730f77f43c648f6168db58897b4569326a75627 Mon Sep 17 00:00:00 2001
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Wed, 14 Nov 2018 20:38:46 +0530
Subject: frame_host_manager.patch
@@ -7,10 +7,10 @@ Allows embedder to intercept site instances chosen by chromium
and respond with custom instance.

diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index 872e4609c94f..a59676004f24 100644
index 872e4609c94f1e052d623ae57c1279c72eb2c3f4..a59676004f2411631418bf12e2978623b9b27b53 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -1960,6 +1960,18 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
@@ -1960,6 +1960,17 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
bool was_server_redirect = request.navigation_handle() &&
request.navigation_handle()->WasServerRedirect();

@@ -23,13 +23,12 @@ index 872e4609c94f..a59676004f24 100644
+ scoped_refptr<SiteInstance> candidate_site_instance =
+ speculative_render_frame_host_
+ ? speculative_render_frame_host_->GetSiteInstance()
+ : content::SiteInstance::CreateForURL(browser_context,
+ request.common_params().url);
+ : nullptr;
+
if (frame_tree_node_->IsMainFrame()) {
// Renderer-initiated main frame navigations that may require a
// SiteInstance swap are sent to the browser via the OpenURL IPC and are
@@ -1979,6 +1991,19 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
@@ -1979,6 +1990,23 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
request.common_params().url));
no_renderer_swap_allowed |=
request.from_begin_navigation() && !can_renderer_initiate_transfer;
@@ -39,17 +38,21 @@ index 872e4609c94f..a59676004f24 100644
+ request.state() == NavigationRequest::FAILED) &&
+ !speculative_render_frame_host_;
+ // Gives user a chance to choose a custom site instance.
+ scoped_refptr<SiteInstance> override_candidate_instance = candidate_site_instance
+ ? candidate_site_instance
+ : content::SiteInstance::CreateForURL(browser_context,
+ request.common_params().url);
+ SiteInstance* client_custom_instance = nullptr;
+ GetContentClient()->browser()->OverrideSiteInstanceForNavigation(
+ render_frame_host_.get(), browser_context, request.common_params().url,
+ has_response_started, candidate_site_instance.get(),
+ has_response_started, override_candidate_instance.get(),
+ &client_custom_instance);
+ if (client_custom_instance)
+ return scoped_refptr<SiteInstance>(client_custom_instance);
} else {
// Subframe navigations will use the current renderer, unless specifically
// allowed to swap processes.
@@ -1990,18 +2015,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
@@ -1990,18 +2018,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
if (no_renderer_swap_allowed)
return scoped_refptr<SiteInstance>(current_site_instance);

@@ -70,7 +73,7 @@ index 872e4609c94f..a59676004f24 100644
request.state() == NavigationRequest::FAILED,
request.restore_type() != RestoreType::NONE, request.is_view_source(),
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index 3be31602689c..2c22cb1cfe0d 100644
index 3be31602689cb93b965729cc4e35cf6d23a8ec2f..2c22cb1cfe0dddc97c00e5f4ff89de6b18bc232f 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -196,6 +196,15 @@ class CONTENT_EXPORT ContentBrowserClient {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.