chrome: Fix unintended show of minimized window on navigation (fixes #3618)

This commit is contained in:
Nik Pavlov 2023-12-18 18:26:31 +00:00 committed by Marshall Greenblatt
parent 7a4b55f970
commit 2201028eaf
2 changed files with 12 additions and 13 deletions

View File

@ -376,6 +376,7 @@ void CefFrameHostImpl::LoadURLWithExtras(const std::string& url,
gurl, referrer, WindowOpenDisposition::CURRENT_TAB, transition, gurl, referrer, WindowOpenDisposition::CURRENT_TAB, transition,
/*is_renderer_initiated=*/false); /*is_renderer_initiated=*/false);
params.extra_headers = extra_headers; params.extra_headers = extra_headers;
params.user_gesture = false;
browser->LoadMainFrameURL(params); browser->LoadMainFrameURL(params);
} }

View File

@ -1713,6 +1713,10 @@ const char kLoadNavCrossOrigin2[] = "https://tests-conav2.com/nav2.html";
const char kLoadNavMsg[] = "NavigationTest.LoadNav"; const char kLoadNavMsg[] = "NavigationTest.LoadNav";
const char kLoadNavTestCmdKey[] = "nav-load-test"; const char kLoadNavTestCmdKey[] = "nav-load-test";
bool IsInitialUrl(const CefString& url) {
return url == kLoadNav1;
}
// Renderer side. // Renderer side.
class LoadNavRendererTest : public ClientAppRenderer::Delegate, class LoadNavRendererTest : public ClientAppRenderer::Delegate,
public CefLoadHandler { public CefLoadHandler {
@ -1853,8 +1857,7 @@ class LoadNavTestHandler : public TestHandler {
return; return;
} }
std::string url = browser->GetMainFrame()->GetURL(); if (IsInitialUrl(browser->GetMainFrame()->GetURL())) {
if (url == kLoadNav1) {
// Verify the behavior of the previous load. // Verify the behavior of the previous load.
EXPECT_TRUE(got_before_browse_); EXPECT_TRUE(got_before_browse_);
EXPECT_TRUE(got_before_resource_load_); EXPECT_TRUE(got_before_resource_load_);
@ -1927,23 +1930,18 @@ class LoadNavTestHandler : public TestHandler {
bool user_gesture, bool user_gesture,
bool is_redirect) override { bool is_redirect) override {
EXPECT_EQ(RT_MAIN_FRAME, request->GetResourceType()); EXPECT_EQ(RT_MAIN_FRAME, request->GetResourceType());
if (mode_ == LOAD || request->GetURL() == kLoadNav1) { if (mode_ == LOAD || IsInitialUrl(request->GetURL())) {
EXPECT_EQ(kTransitionExplicitLoad, request->GetTransitionType()); EXPECT_EQ(kTransitionExplicitLoad, request->GetTransitionType());
if (IsChromeRuntimeEnabled()) { if (IsChromeRuntimeEnabled()) {
// With the Chrome runtime this is true on initial navigation via // With the Chrome runtime this is true on initial navigation via
// chrome::AddTabAt() and also true for clicked links. // chrome::AddTabAt()
EXPECT_TRUE(user_gesture); EXPECT_EQ(user_gesture, IsInitialUrl(request->GetURL()));
} else { } else {
EXPECT_FALSE(user_gesture); EXPECT_FALSE(user_gesture);
} }
} else { } else {
EXPECT_EQ(ExpectedOpenURLTransitionType(), request->GetTransitionType()); EXPECT_EQ(ExpectedOpenURLTransitionType(), request->GetTransitionType());
EXPECT_EQ(user_gesture, mode_ == LEFT_CLICK);
if (mode_ == LEFT_CLICK || IsChromeRuntimeEnabled()) {
EXPECT_TRUE(user_gesture);
} else {
EXPECT_FALSE(user_gesture);
}
} }
EXPECT_GT(browser_id_current_, 0); EXPECT_GT(browser_id_current_, 0);
@ -2011,7 +2009,7 @@ class LoadNavTestHandler : public TestHandler {
EXPECT_EQ(RT_MAIN_FRAME, request->GetResourceType()); EXPECT_EQ(RT_MAIN_FRAME, request->GetResourceType());
const auto transition_type = request->GetTransitionType(); const auto transition_type = request->GetTransitionType();
if (mode_ == LOAD || request->GetURL() == kLoadNav1) { if (mode_ == LOAD || IsInitialUrl(request->GetURL())) {
EXPECT_EQ(kTransitionExplicitLoad, transition_type); EXPECT_EQ(kTransitionExplicitLoad, transition_type);
} else { } else {
EXPECT_EQ(ExpectedOpenURLTransitionType(), transition_type); EXPECT_EQ(ExpectedOpenURLTransitionType(), transition_type);
@ -2031,7 +2029,7 @@ class LoadNavTestHandler : public TestHandler {
EXPECT_GT(browser_id_current_, 0); EXPECT_GT(browser_id_current_, 0);
EXPECT_EQ(browser_id_current_, browser->GetIdentifier()); EXPECT_EQ(browser_id_current_, browser->GetIdentifier());
if (mode_ == LOAD || frame->GetURL() == kLoadNav1) { if (mode_ == LOAD || IsInitialUrl(frame->GetURL())) {
EXPECT_EQ(kTransitionExplicitLoad, transition_type); EXPECT_EQ(kTransitionExplicitLoad, transition_type);
} else { } else {
EXPECT_EQ(ExpectedOpenURLTransitionType(), transition_type); EXPECT_EQ(ExpectedOpenURLTransitionType(), transition_type);