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

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 tests 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..664225e3bf838c1a1e657f6b852e9ba42243d147 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;
+ base::Bind(&BrowserCloseManager::OnBrowserReportCloseable, this))) {
return;
}
}
+ current_browser_ = NULL;
CheckForDownloadsInProgress();
}
« no previous file with comments | « no previous file | chrome/browser/ui/fast_unload_controller.cc » ('j') | content/browser/frame_host/render_frame_host_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698