refactor: port parts of window-setup to use ctx bridge instead of being run in the main world (#23194)

* refactor: port parts of window-setup to use ctx bridge instead of being run in the main world

* chore: update ctx bridge specs for new base numbers
This commit is contained in:
Samuel Attard 2020-04-22 12:42:51 -07:00 committed by GitHub
parent 9d60cfa6fc
commit 96bf9ce77f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 167 additions and 25 deletions

View file

@ -18,3 +18,14 @@ const contextBridge = {
if (!binding._debugGCMaps) delete contextBridge.debugGC;
export default contextBridge;
export const internalContextBridge = {
contextIsolationEnabled,
overrideGlobalMethodFromIsolatedWorld: (keys: string[], method: Function) => {
return binding._overrideGlobalMethodFromIsolatedWorld(keys, method);
},
overrideGlobalPropertyFromIsolatedWorld: (keys: string[], getter: Function, setter?: Function) => {
return binding._overrideGlobalPropertyFromIsolatedWorld(keys, getter, setter || null);
},
isInMainWorld: () => binding._isCalledFromMainWorld() as boolean
};