test: use WebContents event to test beforeunload (#23699)
This commit is contained in:
parent
0dabd5e8c7
commit
08f288faf1
13 changed files with 97 additions and 134 deletions
|
@ -266,6 +266,9 @@ void BrowserWindow::OnCloseButtonClicked(bool* prevent_default) {
|
|||
// Already closed by renderer
|
||||
return;
|
||||
|
||||
// Required to make beforeunload handler work.
|
||||
api_web_contents_->NotifyUserActivation();
|
||||
|
||||
if (web_contents()->NeedToFireBeforeUnloadOrUnload())
|
||||
web_contents()->DispatchBeforeUnload(false /* auto_cancel */);
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue