From 4dc09ea9dc33c65ff7bf7488c61b9c1239e9d94e Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Thu, 3 Sep 2020 12:43:58 -0700 Subject: [PATCH] feat: [crashReporter] enable compression by default (#25288) --- docs/api/crash-reporter.md | 2 +- lib/browser/api/crash-reporter.ts | 2 +- spec-main/api-crash-reporter-spec.ts | 4 ++++ spec-main/fixtures/apps/crash/main.js | 1 + spec-main/fixtures/apps/crash/node-crash.js | 1 + 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/api/crash-reporter.md b/docs/api/crash-reporter.md index 874d030f3999..a90e25809a93 100644 --- a/docs/api/crash-reporter.md +++ b/docs/api/crash-reporter.md @@ -59,7 +59,7 @@ The `crashReporter` module has the following methods: * `rateLimit` Boolean (optional) _macOS_ _Windows_ - If true, limit the number of crashes uploaded to 1/hour. Default is `false`. * `compress` Boolean (optional) - If true, crash reports will be compressed - and uploaded with `Content-Encoding: gzip`. Default is `false`. + and uploaded with `Content-Encoding: gzip`. Default is `true`. * `extra` Record (optional) - Extra string key/value annotations that will be sent along with crash reports that are generated in the main process. Only string values are supported. Crashes generated in diff --git a/lib/browser/api/crash-reporter.ts b/lib/browser/api/crash-reporter.ts index 4cbe0dd7661e..6e882db244ab 100644 --- a/lib/browser/api/crash-reporter.ts +++ b/lib/browser/api/crash-reporter.ts @@ -13,7 +13,7 @@ class CrashReporter { submitURL, uploadToServer = true, rateLimit = false, - compress = false + compress = true } = options || {}; if (submitURL == null) throw new Error('submitURL is a required option to crashReporter.start'); diff --git a/spec-main/api-crash-reporter-spec.ts b/spec-main/api-crash-reporter-spec.ts index eeb314cb844f..1aaf34b5d5b8 100644 --- a/spec-main/api-crash-reporter-spec.ts +++ b/spec-main/api-crash-reporter-spec.ts @@ -232,6 +232,7 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_ await remotely((port: number) => { require('electron').crashReporter.start({ submitURL: `http://127.0.0.1:${port}`, + compress: false, ignoreSystemCrashHandler: true }); }, [port]); @@ -271,6 +272,7 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_ remotely((port: number) => { require('electron').crashReporter.start({ submitURL: `http://127.0.0.1:${port}`, + compress: false, ignoreSystemCrashHandler: true, extra: { longParam: 'a'.repeat(100000) } }); @@ -287,6 +289,7 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_ remotely((port: number, kKeyLengthMax: number) => { require('electron').crashReporter.start({ submitURL: `http://127.0.0.1:${port}`, + compress: false, ignoreSystemCrashHandler: true, extra: { ['a'.repeat(kKeyLengthMax + 10)]: 'value', @@ -399,6 +402,7 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_ await remotely((port: number) => { require('electron').crashReporter.start({ submitURL: `http://127.0.0.1:${port}`, + compress: false, ignoreSystemCrashHandler: true }); }, [port]); diff --git a/spec-main/fixtures/apps/crash/main.js b/spec-main/fixtures/apps/crash/main.js index 056a51f28c70..de036e1e7df6 100644 --- a/spec-main/fixtures/apps/crash/main.js +++ b/spec-main/fixtures/apps/crash/main.js @@ -12,6 +12,7 @@ const addGlobalParam = app.commandLine.getSwitchValue('add-global-param')?.split crashReporter.start({ productName: 'Zombies', companyName: 'Umbrella Corporation', + compress: false, uploadToServer, submitURL: url, ignoreSystemCrashHandler: true, diff --git a/spec-main/fixtures/apps/crash/node-crash.js b/spec-main/fixtures/apps/crash/node-crash.js index fbefddadc8ba..1d3d45c6c4e5 100644 --- a/spec-main/fixtures/apps/crash/node-crash.js +++ b/spec-main/fixtures/apps/crash/node-crash.js @@ -2,6 +2,7 @@ if (process.platform === 'linux') { process.crashReporter.start({ submitURL: process.argv[2], productName: 'Zombies', + compress: false, globalExtra: { _version: process.argv[3] }