fix: small refactoring regressions (backport: 4-0-x) (#15224)

* fix: require('@electron/internal/browser/guest-view-manager')

* fix: add missing crashServicePid used by tests
This commit is contained in:
trop[bot]
2018-10-18 10:59:26 +11:00
committed by Samuel Attard
parent 1ff102e54a
commit fd205a1577
4 changed files with 9 additions and 4 deletions

View File

@@ -376,7 +376,7 @@ handleRemoteCommand('ELECTRON_BROWSER_GUEST_WEB_CONTENTS', function (event, cont
ipcMain.on('ELECTRON_BROWSER_ASYNC_CALL_TO_GUEST_VIEW', function (event, requestId, guestInstanceId, method, args, hasCallback) {
new Promise(resolve => {
const guestViewManager = require('./guest-view-manager')
const guestViewManager = require('@electron/internal/browser/guest-view-manager')
const guest = guestViewManager.getGuest(guestInstanceId)
if (guest.hostWebContents !== event.sender) {
throw new Error('Access denied')
@@ -428,6 +428,7 @@ const getTempDirectory = function () {
const crashReporterInit = function (options) {
const productName = options.productName || electron.app.getName()
const crashesDirectory = path.join(getTempDirectory(), `${productName} Crashes`)
let crashServicePid
if (process.platform === 'win32') {
const env = {
@@ -440,15 +441,18 @@ const crashReporterInit = function (options) {
'--v=1'
]
spawn(process.helperExecPath, args, {
const crashServiceProcess = spawn(process.helperExecPath, args, {
env,
detached: true
})
crashServicePid = crashServiceProcess.pid
}
return {
productName,
crashesDirectory,
crashServicePid,
appVersion: electron.app.getVersion()
}
}

View File

@@ -58,6 +58,7 @@ class CrashReporter {
this.productName = ret.productName
this.crashesDirectory = ret.crashesDirectory
this.crashServicePid = ret.crashServicePid
if (extra == null) extra = {}
if (extra._productName == null) extra._productName = ret.productName

View File

@@ -19,7 +19,7 @@ crashReporter.start({
})
if (process.platform === 'win32') {
ipcRenderer.sendSync('crash-service-pid', crashReporter._crashServiceProcess.pid)
ipcRenderer.sendSync('crash-service-pid', crashReporter.crashServicePid)
}
setImmediate(() => {

View File

@@ -20,7 +20,7 @@
})
if (process.platform === 'win32') {
ipcRenderer.sendSync('crash-service-pid', crashReporter._crashServiceProcess.pid)
ipcRenderer.sendSync('crash-service-pid', crashReporter.crashServicePid)
}
if (!uploadToServer) {