chore: remove deprecated crashed and renderer-process-crashed events (#40115)

This commit is contained in:
Milan Burda 2023-10-18 12:05:41 +02:00 committed by GitHub
commit 657e88b173
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 36 additions and 93 deletions

View file

@ -6,7 +6,6 @@ import * as http from 'node:http';
import { BrowserWindow, ipcMain, webContents, session, app, BrowserView, WebContents } from 'electron/main';
import { closeAllWindows } from './lib/window-helpers';
import { ifdescribe, defer, waitUntil, listen, ifit } from './lib/spec-helpers';
import { expectDeprecationMessages } from './lib/deprecate-helpers';
import { once } from 'node:events';
import { setTimeout } from 'node:timers/promises';
@ -2344,30 +2343,6 @@ describe('webContents module', () => {
});
});
describe('crashed event', () => {
it('does not crash main process when destroying WebContents in it', (done) => {
const contents = (webContents as typeof ElectronInternal.WebContents).create({ nodeIntegration: true });
contents.once('crashed', () => {
contents.destroy();
done();
});
contents.loadURL('about:blank').then(() => contents.forcefullyCrashRenderer());
});
it('logs a warning', async () => {
const contents = (webContents as typeof ElectronInternal.WebContents).create({ nodeIntegration: true });
await contents.loadURL('about:blank');
expectDeprecationMessages(async () => {
const crashEvent = once(contents, 'crashed');
contents.forcefullyCrashRenderer();
const [, killed] = await crashEvent;
expect(killed).to.be.a('boolean');
}, '\'crashed event\' is deprecated and will be removed. Please use \'render-process-gone event\' instead.');
});
});
describe('context-menu event', () => {
afterEach(closeAllWindows);
it('emits when right-clicked in page', async () => {