mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
fix: handle BrowserView reparenting (#27000)
This commit is contained in:
@@ -158,6 +158,27 @@ describe('BrowserView module', () => {
|
||||
w.addBrowserView(view1);
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('can handle BrowserView reparenting', async () => {
|
||||
view = new BrowserView();
|
||||
|
||||
w.addBrowserView(view);
|
||||
view.webContents.loadURL('about:blank');
|
||||
await emittedOnce(view.webContents, 'did-finish-load');
|
||||
|
||||
const w2 = new BrowserWindow({ show: false });
|
||||
w2.addBrowserView(view);
|
||||
|
||||
w.close();
|
||||
|
||||
view.webContents.loadURL(`file://${fixtures}/pages/blank.html`);
|
||||
await emittedOnce(view.webContents, 'did-finish-load');
|
||||
|
||||
// Clean up - the afterEach hook assumes the webContents on w is still alive.
|
||||
w = new BrowserWindow({ show: false });
|
||||
w2.close();
|
||||
w2.destroy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('BrowserWindow.removeBrowserView()', () => {
|
||||
|
||||
Reference in New Issue
Block a user