| 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);
|
| }
|
|
|