fix: handle closing webContents
in BrowserView
s (#37420)
* fix: handle closing webContents in BrowserViews * test: add window.close() test
This commit is contained in:
parent
8fb0f43030
commit
5e25d23794
4 changed files with 28 additions and 5 deletions
|
@ -345,6 +345,24 @@ describe('BrowserView module', () => {
|
|||
const [code] = await once(rc.process, 'exit');
|
||||
expect(code).to.equal(0);
|
||||
});
|
||||
|
||||
it('emits the destroyed event when webContents.close() is called', async () => {
|
||||
view = new BrowserView();
|
||||
w.setBrowserView(view);
|
||||
await view.webContents.loadFile(path.join(fixtures, 'pages', 'a.html'));
|
||||
|
||||
view.webContents.close();
|
||||
await once(view.webContents, 'destroyed');
|
||||
});
|
||||
|
||||
it('emits the destroyed event when window.close() is called', async () => {
|
||||
view = new BrowserView();
|
||||
w.setBrowserView(view);
|
||||
await view.webContents.loadFile(path.join(fixtures, 'pages', 'a.html'));
|
||||
|
||||
view.webContents.executeJavaScript('window.close()');
|
||||
await once(view.webContents, 'destroyed');
|
||||
});
|
||||
});
|
||||
|
||||
describe('window.open()', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue