|
@@ -4,7 +4,7 @@ import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-in
|
|
|
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils'
|
|
|
import * as guestViewInternal from '@electron/internal/renderer/web-view/guest-view-internal'
|
|
|
import { WEB_VIEW_CONSTANTS } from '@electron/internal/renderer/web-view/web-view-constants'
|
|
|
-import { syncMethods, asyncMethods } from '@electron/internal/common/web-view-methods'
|
|
|
+import { syncMethods, asyncMethods, properties } from '@electron/internal/common/web-view-methods'
|
|
|
import { deserialize } from '@electron/internal/common/type-utils'
|
|
|
const { webFrame } = electron
|
|
|
|
|
@@ -274,6 +274,25 @@ export const setupMethods = (WebViewElement: typeof ElectronInternal.WebViewElem
|
|
|
WebViewElement.prototype.capturePage = async function (...args) {
|
|
|
return deserialize(await ipcRendererInternal.invoke('ELECTRON_GUEST_VIEW_MANAGER_CAPTURE_PAGE', this.getWebContentsId(), args))
|
|
|
}
|
|
|
+
|
|
|
+ const createPropertyGetter = function (property: string) {
|
|
|
+ return function (this: ElectronInternal.WebViewElement) {
|
|
|
+ return ipcRendererUtils.invokeSync('ELECTRON_GUEST_VIEW_MANAGER_PROPERTY_GET', this.getWebContentsId(), property)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const createPropertySetter = function (property: string) {
|
|
|
+ return function (this: ElectronInternal.WebViewElement, arg: any) {
|
|
|
+ return ipcRendererUtils.invokeSync('ELECTRON_GUEST_VIEW_MANAGER_PROPERTY_SET', this.getWebContentsId(), property, arg)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (const property of properties) {
|
|
|
+ Object.defineProperty(WebViewElement.prototype, property, {
|
|
|
+ get: createPropertyGetter(property) as any,
|
|
|
+ set: createPropertySetter(property)
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
export const webViewImplModule = {
|