Fix sandboxed crashReporter for windows.
- Use `path` module from browser process in sandboxed renderer. This is required because the return value of `path.join` is platform-specific, and this is an assumtion of crash-reporter.js which is shared between sandboxed and non-sandboxed renderers. - Set `process.platform` and `process.execPath` in sandboxed renderer environment. This is required to spawn the windows crash service from sandboxed renderer. - Use a single temporary directory for all crashReporter tests. This is required to make tests more deterministic across platforms(since mac's crashpad doesn't support changing the crash dump directory). Also make a few improvements/fixes to the `uploadToServer` test.
This commit is contained in:
parent
7574c33ef1
commit
ce1a5e3c9c
5 changed files with 33 additions and 36 deletions
1
lib/sandboxed_renderer/api/exports/path.js
Normal file
1
lib/sandboxed_renderer/api/exports/path.js
Normal file
|
@ -0,0 +1 @@
|
|||
module.exports = require('electron').remote.require('path')
|
|
@ -27,6 +27,7 @@ const preloadModules = new Map([
|
|||
['electron', electron],
|
||||
['fs', fs],
|
||||
['os', require('os')],
|
||||
['path', require('path')],
|
||||
['url', require('url')],
|
||||
['timers', require('timers')]
|
||||
])
|
||||
|
@ -36,8 +37,9 @@ const preloadSrc = fs.readFileSync(preloadPath).toString()
|
|||
// Pass different process object to the preload script(which should not have
|
||||
// access to things like `process.atomBinding`).
|
||||
const preloadProcess = new events.EventEmitter()
|
||||
preloadProcess.platform = electron.remote.process.platform
|
||||
preloadProcess.crash = () => binding.crash()
|
||||
process.platform = preloadProcess.platform = electron.remote.process.platform
|
||||
process.execPath = preloadProcess.execPath = electron.remote.process.execPath
|
||||
process.on('exit', () => preloadProcess.emit('exit'))
|
||||
|
||||
// This is the `require` function that will be visible to the preload script
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue