Add allowpopups attribute for webview
This commit is contained in:
parent
7c65d05b02
commit
f07fea1936
4 changed files with 5 additions and 1 deletions
|
@ -84,6 +84,8 @@ createGuest = (embedder, params) ->
|
|||
if params.allowtransparency?
|
||||
@setAllowTransparency params.allowtransparency
|
||||
|
||||
guest.allowPopups = params.allowpopups
|
||||
|
||||
# Dispatch events to embedder.
|
||||
for event in supportedWebViewEvents
|
||||
do (event) ->
|
||||
|
|
|
@ -41,7 +41,7 @@ createGuest = (embedder, url, frameName, options) ->
|
|||
ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', (event, args...) ->
|
||||
[url, frameName, options] = args
|
||||
event.sender.emit 'new-window', event, url, frameName, 'new-window'
|
||||
if event.sender.isGuest() or event.defaultPrevented
|
||||
if (event.sender.isGuest() and not event.sender.allowPopups) or event.defaultPrevented
|
||||
event.returnValue = null
|
||||
else
|
||||
event.returnValue = createGuest event.sender, args...
|
||||
|
|
|
@ -216,6 +216,7 @@ WebViewImpl::setupWebViewAttributes = ->
|
|||
@attributes[webViewConstants.ATTRIBUTE_NODEINTEGRATION] = new BooleanAttribute(webViewConstants.ATTRIBUTE_NODEINTEGRATION, this)
|
||||
@attributes[webViewConstants.ATTRIBUTE_PLUGINS] = new BooleanAttribute(webViewConstants.ATTRIBUTE_PLUGINS, this)
|
||||
@attributes[webViewConstants.ATTRIBUTE_DISABLEWEBSECURITY] = new BooleanAttribute(webViewConstants.ATTRIBUTE_DISABLEWEBSECURITY, this)
|
||||
@attributes[webViewConstants.ATTRIBUTE_ALLOWPOPUPS] = new BooleanAttribute(webViewConstants.ATTRIBUTE_ALLOWPOPUPS, this)
|
||||
@attributes[webViewConstants.ATTRIBUTE_PRELOAD] = new PreloadAttribute(this)
|
||||
|
||||
autosizeAttributes = [
|
||||
|
|
|
@ -13,6 +13,7 @@ module.exports =
|
|||
ATTRIBUTE_NODEINTEGRATION: 'nodeintegration'
|
||||
ATTRIBUTE_PLUGINS: 'plugins'
|
||||
ATTRIBUTE_DISABLEWEBSECURITY: 'disablewebsecurity'
|
||||
ATTRIBUTE_ALLOWPOPUPS: 'allowpopups'
|
||||
ATTRIBUTE_PRELOAD: 'preload'
|
||||
ATTRIBUTE_USERAGENT: 'useragent'
|
||||
|
||||
|
|
Loading…
Reference in a new issue