Commit ddf98dc4 authored by Carlos Caballero's avatar Carlos Caballero Committed by Commit Bot

Make sure RFH is not deleted when accessing it

Change-Id: I0be89fe1fb55a352faeb05989fad1346155a0338
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1890419Reviewed-by: default avatarArthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Carlos Caballero <carlscab@google.com>
Cr-Commit-Position: refs/heads/master@{#710907}
parent a1504187
...@@ -3523,9 +3523,11 @@ IN_PROC_BROWSER_TEST_F( ...@@ -3523,9 +3523,11 @@ IN_PROC_BROWSER_TEST_F(
EXPECT_TRUE(NavigateToURL(shell(), url_a)); EXPECT_TRUE(NavigateToURL(shell(), url_a));
WaitForFirstVisuallyNonEmptyPaint(shell()->web_contents()); WaitForFirstVisuallyNonEmptyPaint(shell()->web_contents());
RenderFrameHostImpl* rfh_a = current_frame_host(); RenderFrameHostImpl* rfh_a = current_frame_host();
RenderFrameDeletedObserver delete_observer_rfh_a(rfh_a);
// 2) Navigate to B. // 2) Navigate to B.
EXPECT_TRUE(NavigateToURL(shell(), url_b)); EXPECT_TRUE(NavigateToURL(shell(), url_b));
ASSERT_FALSE(delete_observer_rfh_a.deleted());
EXPECT_TRUE(rfh_a->is_in_back_forward_cache()); EXPECT_TRUE(rfh_a->is_in_back_forward_cache());
WaitForFirstVisuallyNonEmptyPaint(shell()->web_contents()); WaitForFirstVisuallyNonEmptyPaint(shell()->web_contents());
...@@ -3549,10 +3551,12 @@ IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTest, ...@@ -3549,10 +3551,12 @@ IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTest,
EXPECT_TRUE(NavigateToURL(shell(), url_a)); EXPECT_TRUE(NavigateToURL(shell(), url_a));
WaitForFirstVisuallyNonEmptyPaint(web_contents()); WaitForFirstVisuallyNonEmptyPaint(web_contents());
RenderFrameHostImpl* rfh_a = current_frame_host(); RenderFrameHostImpl* rfh_a = current_frame_host();
RenderFrameDeletedObserver delete_observer_rfh_a(rfh_a);
EXPECT_EQ(web_contents()->GetThemeColor(), 0xFFFF0000u); EXPECT_EQ(web_contents()->GetThemeColor(), 0xFFFF0000u);
EXPECT_TRUE(NavigateToURL(shell(), url_b)); EXPECT_TRUE(NavigateToURL(shell(), url_b));
WaitForFirstVisuallyNonEmptyPaint(web_contents()); WaitForFirstVisuallyNonEmptyPaint(web_contents());
ASSERT_FALSE(delete_observer_rfh_a.deleted());
EXPECT_TRUE(rfh_a->is_in_back_forward_cache()); EXPECT_TRUE(rfh_a->is_in_back_forward_cache());
EXPECT_EQ(web_contents()->GetThemeColor(), base::nullopt); EXPECT_EQ(web_contents()->GetThemeColor(), base::nullopt);
......
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