Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prevent crash on web-contents creation when error is thrown (#29106
) * fix: prevent crash when error occurs during event emitter CallMethod * wip: emit error event within trycatch * fix: handle uncaught exceptions within node on web_contents init * fix: create gin_helper::CallMethodCatchException * test: add web-contents create crash to test cases * test: clean up test data for web-contents crash Co-authored-by: Jeremy Rose <jeremya@chromium.org> * fix: convert CatchException to WebContents static helper method * fix: restore try_catch to callsite Co-authored-by: VerteDinde <keeleymhammond@gmail.com> Co-authored-by: VerteDinde <khammond@slack-corp.com> Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> Co-authored-by: Jeremy Rose <jeremya@chromium.org>
- Loading branch information
1 parent
9a4a049
commit caac2e8
Showing
3 changed files
with
27 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
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
14 changes: 14 additions & 0 deletions
14
spec-main/fixtures/crash-cases/webview-contents-error-on-creation/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,14 @@ | ||
const { app, BrowserWindow } = require('electron'); | ||
|
||
app.whenReady().then(() => { | ||
const mainWindow = new BrowserWindow({ | ||
show: false | ||
}); | ||
mainWindow.loadFile('about:blank'); | ||
|
||
app.on('web-contents-created', () => { | ||
throw new Error(); | ||
}); | ||
|
||
app.quit(); | ||
}); |