Don't set contentWindow property for <webview>
This property is only available in Chrome and we don't need it in atom-shell, so remove it to avoid confusions. Fixes #997.
This commit is contained in:
parent
7ab5db1adb
commit
b4cdb546fe
4 changed files with 5 additions and 24 deletions
|
@ -115,9 +115,8 @@ destroyGuest = (id) ->
|
||||||
ipc.on 'ATOM_SHELL_GUEST_VIEW_MANAGER_CREATE_GUEST', (event, type, params, requestId) ->
|
ipc.on 'ATOM_SHELL_GUEST_VIEW_MANAGER_CREATE_GUEST', (event, type, params, requestId) ->
|
||||||
event.sender.send "ATOM_SHELL_RESPONSE_#{requestId}", createGuest(event.sender, params)
|
event.sender.send "ATOM_SHELL_RESPONSE_#{requestId}", createGuest(event.sender, params)
|
||||||
|
|
||||||
ipc.on 'ATOM_SHELL_GUEST_VIEW_MANAGER_ATTACH_GUEST', (event, elementInstanceId, guestInstanceId, params, requestId) ->
|
ipc.on 'ATOM_SHELL_GUEST_VIEW_MANAGER_ATTACH_GUEST', (event, elementInstanceId, guestInstanceId, params) ->
|
||||||
attachGuest event.sender, elementInstanceId, guestInstanceId, params
|
attachGuest event.sender, elementInstanceId, guestInstanceId, params
|
||||||
event.sender.send "ATOM_SHELL_RESPONSE_#{requestId}"
|
|
||||||
|
|
||||||
ipc.on 'ATOM_SHELL_GUEST_VIEW_MANAGER_DESTROY_GUEST', (event, id) ->
|
ipc.on 'ATOM_SHELL_GUEST_VIEW_MANAGER_DESTROY_GUEST', (event, id) ->
|
||||||
destroyGuest id
|
destroyGuest id
|
||||||
|
|
|
@ -45,10 +45,8 @@ module.exports =
|
||||||
ipc.send 'ATOM_SHELL_GUEST_VIEW_MANAGER_CREATE_GUEST', type, params, requestId
|
ipc.send 'ATOM_SHELL_GUEST_VIEW_MANAGER_CREATE_GUEST', type, params, requestId
|
||||||
ipc.once "ATOM_SHELL_RESPONSE_#{requestId}", callback
|
ipc.once "ATOM_SHELL_RESPONSE_#{requestId}", callback
|
||||||
|
|
||||||
attachGuest: (elementInstanceId, guestInstanceId, params, callback) ->
|
attachGuest: (elementInstanceId, guestInstanceId, params) ->
|
||||||
requestId++
|
ipc.send 'ATOM_SHELL_GUEST_VIEW_MANAGER_ATTACH_GUEST', elementInstanceId, guestInstanceId, params
|
||||||
ipc.send 'ATOM_SHELL_GUEST_VIEW_MANAGER_ATTACH_GUEST', elementInstanceId, guestInstanceId, params, requestId
|
|
||||||
ipc.once "ATOM_SHELL_RESPONSE_#{requestId}", callback
|
|
||||||
webFrame.attachGuest elementInstanceId
|
webFrame.attachGuest elementInstanceId
|
||||||
|
|
||||||
destroyGuest: (guestInstanceId) ->
|
destroyGuest: (guestInstanceId) ->
|
||||||
|
|
|
@ -22,8 +22,5 @@ module.exports =
|
||||||
ERROR_MSG_ALREADY_NAVIGATED: 'The object has already navigated, so its partition cannot be changed.'
|
ERROR_MSG_ALREADY_NAVIGATED: 'The object has already navigated, so its partition cannot be changed.'
|
||||||
ERROR_MSG_CANNOT_INJECT_SCRIPT: '<webview>: ' +
|
ERROR_MSG_CANNOT_INJECT_SCRIPT: '<webview>: ' +
|
||||||
'Script cannot be injected into content until the page has loaded.'
|
'Script cannot be injected into content until the page has loaded.'
|
||||||
ERROR_MSG_CONTENTWINDOW_NOT_AVAILABLE: '<webview>: ' +
|
|
||||||
'contentWindow is not available at this time. It will become available ' +
|
|
||||||
'when the page has finished loading.'
|
|
||||||
ERROR_MSG_INVALID_PARTITION_ATTRIBUTE: 'Invalid partition attribute.'
|
ERROR_MSG_INVALID_PARTITION_ATTRIBUTE: 'Invalid partition attribute.'
|
||||||
ERROR_MSG_INVALID_PRELOAD_ATTRIBUTE: 'Only "file:" or "asar:" protocol is supported in "preload" attribute.'
|
ERROR_MSG_INVALID_PRELOAD_ATTRIBUTE: 'Only "file:" or "asar:" protocol is supported in "preload" attribute.'
|
||||||
|
|
|
@ -17,7 +17,6 @@ class WebViewImpl
|
||||||
@elementAttached = false
|
@elementAttached = false
|
||||||
|
|
||||||
@beforeFirstNavigation = true
|
@beforeFirstNavigation = true
|
||||||
@contentWindow = null
|
|
||||||
|
|
||||||
# on* Event handlers.
|
# on* Event handlers.
|
||||||
@on = {}
|
@on = {}
|
||||||
|
@ -26,7 +25,6 @@ class WebViewImpl
|
||||||
shadowRoot = @webviewNode.createShadowRoot()
|
shadowRoot = @webviewNode.createShadowRoot()
|
||||||
@setupWebViewAttributes()
|
@setupWebViewAttributes()
|
||||||
@setupFocusPropagation()
|
@setupFocusPropagation()
|
||||||
@setupWebviewNodeProperties()
|
|
||||||
|
|
||||||
@viewInstanceId = getNextId()
|
@viewInstanceId = getNextId()
|
||||||
|
|
||||||
|
@ -54,7 +52,6 @@ class WebViewImpl
|
||||||
@guestInstanceId = undefined
|
@guestInstanceId = undefined
|
||||||
@beforeFirstNavigation = true
|
@beforeFirstNavigation = true
|
||||||
@attributes[webViewConstants.ATTRIBUTE_PARTITION].validPartitionId = true
|
@attributes[webViewConstants.ATTRIBUTE_PARTITION].validPartitionId = true
|
||||||
@contentWindow = null
|
|
||||||
@internalInstanceId = 0
|
@internalInstanceId = 0
|
||||||
|
|
||||||
# Sets the <webview>.request property.
|
# Sets the <webview>.request property.
|
||||||
|
@ -75,16 +72,6 @@ class WebViewImpl
|
||||||
# Blur the BrowserPlugin when the <webview> loses focus.
|
# Blur the BrowserPlugin when the <webview> loses focus.
|
||||||
@browserPluginNode.blur()
|
@browserPluginNode.blur()
|
||||||
|
|
||||||
setupWebviewNodeProperties: ->
|
|
||||||
# We cannot use {writable: true} property descriptor because we want a
|
|
||||||
# dynamic getter value.
|
|
||||||
Object.defineProperty @webviewNode, 'contentWindow',
|
|
||||||
get: =>
|
|
||||||
return @contentWindow if @contentWindow?
|
|
||||||
window.console.error webViewConstants.ERROR_MSG_CONTENTWINDOW_NOT_AVAILABLE
|
|
||||||
# No setter.
|
|
||||||
enumerable: true
|
|
||||||
|
|
||||||
# This observer monitors mutations to attributes of the <webview> and
|
# This observer monitors mutations to attributes of the <webview> and
|
||||||
# updates the BrowserPlugin properties accordingly. In turn, updating
|
# updates the BrowserPlugin properties accordingly. In turn, updating
|
||||||
# a BrowserPlugin property will update the corresponding BrowserPlugin
|
# a BrowserPlugin property will update the corresponding BrowserPlugin
|
||||||
|
@ -104,7 +91,7 @@ class WebViewImpl
|
||||||
|
|
||||||
return unless @guestInstanceId
|
return unless @guestInstanceId
|
||||||
|
|
||||||
guestViewInternal.attachGuest @internalInstanceId, @guestInstanceId, @buildAttachParams(), (w) => @contentWindow = w
|
guestViewInternal.attachGuest @internalInstanceId, @guestInstanceId, @buildAttachParams()
|
||||||
|
|
||||||
onSizeChanged: (webViewEvent) ->
|
onSizeChanged: (webViewEvent) ->
|
||||||
newWidth = webViewEvent.newWidth
|
newWidth = webViewEvent.newWidth
|
||||||
|
@ -189,7 +176,7 @@ class WebViewImpl
|
||||||
|
|
||||||
return true unless @internalInstanceId
|
return true unless @internalInstanceId
|
||||||
|
|
||||||
guestViewInternal.attachGuest @internalInstanceId, @guestInstanceId, params, (w) => @contentWindow = w
|
guestViewInternal.attachGuest @internalInstanceId, @guestInstanceId, params
|
||||||
|
|
||||||
# Registers browser plugin <object> custom element.
|
# Registers browser plugin <object> custom element.
|
||||||
registerBrowserPluginElement = ->
|
registerBrowserPluginElement = ->
|
||||||
|
|
Loading…
Add table
Reference in a new issue