|
@@ -260,7 +260,7 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
|
|
|
require('electron').crashReporter.start({
|
|
|
submitURL: `http://127.0.0.1:${port}`,
|
|
|
ignoreSystemCrashHandler: true,
|
|
|
- extra: { 'longParam': 'a'.repeat(130) }
|
|
|
+ extra: { longParam: 'a'.repeat(130) }
|
|
|
});
|
|
|
setTimeout(() => process.crash());
|
|
|
}, port);
|
|
@@ -438,7 +438,7 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
|
|
|
await remotely(() => {
|
|
|
require('electron').crashReporter.start({
|
|
|
submitURL: 'http://127.0.0.1',
|
|
|
- extra: { 'extra1': 'hi' }
|
|
|
+ extra: { extra1: 'hi' }
|
|
|
});
|
|
|
});
|
|
|
const parameters = await remotely(() => require('electron').crashReporter.getParameters());
|
|
@@ -471,8 +471,8 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
|
|
|
crashReporter.start({ submitURL: 'http://' });
|
|
|
const bw = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } });
|
|
|
bw.loadURL('about:blank');
|
|
|
- await bw.webContents.executeJavaScript(`require('electron').crashReporter.addExtraParameter('hello', 'world')`);
|
|
|
- return bw.webContents.executeJavaScript(`require('electron').crashReporter.getParameters()`);
|
|
|
+ await bw.webContents.executeJavaScript('require(\'electron\').crashReporter.addExtraParameter(\'hello\', \'world\')');
|
|
|
+ return bw.webContents.executeJavaScript('require(\'electron\').crashReporter.getParameters()');
|
|
|
});
|
|
|
if (process.platform === 'linux') {
|
|
|
// On Linux, 'getParameters' will also include the global parameters,
|
|
@@ -542,11 +542,10 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for (const crashingProcess of ['main', 'renderer', 'sandboxed-renderer', 'node']) {
|
|
|
- // TODO(nornagon): breakpad on linux disables itself when uploadToServer
|
|
|
- // is false, so we should figure out a different way to test the crash
|
|
|
- // dump dir on linux.
|
|
|
- ifdescribe(process.platform !== 'linux')(`when ${crashingProcess} crashes`, () => {
|
|
|
+ const processList = process.platform === 'linux' ? ['main', 'renderer', 'sandboxed-renderer']
|
|
|
+ : ['main', 'renderer', 'sandboxed-renderer', 'node'];
|
|
|
+ for (const crashingProcess of processList) {
|
|
|
+ describe(`when ${crashingProcess} crashes`, () => {
|
|
|
it('stores crashes in the crash dump directory when uploadToServer: false', async () => {
|
|
|
const { remotely } = await startRemoteControlApp();
|
|
|
const crashesDir = await remotely(() => {
|
|
@@ -554,12 +553,27 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
|
|
|
crashReporter.start({ submitURL: 'http://127.0.0.1', uploadToServer: false, ignoreSystemCrashHandler: true });
|
|
|
return crashReporter.getCrashesDirectory();
|
|
|
});
|
|
|
- const reportsDir = process.platform === 'darwin' ? path.join(crashesDir, 'completed') : path.join(crashesDir, 'reports');
|
|
|
+ let reportsDir = crashesDir;
|
|
|
+ if (process.platform === 'darwin') {
|
|
|
+ reportsDir = path.join(crashesDir, 'completed');
|
|
|
+ } else if (process.platform === 'win32') {
|
|
|
+ reportsDir = path.join(crashesDir, 'reports');
|
|
|
+ }
|
|
|
const newFileAppeared = waitForNewFileInDir(reportsDir);
|
|
|
crash(crashingProcess, remotely);
|
|
|
const newFiles = await newFileAppeared;
|
|
|
expect(newFiles.length).to.be.greaterThan(0);
|
|
|
- expect(newFiles[0]).to.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.dmp$/);
|
|
|
+ if (process.platform === 'linux') {
|
|
|
+ if (crashingProcess === 'main') {
|
|
|
+ expect(newFiles[0]).to.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{8}-[0-9a-f]{8}\.dmp$/);
|
|
|
+ } else {
|
|
|
+ const process = crashingProcess === 'sandboxed-renderer' ? 'renderer' : crashingProcess;
|
|
|
+ const regex = RegExp(`chromium-${process}-minidump-[0-9a-f]{16}.dmp`);
|
|
|
+ expect(newFiles[0]).to.match(regex);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ expect(newFiles[0]).to.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.dmp$/);
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
it('respects an overridden crash dump directory', async () => {
|
|
@@ -573,12 +587,27 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
|
|
|
}, crashesDir);
|
|
|
expect(remoteCrashesDir).to.equal(crashesDir);
|
|
|
|
|
|
- const reportsDir = process.platform === 'darwin' ? path.join(crashesDir, 'completed') : path.join(crashesDir, 'reports');
|
|
|
+ let reportsDir = crashesDir;
|
|
|
+ if (process.platform === 'darwin') {
|
|
|
+ reportsDir = path.join(crashesDir, 'completed');
|
|
|
+ } else if (process.platform === 'win32') {
|
|
|
+ reportsDir = path.join(crashesDir, 'reports');
|
|
|
+ }
|
|
|
const newFileAppeared = waitForNewFileInDir(reportsDir);
|
|
|
crash(crashingProcess, remotely);
|
|
|
const newFiles = await newFileAppeared;
|
|
|
expect(newFiles.length).to.be.greaterThan(0);
|
|
|
- expect(newFiles[0]).to.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.dmp$/);
|
|
|
+ if (process.platform === 'linux') {
|
|
|
+ if (crashingProcess === 'main') {
|
|
|
+ expect(newFiles[0]).to.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{8}-[0-9a-f]{8}\.dmp$/);
|
|
|
+ } else {
|
|
|
+ const process = crashingProcess !== 'sandboxed-renderer' ? crashingProcess : 'renderer';
|
|
|
+ const regex = RegExp(`chromium-${process}-minidump-[0-9a-f]{16}.dmp`);
|
|
|
+ expect(newFiles[0]).to.match(regex);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ expect(newFiles[0]).to.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.dmp$/);
|
|
|
+ }
|
|
|
});
|
|
|
});
|
|
|
}
|