refactor: replace ipcRendererUtils.invoke() with ipcRendererInternal.invoke() (#19574)
This commit is contained in:
parent
698120daf0
commit
81e9dab52f
29 changed files with 195 additions and 164 deletions
|
@ -471,11 +471,11 @@ ipcMainInternal.on('ELECTRON_BROWSER_WINDOW_CLOSE', function (event) {
|
|||
event.returnValue = null
|
||||
})
|
||||
|
||||
ipcMainUtils.handle('ELECTRON_CRASH_REPORTER_INIT', function (event, options) {
|
||||
ipcMainUtils.handleSync('ELECTRON_CRASH_REPORTER_INIT', function (event, options) {
|
||||
return crashReporterInit(options)
|
||||
})
|
||||
|
||||
ipcMainUtils.handle('ELECTRON_BROWSER_GET_LAST_WEB_PREFERENCES', function (event) {
|
||||
ipcMainInternal.handle('ELECTRON_BROWSER_GET_LAST_WEB_PREFERENCES', function (event) {
|
||||
return event.sender.getLastWebPreferences()
|
||||
})
|
||||
|
||||
|
@ -491,7 +491,7 @@ const allowedClipboardMethods = (() => {
|
|||
}
|
||||
})()
|
||||
|
||||
ipcMainUtils.handle('ELECTRON_BROWSER_CLIPBOARD', function (event, method, ...args) {
|
||||
ipcMainUtils.handleSync('ELECTRON_BROWSER_CLIPBOARD', function (event, method, ...args) {
|
||||
if (!allowedClipboardMethods.has(method)) {
|
||||
throw new Error(`Invalid method: ${method}`)
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ ipcMainUtils.handle('ELECTRON_BROWSER_CLIPBOARD', function (event, method, ...ar
|
|||
if (features.isDesktopCapturerEnabled()) {
|
||||
const desktopCapturer = require('@electron/internal/browser/desktop-capturer')
|
||||
|
||||
ipcMainUtils.handle('ELECTRON_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', function (event, ...args) {
|
||||
ipcMainInternal.handle('ELECTRON_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', function (event, ...args) {
|
||||
const customEvent = emitCustomEvent(event.sender, 'desktop-capturer-get-sources')
|
||||
|
||||
if (customEvent.defaultPrevented) {
|
||||
|
@ -526,13 +526,13 @@ const getPreloadScript = async function (preloadPath) {
|
|||
}
|
||||
|
||||
if (process.electronBinding('features').isExtensionsEnabled()) {
|
||||
ipcMainUtils.handle('ELECTRON_GET_CONTENT_SCRIPTS', () => [])
|
||||
ipcMainUtils.handleSync('ELECTRON_GET_CONTENT_SCRIPTS', () => [])
|
||||
} else {
|
||||
const { getContentScripts } = require('@electron/internal/browser/chrome-extension')
|
||||
ipcMainUtils.handle('ELECTRON_GET_CONTENT_SCRIPTS', () => getContentScripts())
|
||||
ipcMainUtils.handleSync('ELECTRON_GET_CONTENT_SCRIPTS', () => getContentScripts())
|
||||
}
|
||||
|
||||
ipcMainUtils.handle('ELECTRON_BROWSER_SANDBOX_LOAD', async function (event) {
|
||||
ipcMainUtils.handleSync('ELECTRON_BROWSER_SANDBOX_LOAD', async function (event) {
|
||||
const preloadPaths = event.sender._getPreloadPaths()
|
||||
|
||||
let contentScripts = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue