refactor: implement <webview> using contextBridge (#29037)
* refactor: implement <webview> using contextBridge * chore: address PR feedback * chore: address PR feedback * fix: check for HTMLIFrameElement instance in attachGuest
This commit is contained in:
parent
5e6f8349ec
commit
c68c65f383
17 changed files with 220 additions and 214 deletions
11
typings/internal-ambient.d.ts
vendored
11
typings/internal-ambient.d.ts
vendored
|
@ -1,9 +1,14 @@
|
|||
/* eslint-disable no-var */
|
||||
declare var internalBinding: any;
|
||||
declare var nodeProcess: any;
|
||||
declare var isolatedWorld: any;
|
||||
declare var binding: { get: (name: string) => any; process: NodeJS.Process; createPreloadScript: (src: string) => Function };
|
||||
|
||||
declare var isolatedApi: {
|
||||
guestViewInternal: any;
|
||||
allowGuestViewElementDefinition: NodeJS.InternalWebFrame['allowGuestViewElementDefinition'];
|
||||
setIsWebView: (iframe: HTMLIFrameElement) => void;
|
||||
createNativeImage: typeof Electron.nativeImage['createEmpty'];
|
||||
}
|
||||
|
||||
declare const BUILDFLAG: (flag: boolean) => boolean;
|
||||
|
||||
declare const ENABLE_DESKTOP_CAPTURER: boolean;
|
||||
|
@ -115,6 +120,8 @@ declare namespace NodeJS {
|
|||
|
||||
interface InternalWebFrame extends Electron.WebFrame {
|
||||
getWebPreference<K extends keyof InternalWebPreferences>(name: K): InternalWebPreferences[K];
|
||||
getWebFrameId(window: Window): number;
|
||||
allowGuestViewElementDefinition(context: object, callback: Function): void;
|
||||
}
|
||||
|
||||
interface WebFrameBinding {
|
||||
|
|
5
typings/internal-electron.d.ts
vendored
5
typings/internal-electron.d.ts
vendored
|
@ -91,11 +91,6 @@ declare namespace Electron {
|
|||
viewInstanceId: number;
|
||||
}
|
||||
|
||||
interface WebFrame {
|
||||
getWebFrameId(window: Window): number;
|
||||
allowGuestViewElementDefinition(window: Window, context: any): void;
|
||||
}
|
||||
|
||||
interface WebFrameMain {
|
||||
_send(internal: boolean, channel: string, args: any): void;
|
||||
_sendInternal(channel: string, ...args: any[]): void;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue