electron/spec/fixtures/crash-cases/fs-promises-renderer-crash/index.js
Milan Burda d78f37ec8f
refactor: use node scheme imports in spec (#38487)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2023-06-15 10:42:27 -04:00

28 lines
654 B
JavaScript

const { app, BrowserWindow, ipcMain } = require('electron');
const path = require('node:path');
app.whenReady().then(() => {
let reloadCount = 0;
const win = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
win.loadFile('index.html');
win.webContents.on('render-process-gone', () => {
process.exit(1);
});
win.webContents.on('did-finish-load', () => {
if (reloadCount > 2) {
setImmediate(() => app.quit());
} else {
reloadCount += 1;
win.webContents.send('reload', path.join(__dirname, '..', '..', 'cat.pdf'));
}
});
});