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:
Milan Burda 2021-05-15 09:42:07 +02:00 committed by GitHub
parent 5e6f8349ec
commit c68c65f383
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 220 additions and 214 deletions

View file

@ -1,15 +1,9 @@
/* global nodeProcess, isolatedWorld */
/* global isolatedApi */
import type * as webViewElementModule from '@electron/internal/renderer/web-view/web-view-element';
process._linkedBinding = nodeProcess._linkedBinding;
const v8Util = process._linkedBinding('electron_common_v8_util');
const webViewImpl = v8Util.getHiddenValue(isolatedWorld, 'web-view-impl');
if (webViewImpl) {
if (isolatedApi.guestViewInternal) {
// Must setup the WebView element in main world.
const { setupWebView } = require('@electron/internal/renderer/web-view/web-view-element') as typeof webViewElementModule;
setupWebView(webViewImpl as any);
setupWebView(isolatedApi);
}