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

@ -375,6 +375,8 @@ win.webContents.on('will-prevent-unload', (event) => {
})
```
**Note:** This will be emitted for `BrowserViews` but will _not_ be respected - this is because we have chosen not to tie the `BrowserView` lifecycle to its owning BrowserWindow should one exist per the [specification](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event).
#### Event: 'crashed' _Deprecated_
Returns: