chore: disable JS impl when //extensions support is on (#19512)
This commit is contained in:
parent
a5f87cee6b
commit
c71cdce0b7
9 changed files with 50 additions and 9 deletions
|
@ -9,7 +9,6 @@ const eventBinding = process.electronBinding('event')
|
|||
const clipboard = process.electronBinding('clipboard')
|
||||
const features = process.electronBinding('features')
|
||||
|
||||
const { getContentScripts } = require('@electron/internal/browser/chrome-extension')
|
||||
const { crashReporterInit } = require('@electron/internal/browser/crash-reporter-init')
|
||||
const { ipcMainInternal } = require('@electron/internal/browser/ipc-main-internal')
|
||||
const ipcMainUtils = require('@electron/internal/browser/ipc-main-internal-utils')
|
||||
|
@ -526,13 +525,24 @@ const getPreloadScript = async function (preloadPath) {
|
|||
return { preloadPath, preloadSrc, preloadError }
|
||||
}
|
||||
|
||||
ipcMainUtils.handle('ELECTRON_GET_CONTENT_SCRIPTS', () => getContentScripts())
|
||||
if (process.electronBinding('features').isExtensionsEnabled()) {
|
||||
ipcMainUtils.handle('ELECTRON_GET_CONTENT_SCRIPTS', () => [])
|
||||
} else {
|
||||
const { getContentScripts } = require('@electron/internal/browser/chrome-extension')
|
||||
ipcMainUtils.handle('ELECTRON_GET_CONTENT_SCRIPTS', () => getContentScripts())
|
||||
}
|
||||
|
||||
ipcMainUtils.handle('ELECTRON_BROWSER_SANDBOX_LOAD', async function (event) {
|
||||
const preloadPaths = event.sender._getPreloadPaths()
|
||||
|
||||
let contentScripts = []
|
||||
if (!process.electronBinding('features').isExtensionsEnabled()) {
|
||||
const { getContentScripts } = require('@electron/internal/browser/chrome-extension')
|
||||
contentScripts = getContentScripts()
|
||||
}
|
||||
|
||||
return {
|
||||
contentScripts: getContentScripts(),
|
||||
contentScripts,
|
||||
preloadScripts: await Promise.all(preloadPaths.map(path => getPreloadScript(path))),
|
||||
isRemoteModuleEnabled: isRemoteModuleEnabled(event.sender),
|
||||
isWebViewTagEnabled: guestViewManager.isWebViewTagEnabled(event.sender),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue