Commit d9f2d67e authored by Dan Harrington's avatar Dan Harrington Committed by Commit Bot

Fix DCHECK on net error page

DCHECK(committed_error_page_info_->auto_reload_triggered) was failing.
This is possible because when assigning a new value to
committed_error_page_info_, the auto load timer can still be active.

R=jianli

Bug: 881208
Change-Id: I361df3e17bef122f143331107a76d04487b32fea
Reviewed-on: https://chromium-review.googlesource.com/c/1240872Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Reviewed-by: default avatarJian Li <jianli@chromium.org>
Commit-Queue: Dan H <harringtond@google.com>
Cr-Commit-Position: refs/heads/master@{#597183}
parent 2d1195b3
......@@ -585,8 +585,13 @@ void NetErrorHelperCore::OnStartLoad(FrameType frame_type, PageType page_type) {
// If there's no pending error page information associated with the page load,
// or the new page is not an error page, then reset pending error page state.
if (!pending_error_page_info_ || page_type != ERROR_PAGE)
if (!pending_error_page_info_ || page_type != ERROR_PAGE) {
CancelPendingFetches();
} else {
// Halt auto-reload if it's currently scheduled. OnFinishLoad will trigger
// auto-reload if appropriate.
PauseAutoReloadTimer();
}
}
void NetErrorHelperCore::OnCommitLoad(FrameType frame_type, const GURL& url) {
......
......@@ -2114,6 +2114,27 @@ TEST_F(NetErrorHelperCoreAutoReloadTest, StopsOnOtherLoadStart) {
EXPECT_EQ(0, core()->auto_reload_count());
}
// This is a regression test for http://crbug.com/881208.
TEST_F(NetErrorHelperCoreAutoReloadTest, StopsOnErrorLoadCommit) {
DoErrorLoad(net::ERR_CONNECTION_RESET);
EXPECT_TRUE(timer()->IsRunning());
// Simulate manually reloading the error page while the timer is still
// running.
std::string html;
core()->PrepareErrorPage(
NetErrorHelperCore::MAIN_FRAME,
NetErrorForURL(net::ERR_CONNECTION_RESET, GURL(kFailedUrl)),
false /* is_failed_post */, false /* is_ignoring_cache */, &html);
core()->OnStartLoad(NetErrorHelperCore::MAIN_FRAME,
NetErrorHelperCore::ERROR_PAGE);
EXPECT_FALSE(timer()->IsRunning());
core()->OnCommitLoad(NetErrorHelperCore::MAIN_FRAME, error_url());
core()->OnFinishLoad(NetErrorHelperCore::MAIN_FRAME);
EXPECT_TRUE(timer()->IsRunning());
}
TEST_F(NetErrorHelperCoreAutoReloadTest, ResetsCountOnSuccess) {
DoErrorLoad(net::ERR_CONNECTION_RESET);
base::TimeDelta delay = timer()->GetCurrentDelay();
......
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