fix: crash on window.close()
with webContents
on blur (#47953)
fix: crash on window.close with WebContentsView on blur 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
6a9ff4df34
commit
61ba91a254
2 changed files with 34 additions and 8 deletions
|
@ -167,6 +167,26 @@ describe('WebContentsView', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('does not crash when closed via window.close()', async () => {
|
||||
const bw = new BrowserWindow();
|
||||
const wcv = new WebContentsView();
|
||||
|
||||
await bw.loadURL('data:text/html,<h1>Main Window</h1>');
|
||||
bw.contentView.addChildView(wcv);
|
||||
|
||||
const dto = new Promise<boolean>((resolve) => {
|
||||
wcv.webContents.on('blur', () => {
|
||||
const devToolsOpen = wcv.webContents.isDevToolsOpened();
|
||||
resolve(devToolsOpen);
|
||||
});
|
||||
});
|
||||
|
||||
wcv.webContents.loadURL('data:text/html,<script>window.close()</script>');
|
||||
|
||||
const open = await dto;
|
||||
expect(open).to.be.false();
|
||||
});
|
||||
|
||||
it('can be fullscreened', async () => {
|
||||
const w = new BaseWindow();
|
||||
const v = new WebContentsView();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue