Browse Source

Support calling getUploadedReports on unstarted crash reporter

Kevin Sawicki 8 years ago
parent
commit
43702e0f8e
1 changed files with 4 additions and 2 deletions
  1. 4 2
      lib/common/api/crash-reporter.js

+ 4 - 2
lib/common/api/crash-reporter.js

@@ -2,6 +2,7 @@
 
 const {spawn} = require('child_process')
 const electron = require('electron')
+const {app} = process.type === 'browser' ? electron : electron.remote
 const binding = process.atomBinding('crash_reporter')
 
 class CrashReporter {
@@ -12,7 +13,6 @@ class CrashReporter {
     this.productName = options.productName
     let {autoSubmit, companyName, extra, ignoreSystemCrashHandler, submitURL} = options
 
-    const app = (process.type === 'browser' ? electron : electron.remote).app
     this.tempDirectory = app.getPath('temp')
     if (this.productName == null) {
       this.productName = app.getName()
@@ -66,7 +66,9 @@ class CrashReporter {
   }
 
   getUploadedReports () {
-    return binding._getUploadedReports(this.productName, this.tempDirectory)
+    const productName = this.productName != null ? this.productName : app.getName()
+    const tempDirectory = this.tempDirectory != null ? this.tempDirectory : app.getPath('temp')
+    return binding._getUploadedReports(productName, tempDirectory)
   }
 }