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
This commit is contained in:
Anny Yang 2024-06-05 00:58:38 -07:00 committed by GitHub
parent 39c984e23a
commit 5fb117a7d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 54 additions and 5 deletions

View file

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