Ensure that window.open does not override the child options

Fixes https://github.com/atom/electron/issues/3652.
This commit is contained in:
Jeff Wear 2015-12-02 11:54:52 -08:00
parent 32e949efed
commit 225fe72d03
2 changed files with 10 additions and 1 deletions

View file

@ -5,7 +5,7 @@ frameToGuest = {}
# Copy attribute of |parent| to |child| if it is not defined in |child|. # Copy attribute of |parent| to |child| if it is not defined in |child|.
mergeOptions = (child, parent) -> mergeOptions = (child, parent) ->
for own key, value of parent when key not in child for own key, value of parent when key not in Object.keys child
if typeof value is 'object' if typeof value is 'object'
child[key] = mergeOptions {}, value child[key] = mergeOptions {}, value
else else

View file

@ -82,6 +82,15 @@ describe 'chromium feature', ->
window.addEventListener 'message', listener window.addEventListener 'message', listener
b = window.open "file://#{fixtures}/pages/window-open-size.html", '', 'show=no' b = window.open "file://#{fixtures}/pages/window-open-size.html", '', 'show=no'
it 'does not override child options', (done) ->
size = {width: 350, height: 450}
listener = (event) ->
assert.equal event.data, "size: #{size.width} #{size.height}"
b.close()
done()
window.addEventListener 'message', listener
b = window.open "file://#{fixtures}/pages/window-open-size.html", '', "show=no,width=#{size.width},height=#{size.height}"
describe 'window.opener', -> describe 'window.opener', ->
@timeout 10000 @timeout 10000