Commit a9a27f6e authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Align IsWaitingForResponse with NavigationRequest

This effectively aligns the tab-icon animation with page commits as the
navigation request only exists while the tab is navigating. This code is
also easier to understand since we don't need to keep track of when a
first response could have been received (and which navigation the
response is related to).

Bug: chromium:903817
Change-Id: I3629792f1a122a2445edc9a2cab02e38b0eeca7b
Reviewed-on: https://chromium-review.googlesource.com/c/1341992Reviewed-by: default avatarCamille Lamy <clamy@chromium.org>
Reviewed-by: default avatarArthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610023}
parent eb8f8994
......@@ -270,14 +270,12 @@ IN_PROC_BROWSER_TEST_F(BrowserViewTest, TitleAndLoadState) {
contents, 1, content::MessageLoopRunner::QuitMode::DEFERRED);
TabStrip* tab_strip = browser_view()->tabstrip();
// Navigate without blocking.
ui_test_utils::NavigateToURLWithDispositionBlockUntilNavigationsComplete(
browser(),
ui_test_utils::GetTestUrl(
base::FilePath(base::FilePath::kCurrentDirectory),
base::FilePath(FILE_PATH_LITERAL("title2.html"))),
0, WindowOpenDisposition::CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE);
const GURL test_url = ui_test_utils::GetTestUrl(
base::FilePath(base::FilePath::kCurrentDirectory),
base::FilePath(FILE_PATH_LITERAL("title2.html")));
contents->GetController().LoadURL(test_url, content::Referrer(),
ui::PAGE_TRANSITION_LINK, std::string());
EXPECT_TRUE(browser()->tab_strip_model()->TabsAreLoading());
EXPECT_EQ(TabNetworkState::kWaiting,
tab_strip->tab_at(0)->data().network_state);
......
......@@ -1391,7 +1391,11 @@ bool WebContentsImpl::IsLoadingToDifferentDocument() const {
}
bool WebContentsImpl::IsWaitingForResponse() const {
return waiting_for_response_ && is_load_to_different_document_;
NavigationRequest* ongoing_navigation_request =
frame_tree_.root()->navigation_request();
// An ongoing navigation request means we're waiting for a response.
return ongoing_navigation_request != nullptr;
}
const net::LoadStateWithParam& WebContentsImpl::GetLoadState() const {
......
......@@ -1482,6 +1482,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
// Indicates whether the current load is to a different document. Only valid
// if |is_loading_| is true and only tracks loads in the main frame.
// TODO(pbos): Check navigation requests and handles instead of caching this.
bool is_load_to_different_document_;
// Indicates if the tab is considered crashed.
......
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