electron/spec-main/fixtures/crash-cases/fs-promises-renderer-crash/index.js
Robo b2c5623a13
fix: crash when destroying node env with pending promises (#33280)
* fix: crash when destroying node env with pending promises

* chore: add spec
2022-03-16 18:54:45 +01:00

28 lines
649 B
JavaScript

const { app, BrowserWindow, ipcMain } = require('electron');
const path = require('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'));
}
});
});