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

Unified Diff: chrome/browser/ui/unload_controller.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/ui/unload_controller.cc
diff --git a/chrome/browser/ui/unload_controller.cc b/chrome/browser/ui/unload_controller.cc
index c838992ef6116f0cb6ab3a604c2539db2cbd0ee2..1ba4531be3beeca7bed63b3631c3da24a4bff953 100644
--- a/chrome/browser/ui/unload_controller.cc
+++ b/chrome/browser/ui/unload_controller.cc
@@ -327,8 +327,13 @@ void UnloadController::ProcessPendingTabs(bool skip_beforeunload) {
// we would like devtools to call its own beforeunload handlers first,
// and then call beforeunload handlers for |web_contents|.
// See DevToolsWindow::InterceptPageBeforeUnload for details.
- if (!DevToolsWindow::InterceptPageBeforeUnload(web_contents))
- web_contents->DispatchBeforeUnload();
+ if (!DevToolsWindow::InterceptPageBeforeUnload(web_contents)) {
+ if (web_contents->NeedToFireBeforeUnload()) {
+ web_contents->DispatchBeforeUnload();
+ } else {
+ ClearUnloadState(web_contents, true);
+ }
+ }
} else {
ClearUnloadState(web_contents, true);
}

Powered by Google App Engine
This is Rietveld 408576698