test: fix "crashed event does not crash main process when destroying WebContents in it" (#40135)
This commit is contained in:
parent
f5c177698e
commit
24bc0ee5c7
1 changed files with 6 additions and 6 deletions
|
@ -2333,13 +2333,13 @@ describe('webContents module', () => {
|
||||||
describe('crashed event', () => {
|
describe('crashed event', () => {
|
||||||
afterEach(() => deprecate.setHandler(null));
|
afterEach(() => deprecate.setHandler(null));
|
||||||
|
|
||||||
it('does not crash main process when destroying WebContents in it', async () => {
|
it('does not crash main process when destroying WebContents in it', (done) => {
|
||||||
const contents = (webContents as typeof ElectronInternal.WebContents).create({ nodeIntegration: true });
|
const contents = (webContents as typeof ElectronInternal.WebContents).create({ nodeIntegration: true });
|
||||||
const crashEvent = once(contents, 'render-process-gone');
|
contents.once('crashed', () => {
|
||||||
await contents.loadURL('about:blank');
|
contents.destroy();
|
||||||
contents.forcefullyCrashRenderer();
|
done();
|
||||||
await crashEvent;
|
});
|
||||||
contents.destroy();
|
contents.loadURL('about:blank').then(() => contents.forcefullyCrashRenderer());
|
||||||
});
|
});
|
||||||
|
|
||||||
it('logs a warning', async () => {
|
it('logs a warning', async () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue