refactor: use ipcRendererUtils.invokeSync / ipcMainUtils.handleSync (#16759)
This commit is contained in:
parent
b7d8234a86
commit
4211a9c69f
3 changed files with 14 additions and 36 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue