refactor: piggy-back on ELECTRON_BROWSER_SANDBOX_LOAD to get content scripts (#18823)

This commit is contained in:
Milan Burda 2019-06-19 17:23:44 +02:00 committed by Alexey Kuzmin
parent 450aa33775
commit edb56500c7
6 changed files with 17 additions and 12 deletions

View file

@ -54,6 +54,7 @@ v8Util.setHiddenValue(global, 'ipcNative', {
// Use electron module after everything is ready.
const { ipcRendererInternal } = require('@electron/internal/renderer/ipc-renderer-internal')
const ipcRendererUtils = require('@electron/internal/renderer/ipc-renderer-internal-utils')
const { webFrameInit } = require('@electron/internal/renderer/web-frame-init')
webFrameInit()
@ -111,7 +112,8 @@ switch (window.location.protocol) {
windowSetup(guestInstanceId, openerId, isHiddenPage, usesNativeWindowOpen)
// Inject content scripts.
require('@electron/internal/renderer/content-scripts-injector')()
const contentScripts = ipcRendererUtils.invokeSync('ELECTRON_GET_CONTENT_SCRIPTS') as Electron.ContentScriptEntry[]
require('@electron/internal/renderer/content-scripts-injector')(contentScripts)
}
}