electron/spec-main/fixtures/crash-cases/webview-contents-error-on-creation/index.js
Keeley Hammond 06f51b7283
fix: prevent crash on web-contents creation when error is thrown (#28971)
* 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: Jeremy Rose <jeremya@chromium.org>
2021-05-11 13:57:11 -07:00

14 lines
273 B
JavaScript

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();
});