fix: create WebContents for webview on request (#13713)
This commit is contained in:
parent
014832237c
commit
9d6f1a372e
5 changed files with 31 additions and 8 deletions
|
@ -174,6 +174,10 @@ class WebViewImpl {
|
|||
})
|
||||
}
|
||||
|
||||
createGuestSync () {
|
||||
this.attachGuestInstance(guestViewInternal.createGuestSync(this.buildParams()))
|
||||
}
|
||||
|
||||
dispatchEvent (webViewEvent) {
|
||||
this.webviewNode.dispatchEvent(webViewEvent)
|
||||
}
|
||||
|
@ -422,7 +426,11 @@ const registerWebViewElement = function () {
|
|||
|
||||
// WebContents associated with this webview.
|
||||
proto.getWebContents = function () {
|
||||
return v8Util.getHiddenValue(this, 'internal').webContents
|
||||
const internal = v8Util.getHiddenValue(this, 'internal')
|
||||
if (!internal.webContents) {
|
||||
internal.createGuestSync()
|
||||
}
|
||||
return internal.webContents
|
||||
}
|
||||
|
||||
window.WebView = webFrame.registerEmbedderCustomElement('webview', {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue