Commit 1ddd7b5e authored by Rakina Zata Amni's avatar Rakina Zata Amni Committed by Commit Bot

Change cross-origin isolated DCHECK, add history tests

The equality of the "cross origin isolated" value should not be checked
if it's still speculative, and some other cases covered by
IsSiteInstanceCompatibleWithCoopCoepCrossOriginIsolation.

Bug: 1107814, 1096135
Change-Id: I37152bbc348d598dc4612666bfc181da60e75555
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2385255
Commit-Queue: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Reviewed-by: default avatarArthur Hemery <ahemery@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804854}
parent 10992cbe
...@@ -1984,6 +1984,27 @@ IN_PROC_BROWSER_TEST_P(CrossOriginOpenerPolicyBrowserTest, ...@@ -1984,6 +1984,27 @@ IN_PROC_BROWSER_TEST_P(CrossOriginOpenerPolicyBrowserTest,
EXPECT_FALSE(current_si->IsRelatedSiteInstance(previous_si.get())); EXPECT_FALSE(current_si->IsRelatedSiteInstance(previous_si.get()));
} }
// Back navigation from a cross-origin isolated page to a non cross-origin
// isolated page.
{
EXPECT_TRUE(NavigateToURL(shell(), isolated_page));
scoped_refptr<SiteInstanceImpl> cross_origin_isolated_site_instance =
current_frame_host()->GetSiteInstance();
EXPECT_TRUE(
cross_origin_isolated_site_instance->IsCoopCoepCrossOriginIsolated());
web_contents()->GetController().GoBack();
EXPECT_TRUE(WaitForLoadStop(web_contents()));
scoped_refptr<SiteInstanceImpl> non_cross_origin_isolated_site_instance =
current_frame_host()->GetSiteInstance();
EXPECT_FALSE(non_cross_origin_isolated_site_instance
->IsCoopCoepCrossOriginIsolated());
EXPECT_FALSE(non_cross_origin_isolated_site_instance->IsRelatedSiteInstance(
cross_origin_isolated_site_instance.get()));
}
// Cross origin navigation in between two cross-origin isolated pages. // Cross origin navigation in between two cross-origin isolated pages.
{ {
EXPECT_TRUE(NavigateToURL(shell(), isolated_page)); EXPECT_TRUE(NavigateToURL(shell(), isolated_page));
......
...@@ -1562,8 +1562,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigation( ...@@ -1562,8 +1562,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigation(
ConvertToSiteInstance(new_instance_descriptor, candidate_instance); ConvertToSiteInstance(new_instance_descriptor, candidate_instance);
SiteInstanceImpl* new_instance_impl = SiteInstanceImpl* new_instance_impl =
static_cast<SiteInstanceImpl*>(new_instance.get()); static_cast<SiteInstanceImpl*>(new_instance.get());
DCHECK_EQ(is_coop_coep_cross_origin_isolated, DCHECK(IsSiteInstanceCompatibleWithCoopCoepCrossOriginIsolation(
new_instance_impl->IsCoopCoepCrossOriginIsolated()); new_instance_impl, frame_tree_node_->IsMainFrame(), dest_url,
is_coop_coep_cross_origin_isolated, is_speculative));
// If |should_swap| is true, we must use a different SiteInstance than the // If |should_swap| is true, we must use a different SiteInstance than the
// current one. If we didn't, we would have two RenderFrameHosts in the same // current one. If we didn't, we would have two RenderFrameHosts in the same
......
...@@ -6731,9 +6731,8 @@ class ProactivelySwapBrowsingInstancesSameSiteCoopTest ...@@ -6731,9 +6731,8 @@ class ProactivelySwapBrowsingInstancesSameSiteCoopTest
// COOP + COEP, should use new process). // COOP + COEP, should use new process).
// 2. Go back to A2 (should use new process). // 2. Go back to A2 (should use new process).
// 3. Go back to A1 (should reuse A2's process). // 3. Go back to A1 (should reuse A2's process).
// Note: This test is currently disabled due to crbug.com/1107814.
IN_PROC_BROWSER_TEST_P(ProactivelySwapBrowsingInstancesSameSiteCoopTest, IN_PROC_BROWSER_TEST_P(ProactivelySwapBrowsingInstancesSameSiteCoopTest,
DISABLED_HistoryNavigationReusesProcess_COOP) { HistoryNavigationReusesProcess_COOP) {
// This test expects a renderer process to eventually get deleted when we // This test expects a renderer process to eventually get deleted when we
// navigate away from the page using it, which won't happen if the page is // navigate away from the page using it, which won't happen if the page is
// kept alive in the back-forward cache. So, we should disable back-forward // kept alive in the back-forward cache. So, we should disable back-forward
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment