Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: use render-process-gone event in tests #37302

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions spec/api-web-contents-spec.ts
Expand Up @@ -2226,8 +2226,8 @@ describe('webContents module', () => {

describe('crashed event', () => {
it('does not crash main process when destroying WebContents in it', (done) => {
const contents = (webContents as any).create({ nodeIntegration: true });
contents.once('crashed', () => {
const contents = (webContents as typeof ElectronInternal.WebContents).create({ nodeIntegration: true });
contents.once('render-process-gone', () => {
contents.destroy();
done();
});
Expand Down
16 changes: 8 additions & 8 deletions spec/chromium-spec.ts
Expand Up @@ -518,7 +518,7 @@ describe('chromium features', () => {
it('does not crash', (done) => {
const w = new BrowserWindow({ show: false });
w.webContents.once('did-finish-load', () => { done(); });
w.webContents.once('crashed', () => done(new Error('WebContents crashed.')));
w.webContents.once('render-process-gone', () => done(new Error('WebContents crashed.')));
w.loadFile(path.join(fixturesPath, 'pages', 'external-string.html'));
});
});
Expand Down Expand Up @@ -558,7 +558,7 @@ describe('chromium features', () => {
it('does not crash', (done) => {
const w = new BrowserWindow({ show: false });
w.webContents.once('did-finish-load', () => { done(); });
w.webContents.once('crashed', () => done(new Error('WebContents crashed.')));
w.webContents.once('render-process-gone', () => done(new Error('WebContents crashed.')));
w.loadFile(path.join(__dirname, 'fixtures', 'pages', 'jquery.html'));
});
});
Expand Down Expand Up @@ -596,7 +596,7 @@ describe('chromium features', () => {
}).then(() => done());
}
});
w.webContents.on('crashed', () => done(new Error('WebContents crashed.')));
w.webContents.on('render-process-gone', () => done(new Error('WebContents crashed.')));
w.loadFile(path.join(fixturesPath, 'pages', 'service-worker', 'index.html'));
});

Expand Down Expand Up @@ -637,7 +637,7 @@ describe('chromium features', () => {
});
}
});
w.webContents.on('crashed', () => done(new Error('WebContents crashed.')));
w.webContents.on('render-process-gone', () => done(new Error('WebContents crashed.')));
w.loadFile(path.join(fixturesPath, 'pages', 'service-worker', 'index.html'));
});

Expand Down Expand Up @@ -673,7 +673,7 @@ describe('chromium features', () => {
});
}
});
w.webContents.on('crashed', () => done(new Error('WebContents crashed.')));
w.webContents.on('render-process-gone', () => done(new Error('WebContents crashed.')));
w.loadFile(path.join(fixturesPath, 'pages', 'service-worker', 'custom-scheme-index.html'));
});

Expand Down Expand Up @@ -1559,7 +1559,7 @@ describe('chromium features', () => {
...extraPreferences
});
let redirected = false;
w.webContents.on('crashed', () => {
w.webContents.on('render-process-gone', () => {
expect.fail('renderer crashed / was killed');
});
w.webContents.on('did-redirect-navigation', (event, url) => {
Expand Down Expand Up @@ -2730,7 +2730,7 @@ ifdescribe((process.platform !== 'linux' || app.isUnityRunning()))('navigator.se
}).then(() => done());
}
});
w.webContents.on('crashed', () => done(new Error('WebContents crashed.')));
w.webContents.on('render-process-gone', () => done(new Error('WebContents crashed.')));
w.loadFile(path.join(fixturesPath, 'pages', 'service-worker', 'badge-index.html'), { search: '?setBadge' });
});

Expand All @@ -2751,7 +2751,7 @@ ifdescribe((process.platform !== 'linux' || app.isUnityRunning()))('navigator.se
}).then(() => done());
}
});
w.webContents.on('crashed', () => done(new Error('WebContents crashed.')));
w.webContents.on('render-process-gone', () => done(new Error('WebContents crashed.')));
w.loadFile(path.join(fixturesPath, 'pages', 'service-worker', 'badge-index.html'), { search: '?clearBadge' });
});
});
Expand Down
4 changes: 2 additions & 2 deletions spec/fixtures/no-proprietary-codecs.js
Expand Up @@ -21,8 +21,8 @@ app.whenReady().then(() => {
}
});

window.webContents.on('crashed', (event, killed) => {
console.log(`WebContents crashed (killed=${killed})`);
window.webContents.on('render-process-gone', (event, details) => {
console.log(`WebContents crashed ${JSON.stringify(details)}`);
app.exit(1);
});

Expand Down