@@ -4,7 +4,7 @@ import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-in
4
4
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils'
5
5
import * as guestViewInternal from '@electron/internal/renderer/web-view/guest-view-internal'
6
6
import { WEB_VIEW_CONSTANTS } from '@electron/internal/renderer/web-view/web-view-constants'
7
- import { syncMethods , asyncMethods } from '@electron/internal/common/web-view-methods'
7
+ import { syncMethods , asyncMethods , properties } from '@electron/internal/common/web-view-methods'
8
8
import { deserialize } from '@electron/internal/common/type-utils'
9
9
const { webFrame } = electron
10
10
@@ -249,6 +249,25 @@ export const setupMethods = (WebViewElement: typeof ElectronInternal.WebViewElem
249
249
WebViewElement . prototype . capturePage = async function ( ...args ) {
250
250
return deserialize ( await ipcRendererInternal . invoke ( 'ELECTRON_GUEST_VIEW_MANAGER_CAPTURE_PAGE' , this . getWebContentsId ( ) , args ) )
251
251
}
252
+
253
+ const createPropertyGetter = function ( property : string ) {
254
+ return function ( this : ElectronInternal . WebViewElement ) {
255
+ return ipcRendererUtils . invokeSync ( 'ELECTRON_GUEST_VIEW_MANAGER_PROPERTY_GET' , this . getWebContentsId ( ) , property )
256
+ }
257
+ }
258
+
259
+ const createPropertySetter = function ( property : string ) {
260
+ return function ( this : ElectronInternal . WebViewElement , arg : any ) {
261
+ return ipcRendererUtils . invokeSync ( 'ELECTRON_GUEST_VIEW_MANAGER_PROPERTY_SET' , this . getWebContentsId ( ) , property , arg )
262
+ }
263
+ }
264
+
265
+ for ( const property of properties ) {
266
+ Object . defineProperty ( WebViewElement . prototype , property , {
267
+ get : createPropertyGetter ( property ) as any ,
268
+ set : createPropertySetter ( property )
269
+ } )
270
+ }
252
271
}
253
272
254
273
export const webViewImplModule = {
0 commit comments