Commit e23b1925 authored by Pavel Yatsuk's avatar Pavel Yatsuk Committed by Chromium LUCI CQ

[Messages] Dismiss all messages when the tab gets closed

This CL addresses a crash in the scenario when the tab is closed while
the message is still displayed. In this scenario WebContents gets
destroyed before the message is dismissed by auto-dismiss timer. Along
with WebContents, SavePasswordMessageDelegate get destroyed. Its dtor
fails on the check that the message was dismissed.

This CL dismisses all messages on willCloseTab event from TabModel.

BUG=1161664
R=lazzzis@chromium.org,twellington@chromium.org

Change-Id: Id2b94dfe5d37f17f50ea60356a7edccc524d0778
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2610365Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Commit-Queue: Pavel Yatsuk <pavely@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840423}
parent d0d1cb92
......@@ -81,6 +81,14 @@ public class ChromeMessageQueueMediator implements MessageQueueDelegate {
mQueueController.dismissAllMessages();
}
}
@Override
public void willCloseTab(Tab tab, boolean animate) {
assert mTabModelSelector != null;
if (tab != mTabModelSelector.getCurrentTab()) return;
if (mQueueController != null) {
mQueueController.dismissAllMessages();
}
}
};
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment