constructor: (@webviewNode) ->
v8Util.setHiddenValue @webviewNode, 'internal', this
@attached = false
- @pendingGuestCreation = false
@elementAttached = false
@beforeFirstNavigation = true
@dispatchEvent webViewEvent
createGuest: ->
- return if @pendingGuestCreation
params =
storagePartitionId: @attributes[webViewConstants.ATTRIBUTE_PARTITION].getValue()
guestViewInternal.createGuest 'webview', params, (guestInstanceId) =>
- @pendingGuestCreation = false
- unless @elementAttached
- guestViewInternal.destroyGuest guestInstanceId
- return
@attachWindow guestInstanceId
- @pendingGuestCreation = true
dispatchEvent: (webViewEvent) ->
@webviewNode.dispatchEvent webViewEvent