fix: NativeImage serialization of <webview>.capturePage() result (#20825)

This commit is contained in:
Milan Burda 2019-11-12 21:56:17 +01:00 committed by Alexey Kuzmin
parent c0657a4ca7
commit 1d596f616d
12 changed files with 67 additions and 44 deletions

View file

@ -5,6 +5,7 @@ import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-inte
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 { deserialize } from '@electron/internal/common/type-utils'
const { webFrame } = electron
const v8Util = process.electronBinding('v8_util')
@ -244,6 +245,10 @@ export const setupMethods = (WebViewElement: typeof ElectronInternal.WebViewElem
for (const method of asyncMethods) {
(WebViewElement.prototype as Record<string, any>)[method] = createNonBlockHandler(method)
}
WebViewElement.prototype.capturePage = async function (...args) {
return deserialize(await ipcRendererInternal.invoke('ELECTRON_GUEST_VIEW_MANAGER_CAPTURE_PAGE', this.getWebContentsId(), args))
}
}
export const webViewImplModule = {