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: fix "crashed event does not crash main process when destroying WebContents in it" #40135

Merged
merged 1 commit into from
Oct 9, 2023
Merged
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
12 changes: 6 additions & 6 deletions spec/api-web-contents-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2258,9 +2258,9 @@
server.close();
proxyServer.close();
});

Check failure on line 2261 in spec/api-web-contents-spec.ts

View check run for this annotation

trop / Backportable? - 25-x-y

spec/api-web-contents-spec.ts#L2261

Patch Conflict
Raw output
++<<<<<<< HEAD
 +    it('does not crash main process when destroying WebContents in it', async () => {
++=======
+     afterEach(() => deprecate.setHandler(null));
+ 
+     it('does not crash main process when destroying WebContents in it', (done) => {
++>>>>>>> fix: crashed event does not crash main process when destroying WebContents in it
it('is emitted when navigating', async () => {
const [user, pass] = ['user', 'pass'];

Check failure on line 2263 in spec/api-web-contents-spec.ts

View check run for this annotation

trop / Backportable? - 26-x-y

spec/api-web-contents-spec.ts#L2263

Patch Conflict
Raw output
++<<<<<<< HEAD
 +    it('does not crash main process when destroying WebContents in it', async () => {
++=======
+     afterEach(() => deprecate.setHandler(null));
+ 
+     it('does not crash main process when destroying WebContents in it', (done) => {
++>>>>>>> fix: crashed event does not crash main process when destroying WebContents in it
const w = new BrowserWindow({ show: false });
let eventRequest: any;
let eventAuthInfo: any;
Expand All @@ -2270,7 +2270,7 @@
event.preventDefault();
cb(user, pass);
});
await w.loadURL(serverUrl);

Check failure on line 2273 in spec/api-web-contents-spec.ts

View check run for this annotation

trop / Backportable? - 27-x-y

spec/api-web-contents-spec.ts#L2273

Patch Conflict
Raw output
++<<<<<<< HEAD
 +    it('does not crash main process when destroying WebContents in it', async () => {
++=======
+     afterEach(() => deprecate.setHandler(null));
+ 
+     it('does not crash main process when destroying WebContents in it', (done) => {
++>>>>>>> fix: crashed event does not crash main process when destroying WebContents in it
const body = await w.webContents.executeJavaScript('document.documentElement.textContent');
expect(body).to.equal(`Basic ${Buffer.from(`${user}:${pass}`).toString('base64')}`);
expect(eventRequest.url).to.equal(serverUrl + '/');
Expand Down Expand Up @@ -2333,13 +2333,13 @@
describe('crashed event', () => {
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 crashEvent = once(contents, 'render-process-gone');
await contents.loadURL('about:blank');
contents.forcefullyCrashRenderer();
await crashEvent;
contents.destroy();
contents.once('crashed', () => {
contents.destroy();
done();
});
contents.loadURL('about:blank').then(() => contents.forcefullyCrashRenderer());
});

it('logs a warning', async () => {
Expand Down