Merge pull request #3670 from mixmaxhq/jeff/fix_window_open
Fix `window.open` not respecting the features string
This commit is contained in:
Коммит
504d3d3088
|
@ -5,7 +5,7 @@ frameToGuest = {}
|
|||
|
||||
# Copy attribute of |parent| to |child| if it is not defined in |child|.
|
||||
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'
|
||||
child[key] = mergeOptions {}, value
|
||||
else
|
||||
|
|
|
@ -75,13 +75,22 @@ describe 'chromium feature', ->
|
|||
|
||||
it 'inherit options of parent window', (done) ->
|
||||
listener = (event) ->
|
||||
size = remote.getCurrentWindow().getSize()
|
||||
assert.equal event.data, "size: #{size.width} #{size.height}"
|
||||
[width, height] = remote.getCurrentWindow().getSize()
|
||||
assert.equal event.data, "size: #{width} #{height}"
|
||||
b.close()
|
||||
done()
|
||||
window.addEventListener 'message', listener
|
||||
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', ->
|
||||
@timeout 10000
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var size = require('electron').remote.getCurrentWindow().getSize();
|
||||
window.opener.postMessage('size: ' + size.width + ' ' + size.height, '*')
|
||||
window.opener.postMessage('size: ' + size[0] + ' ' + size[1], '*')
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Загрузка…
Ссылка в новой задаче