Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(867)

Unified Diff: content/browser/browser_side_navigation_browsertest.cc

Issue 2386983002: PlzNavigate: cancel any navigations if DispatchBeforeUnload is called (other than for starting a ... (Closed)
Patch Set: guard against NavigatorImpl::RequestNavigation resetting the navigation, and add reduced test case Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/browser_side_navigation_browsertest.cc
diff --git a/content/browser/browser_side_navigation_browsertest.cc b/content/browser/browser_side_navigation_browsertest.cc
index b6d27f09f82400ba04e8df88c43b13216d84d579..0a5d1f354b44fcf72fbc997ede7bfa7409d8861c 100644
--- a/content/browser/browser_side_navigation_browsertest.cc
+++ b/content/browser/browser_side_navigation_browsertest.cc
@@ -9,6 +9,7 @@
#include "base/strings/utf_string_conversions.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/site_isolation_policy.h"
+#include "content/public/browser/notification_types.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
@@ -271,4 +272,16 @@ IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest,
->IsViewSourceMode());
}
+// Ensure that closing a page by running its beforeunload handler doesn't hang
+// if there's an ongoing navigation.
+IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest,
+ UnloadDuringNavigation) {
+ content::WindowedNotificationObserver close_observer(
+ content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
+ content::Source<content::WebContents>(shell()->web_contents()));
+ shell()->LoadURL(GURL("chrome://resources/css/tabs.css"));
+ shell()->web_contents()->DispatchBeforeUnload();
+ close_observer.Wait();
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698