fix: potentially closed webContents in BrowserView (#42810)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
6a15e168ce
commit
dc065dfa5a
4 changed files with 107 additions and 21 deletions
|
@ -199,7 +199,9 @@ BrowserWindow.prototype.removeBrowserView = function (browserView: BrowserView)
|
|||
};
|
||||
|
||||
BrowserWindow.prototype.getBrowserView = function () {
|
||||
if (this._browserViews.length > 1) { throw new Error('This BrowserWindow has multiple BrowserViews, use getBrowserViews() instead'); }
|
||||
if (this._browserViews.length > 1) {
|
||||
throw new Error('This BrowserWindow has multiple BrowserViews - use getBrowserViews() instead');
|
||||
}
|
||||
return this._browserViews[0] ?? null;
|
||||
};
|
||||
|
||||
|
@ -208,7 +210,9 @@ BrowserWindow.prototype.getBrowserViews = function () {
|
|||
};
|
||||
|
||||
BrowserWindow.prototype.setTopBrowserView = function (browserView: BrowserView) {
|
||||
if (browserView.ownerWindow !== this) { throw new Error('Given BrowserView is not attached to the window'); }
|
||||
if (browserView.ownerWindow !== this) {
|
||||
throw new Error('Given BrowserView is not attached to the window');
|
||||
}
|
||||
const idx = this._browserViews.indexOf(browserView);
|
||||
if (idx >= 0) {
|
||||
this.contentView.addChildView(browserView.webContentsView);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue