refactor: use ipcRendererUtils.invokeSync / ipcMainUtils.handleSync (#16759)

This commit is contained in:
Milan Burda 2019-02-06 18:53:29 +01:00 committed by Shelley Vohr
parent b7d8234a86
commit 4211a9c69f
3 changed files with 14 additions and 36 deletions

View file

@ -264,16 +264,13 @@ const logSecurityWarnings = function (webPreferences, nodeIntegration) {
}
const getWebPreferences = function () {
const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal')
const errorUtils = require('@electron/internal/common/error-utils')
const ipcRendererUtils = require('@electron/internal/renderer/ipc-renderer-internal-utils')
const [ error, result ] = ipcRenderer.sendSync('ELECTRON_BROWSER_GET_LAST_WEB_PREFERENCES')
if (error) {
console.warn(`getLastWebPreferences() failed: ${errorUtils.deserialize(error)}`)
try {
return ipcRendererUtils.invokeSync('ELECTRON_BROWSER_GET_LAST_WEB_PREFERENCES')
} catch (error) {
console.warn(`getLastWebPreferences() failed: ${error}`)
return null
} else {
return result
}
}