* 创建并配置插件的 session(注册 preload、代理、图标协议)
(
pluginName: string,
pluginPath: string
)
| 213 | * 创建并配置插件的 session(注册 preload、代理、图标协议) |
| 214 | */ |
| 215 | private async setupPluginSession( |
| 216 | pluginName: string, |
| 217 | pluginPath: string |
| 218 | ): Promise<Electron.Session> { |
| 219 | const partition = getPluginSessionPartition(pluginName) |
| 220 | console.log('[Plugin] 设置插件 Session:', { |
| 221 | pluginName, |
| 222 | pluginPath, |
| 223 | partition |
| 224 | }) |
| 225 | const sess = session.fromPartition(partition) |
| 226 | sess.registerPreloadScript({ type: 'frame', filePath: mainPreload }) |
| 227 | await proxyManager.applyProxyToSession(sess, `插件 ${pluginName}`) |
| 228 | if (isBundledInternalPlugin(pluginName)) { |
| 229 | registerIconProtocolForSession(sess) |
| 230 | } |
| 231 | return sess |
| 232 | } |
| 233 | |
| 234 | /** |
| 235 | * 创建插件的 WebContentsView 实例 |
no test coverage detected