Cache remote WebContents object of webview
This commit is contained in:
parent
21f7316a18
commit
4fdf6ceb51
1 changed files with 3 additions and 1 deletions
|
@ -46,6 +46,7 @@ class WebViewImpl
|
||||||
# that we don't end up allocating a second guest.
|
# that we don't end up allocating a second guest.
|
||||||
if @guestInstanceId
|
if @guestInstanceId
|
||||||
guestViewInternal.destroyGuest @guestInstanceId
|
guestViewInternal.destroyGuest @guestInstanceId
|
||||||
|
@webContents = null
|
||||||
@guestInstanceId = undefined
|
@guestInstanceId = undefined
|
||||||
@beforeFirstNavigation = true
|
@beforeFirstNavigation = true
|
||||||
@attributes[webViewConstants.ATTRIBUTE_PARTITION].validPartitionId = true
|
@attributes[webViewConstants.ATTRIBUTE_PARTITION].validPartitionId = true
|
||||||
|
@ -188,6 +189,7 @@ class WebViewImpl
|
||||||
|
|
||||||
attachWindow: (guestInstanceId) ->
|
attachWindow: (guestInstanceId) ->
|
||||||
@guestInstanceId = guestInstanceId
|
@guestInstanceId = guestInstanceId
|
||||||
|
@webContents = remote.getGuestWebContents @guestInstanceId
|
||||||
return true unless @internalInstanceId
|
return true unless @internalInstanceId
|
||||||
|
|
||||||
guestViewInternal.attachGuest @internalInstanceId, @guestInstanceId, @buildParams()
|
guestViewInternal.attachGuest @internalInstanceId, @guestInstanceId, @buildParams()
|
||||||
|
@ -299,7 +301,7 @@ registerWebViewElement = ->
|
||||||
createHandler = (m) ->
|
createHandler = (m) ->
|
||||||
(args...) ->
|
(args...) ->
|
||||||
internal = v8Util.getHiddenValue this, 'internal'
|
internal = v8Util.getHiddenValue this, 'internal'
|
||||||
remote.getGuestWebContents(internal.guestInstanceId)[m] args...
|
internal.webContents[m] args...
|
||||||
proto[m] = createHandler m for m in methods
|
proto[m] = createHandler m for m in methods
|
||||||
|
|
||||||
window.WebView = webFrame.registerEmbedderCustomElement 'webview',
|
window.WebView = webFrame.registerEmbedderCustomElement 'webview',
|
||||||
|
|
Loading…
Reference in a new issue