refactor: remove duplicate contextIsolation from getWebPreference() (#31730)
This commit is contained in:
parent
4af21a1df8
commit
fe7f296339
7 changed files with 7 additions and 16 deletions
|
@ -1,10 +1,7 @@
|
|||
const { mainFrame } = process._linkedBinding('electron_renderer_web_frame');
|
||||
const binding = process._linkedBinding('electron_renderer_context_bridge');
|
||||
|
||||
const contextIsolationEnabled = mainFrame.getWebPreference('contextIsolation');
|
||||
|
||||
const checkContextIsolationEnabled = () => {
|
||||
if (!contextIsolationEnabled) throw new Error('contextBridge API can only be used when contextIsolation is enabled');
|
||||
if (!process.contextIsolated) throw new Error('contextBridge API can only be used when contextIsolation is enabled');
|
||||
};
|
||||
|
||||
const contextBridge: Electron.ContextBridge = {
|
||||
|
@ -17,7 +14,7 @@ const contextBridge: Electron.ContextBridge = {
|
|||
export default contextBridge;
|
||||
|
||||
export const internalContextBridge = {
|
||||
contextIsolationEnabled,
|
||||
contextIsolationEnabled: process.contextIsolated,
|
||||
overrideGlobalValueFromIsolatedWorld: (keys: string[], value: any) => {
|
||||
return binding._overrideGlobalValueFromIsolatedWorld(keys, value, false);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue