Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: renderer crash on setImmediate (#26424)
* fix: renderer crash on setImmediate * spec: add a crash case * fix: ensure env exists * Update spec-main/fixtures/crash-cases/setimmediate-renderer-crash/index.js Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Jeremy Rose <jeremya@chromium.org>
- Loading branch information
1 parent
79dff5f
commit 07318e5
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
spec-main/fixtures/crash-cases/setimmediate-renderer-crash/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { app, BrowserWindow } = require('electron'); | ||
const path = require('path'); | ||
|
||
app.whenReady().then(() => { | ||
const win = new BrowserWindow({ | ||
show: false, | ||
webPreferences: { | ||
nodeIntegration: true, | ||
preload: path.resolve(__dirname, 'preload.js') | ||
} | ||
}); | ||
|
||
win.loadURL('about:blank'); | ||
|
||
win.webContents.on('render-process-gone', () => { | ||
process.exit(1); | ||
}); | ||
|
||
win.webContents.on('did-finish-load', () => { | ||
setTimeout(() => app.quit()); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
spec-main/fixtures/crash-cases/setimmediate-renderer-crash/preload.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
setImmediate(() => { | ||
throw new Error('oh no'); | ||
}); |