From 508551b81b3e76998b38e6d56aaa0de47e488664 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Wed, 17 Oct 2018 21:18:18 +0200 Subject: [PATCH] fix: small refactoring regressions (#15206) * fix: require('@electron/internal/browser/guest-view-manager') * fix: add missing crashServicePid used by tests --- lib/browser/rpc-server.js | 8 ++++++-- lib/common/crash-reporter.js | 1 + spec/fixtures/api/crash-restart.html | 2 +- spec/fixtures/api/crash.html | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/browser/rpc-server.js b/lib/browser/rpc-server.js index f306ee0a69e1..878910725e5c 100644 --- a/lib/browser/rpc-server.js +++ b/lib/browser/rpc-server.js @@ -382,7 +382,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') @@ -434,6 +434,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 = { @@ -446,15 +447,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() } } diff --git a/lib/common/crash-reporter.js b/lib/common/crash-reporter.js index bc9d4c583ef4..eed2c24009cb 100644 --- a/lib/common/crash-reporter.js +++ b/lib/common/crash-reporter.js @@ -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 diff --git a/spec/fixtures/api/crash-restart.html b/spec/fixtures/api/crash-restart.html index 618728e47f9e..a9c261fb57da 100644 --- a/spec/fixtures/api/crash-restart.html +++ b/spec/fixtures/api/crash-restart.html @@ -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(() => { diff --git a/spec/fixtures/api/crash.html b/spec/fixtures/api/crash.html index a3dbeb6ded43..2f671ea607e1 100644 --- a/spec/fixtures/api/crash.html +++ b/spec/fixtures/api/crash.html @@ -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) {