mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
fix: BrowserWindow add the same BrowserView (#48201)
fix: BrowserWindow add the same BrowserView (#48057) Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Zonglong Liu <83216456+mai-121@users.noreply.github.com>
This commit is contained in:
@@ -199,7 +199,14 @@ BrowserWindow.prototype.setBackgroundThrottling = function (allowed: boolean) {
|
||||
};
|
||||
|
||||
BrowserWindow.prototype.addBrowserView = function (browserView: BrowserView) {
|
||||
if (browserView.ownerWindow) { browserView.ownerWindow.removeBrowserView(browserView); }
|
||||
if (this._browserViews.includes(browserView)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const ownerWindow = browserView.ownerWindow;
|
||||
if (ownerWindow && ownerWindow !== this) {
|
||||
ownerWindow.removeBrowserView(browserView);
|
||||
}
|
||||
this.contentView.addChildView(browserView.webContentsView);
|
||||
browserView.ownerWindow = this;
|
||||
browserView.webContents._setOwnerWindow(this);
|
||||
|
||||
Reference in New Issue
Block a user