fix: beforeunload and unload firing in BrowserViews (#28382)

* fix: beforeunload and unload firing in BrowserViews

* Ensure UserGesture is sent for BV webContents

* spec: add tests

* refactor: clean up logic

* spec: fixup specs

* docs: document event behavior for BrowserViews
This commit is contained in:
Shelley Vohr 2021-04-07 07:16:10 +00:00 committed by GitHub
parent e454bded3c
commit 7d04f729d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 9 deletions

View file

@ -1120,7 +1120,8 @@ content::WebContents* WebContents::OpenURLFromTab(
void WebContents::BeforeUnloadFired(content::WebContents* tab,
bool proceed,
bool* proceed_to_fire_unload) {
if (type_ == Type::kBrowserWindow || type_ == Type::kOffScreen)
if (type_ == Type::kBrowserWindow || type_ == Type::kOffScreen ||
type_ == Type::kBrowserView)
*proceed_to_fire_unload = proceed;
else
*proceed_to_fire_unload = true;