diff --git a/atom/common/api/lib/crash-reporter.coffee b/atom/common/api/lib/crash-reporter.coffee index bd98ae2a427..544791b7d1c 100644 --- a/atom/common/api/lib/crash-reporter.coffee +++ b/atom/common/api/lib/crash-reporter.coffee @@ -19,8 +19,6 @@ class CrashReporter {app} = if process.type is 'browser' then electron else electron.remote @productName ?= app.getName() - companyName ?= 'GitHub, Inc' - submitURL ?= 'http://54.249.141.255:1127/post' autoSubmit ?= true ignoreSystemCrashHandler ?= false extra ?= {} @@ -29,6 +27,14 @@ class CrashReporter extra._companyName ?= companyName extra._version ?= app.getVersion() + unless companyName? + deprecate.log('companyName is now a required option to crashReporter.start') + return + + unless submitURL? + deprecate.log('submitURL is now a required option to crashReporter.start') + return + start = => binding.start @productName, companyName, submitURL, autoSubmit, ignoreSystemCrashHandler, extra if process.platform is 'win32' @@ -40,9 +46,7 @@ class CrashReporter env = ATOM_SHELL_INTERNAL_CRASH_SERVICE: 1 spawn process.execPath, args, {env, detached: true} - start() - else - start() + start() getLastCrashReport: -> reports = this.getUploadedReports() @@ -61,6 +65,5 @@ class CrashReporter path.join tmpdir, "#{@productName} Crashes", 'uploads.log' binding._getUploadedReports log - crashRepoter = new CrashReporter module.exports = crashRepoter diff --git a/atom/common/api/lib/deprecate.coffee b/atom/common/api/lib/deprecate.coffee index 1daf5e4714f..71c2ee5caba 100644 --- a/atom/common/api/lib/deprecate.coffee +++ b/atom/common/api/lib/deprecate.coffee @@ -52,9 +52,12 @@ deprecate.event = (emitter, oldName, newName, fn) -> else @emit oldName, args... -# Print deprecate warning. +# Print deprecation warning. deprecate.warn = (oldName, newName) -> - message = "#{oldName} is deprecated. Use #{newName} instead." + deprecate.log "#{oldName} is deprecated. Use #{newName} instead." + +# Print deprecation message. +deprecate.log = (message) -> if process.throwDeprecation throw new Error(message) else if process.traceDeprecation diff --git a/docs-translations/es/tutorial/quick-start.md b/docs-translations/es/tutorial/quick-start.md index ee1127eb026..b038f7cb08d 100644 --- a/docs-translations/es/tutorial/quick-start.md +++ b/docs-translations/es/tutorial/quick-start.md @@ -70,9 +70,6 @@ El `main.js` debería crear las ventanas y gestionar los eventos del sistema, un var app = require('app'); // Módulo para controlar el ciclo de vida de la aplicación. var BrowserWindow = require('browser-window'); // Módulo para crear uan ventana de navegador. -// Reportar crashes a nuestro servidor. -require('crash-reporter').start(); - // Mantener una referencia global al objeto window, si no lo haces, esta ventana // se cerrará automáticamente cuando el objeto JavaScript sea recolectado (garbage collected): var mainWindow = null; diff --git a/docs-translations/es/tutorial/using-pepper-flash-plugin.md b/docs-translations/es/tutorial/using-pepper-flash-plugin.md index 4e45524fb6a..5c41ff87826 100644 --- a/docs-translations/es/tutorial/using-pepper-flash-plugin.md +++ b/docs-translations/es/tutorial/using-pepper-flash-plugin.md @@ -15,9 +15,6 @@ También puedes agregar la opción `plugins` de `browser-window`. Por ejemplo, var app = require('app'); var BrowserWindow = require('browser-window'); -// Report crashes to our server. -require('crash-reporter').start(); - // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the javascript object is GCed. var mainWindow = null; diff --git a/docs-translations/jp/tutorial/quick-start.md b/docs-translations/jp/tutorial/quick-start.md index 9a929ff84dc..4bd816cb6a4 100644 --- a/docs-translations/jp/tutorial/quick-start.md +++ b/docs-translations/jp/tutorial/quick-start.md @@ -53,9 +53,6 @@ your-app/ var app = require('app'); // Module to control application life. var BrowserWindow = require('browser-window'); // Module to create native browser window. -// Report crashes to our server. -require('crash-reporter').start(); - // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the javascript object is GCed. var mainWindow = null; diff --git a/docs-translations/ko-KR/tutorial/quick-start.md b/docs-translations/ko-KR/tutorial/quick-start.md index cfdc19f00e9..582cc99905f 100644 --- a/docs-translations/ko-KR/tutorial/quick-start.md +++ b/docs-translations/ko-KR/tutorial/quick-start.md @@ -78,9 +78,6 @@ const electron = require('electron'); const app = electron.app; // 어플리케이션 기반을 조작 하는 모듈. const BrowserWindow = electron.BrowserWindow; // 네이티브 브라우저 창을 만드는 모듈. -// Electron 개발자에게 crash-report를 보냄. -electron.crashReporter.start(); - // 윈도우 객체를 전역에 유지합니다. 만약 이렇게 하지 않으면 // 자바스크립트 GC가 일어날 때 창이 멋대로 닫혀버립니다. var mainWindow = null; diff --git a/docs-translations/pt-BR/tutorial/quick-start.md b/docs-translations/pt-BR/tutorial/quick-start.md index eecf67878fc..1b1d6942379 100644 --- a/docs-translations/pt-BR/tutorial/quick-start.md +++ b/docs-translations/pt-BR/tutorial/quick-start.md @@ -81,9 +81,6 @@ exemplo: var app = require('app'); // Módulo para controlar o ciclo de vida do app. var BrowserWindow = require('browser-window'); // Módulo para criar uma janela nativa do browser. -// Relate falhas para nossos servidores. -require('crash-reporter').start(); - // Mantenha uma referência global para o objeto window, se você não o fizer, // a janela será fechada automaticamente quando o objeto JavaScript for // coletado pelo garbage collector. diff --git a/docs-translations/pt-BR/tutorial/using-pepper-flash-plugin.md b/docs-translations/pt-BR/tutorial/using-pepper-flash-plugin.md index e5222ba0772..7ffba7cc336 100644 --- a/docs-translations/pt-BR/tutorial/using-pepper-flash-plugin.md +++ b/docs-translations/pt-BR/tutorial/using-pepper-flash-plugin.md @@ -23,9 +23,6 @@ Por exemplo: var app = require('app'); var BrowserWindow = require('browser-window'); -// Informa os erros ao ao servidor. -require('crash-reporter').start(); - // Mantém uma referência global da janela, se não manter, a janela irá fechar // automaticamente quando o objeto javascript for GCed. var mainWindow = null; diff --git a/docs-translations/zh-CN/tutorial/quick-start.md b/docs-translations/zh-CN/tutorial/quick-start.md index 906db8f4458..1bb8473b362 100644 --- a/docs-translations/zh-CN/tutorial/quick-start.md +++ b/docs-translations/zh-CN/tutorial/quick-start.md @@ -45,9 +45,6 @@ your-app/ var app = require('app'); // 控制应用生命周期的模块。 var BrowserWindow = require('browser-window'); // 创建原生浏览器窗口的模块 -// 给我们的服务器发送异常报告。 -require('crash-reporter').start(); - // 保持一个对于 window 对象的全局引用,不然,当 JavaScript 被 GC, // window 会被自动地关闭 var mainWindow = null; diff --git a/docs-translations/zh-TW/tutorial/quick-start.md b/docs-translations/zh-TW/tutorial/quick-start.md index 18c62c5e75c..8c5c701f17d 100644 --- a/docs-translations/zh-TW/tutorial/quick-start.md +++ b/docs-translations/zh-TW/tutorial/quick-start.md @@ -62,9 +62,6 @@ __注意__:如果 `main` 沒有在 `package.json` 裏, Electron會嘗試載 var app = require('app'); // 控制應用程式生命週期的模組。 var BrowserWindow = require('browser-window'); // 創造原生瀏覽器窗口的模組 -// 對我們的伺服器傳送異常報告。 -require('crash-reporter').start(); - // 保持一個對於 window 物件的全域的引用,不然,當 JavaScript 被GC, // window 會被自動地關閉 var mainWindow = null; diff --git a/docs/api/crash-reporter.md b/docs/api/crash-reporter.md index 6c66a855f75..1b092826356 100644 --- a/docs/api/crash-reporter.md +++ b/docs/api/crash-reporter.md @@ -25,8 +25,8 @@ The `crash-reporter` module has the following methods: `options` Object, properties: * `productName` String, default: Electron. -* `companyName` String, default: GitHub, Inc. -* `submitURL` String, default: http://54.249.141.255:1127/post. +* `companyName` String (**required**) +* `submitURL` String, (**required**) * URL that crash reports will be sent to as POST. * `autoSubmit` Boolean, default: `true`. * Send the crash report without user interaction. diff --git a/docs/tutorial/quick-start.md b/docs/tutorial/quick-start.md index bc1a0f69e35..ebf907e070f 100644 --- a/docs/tutorial/quick-start.md +++ b/docs/tutorial/quick-start.md @@ -84,9 +84,6 @@ const electron = require('electron'); const app = electron.app; // Module to control application life. const BrowserWindow = electron.BrowserWindow; // Module to create native browser window. -// Report crashes to our server. -electron.crashReporter.start(); - // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. var mainWindow = null; diff --git a/spec/api-crash-reporter-spec.coffee b/spec/api-crash-reporter-spec.coffee index 789ba6e01f5..334956d3c06 100644 --- a/spec/api-crash-reporter-spec.coffee +++ b/spec/api-crash-reporter-spec.coffee @@ -55,5 +55,12 @@ describe 'crash-reporter module', -> pathname: path.join fixtures, 'api', 'crash.html' search: "?port=#{port}" if process.platform is 'darwin' - crashReporter.start {'submitURL': 'http://127.0.0.1:' + port} + crashReporter.start + companyName: 'Umbrella Corporation' + submitURL: "http://127.0.0.1:#{port}" w.loadURL url + + describe ".start(options)", -> + it 'requires that the companyName and submitURL options be specified', -> + assert.throws(-> crashReporter.start({companyName: 'Missing submitURL'})) + assert.throws(-> crashReporter.start({submitURL: 'Missing companyName'})) diff --git a/spec/static/main.js b/spec/static/main.js index 4de123830ee..b295ba18552 100644 --- a/spec/static/main.js +++ b/spec/static/main.js @@ -1,3 +1,6 @@ +// Disable use of deprecated functions. +process.throwDeprecation = true; + const electron = require('electron'); const app = electron.app; const ipcMain = electron.ipcMain;