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

Unified Diff: chrome/browser/lifetime/browser_close_manager.cc

Issue 2783723002: Keep track in the browser of which frames have onunload and onbeforeunload handlers. (Closed)
Patch Set: fix content_browsertests with plznavigate and also remove now unnecessary unloadcontroller change Created 3 years, 9 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: chrome/browser/lifetime/browser_close_manager.cc
diff --git a/chrome/browser/lifetime/browser_close_manager.cc b/chrome/browser/lifetime/browser_close_manager.cc
index d8a943c1ab55a4172d9b0c66e9a8de2909183c1c..484a1f3bf0a4cc5dee0e90797e7bd4694e84b924 100644
--- a/chrome/browser/lifetime/browser_close_manager.cc
+++ b/chrome/browser/lifetime/browser_close_manager.cc
@@ -72,13 +72,16 @@ void BrowserCloseManager::TryToCloseBrowsers() {
// OnBrowserReportCloseable with the result. If the user confirms the close,
// this will trigger TryToCloseBrowsers to try again.
for (auto* browser : *BrowserList::GetInstance()) {
+ // Set current_browser_ here since if there are no unload handlers, it might
+ // get used synchronously inside TryToCloseWindow.
+ current_browser_ = browser;
if (browser->TryToCloseWindow(
false,
base::Bind(&BrowserCloseManager::OnBrowserReportCloseable, this))) {
- current_browser_ = browser;
return;
}
}
+ current_browser_ = NULL;
CheckForDownloadsInProgress();
}

Powered by Google App Engine
This is Rietveld 408576698