fix: don't destroy BrowserView webContents when owning BrowserWindow hasn't been closed (#42371)

fix: don't destroy BrowserView webContents when owning BrowserWindow hasn't been closed (#42353)

* fix: moves bv webContents close to closed event

* chore: adds unit tests

* chore: test that bv webContents are destroyed when parent bw closed

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Anny Yang <anny@electronjs.org>
This commit is contained in:
trop[bot] 2024-06-05 12:00:30 +02:00 committed by GitHub
parent fb6b8e91db
commit 484cf26787
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 54 additions and 5 deletions

View file

@ -54,7 +54,7 @@ BrowserWindow.prototype._init = function (this: BWT) {
this._browserViews = [];
this.on('close', () => {
this.on('closed', () => {
this._browserViews.forEach(b => b.webContents?.close({ waitForBeforeUnload: true }));
});