Update specs with new sandbox setting.
This commit is contained in:
parent
b96aee50e1
commit
31b08a3ec6
1 changed files with 17 additions and 4 deletions
|
@ -25,12 +25,14 @@ describe 'chromium feature', ->
|
||||||
assert.equal b.constructor.name, 'BrowserWindow'
|
assert.equal b.constructor.name, 'BrowserWindow'
|
||||||
b.destroy()
|
b.destroy()
|
||||||
|
|
||||||
describe 'iframe with sandbox attribute', ->
|
describe 'iframe', ->
|
||||||
it 'can not modify parent', (done) ->
|
page = path.join fixtures, 'pages', 'change-parent.html'
|
||||||
page = path.join fixtures, 'pages', 'change-parent.html'
|
|
||||||
|
beforeEach ->
|
||||||
global.changedByIframe = false
|
global.changedByIframe = false
|
||||||
|
|
||||||
iframe = $('<iframe sandbox="allow-scripts">')
|
it 'can not modify parent by default', (done) ->
|
||||||
|
iframe = $('<iframe>')
|
||||||
iframe.hide()
|
iframe.hide()
|
||||||
iframe.attr 'src', "file://#{page}"
|
iframe.attr 'src', "file://#{page}"
|
||||||
iframe.appendTo 'body'
|
iframe.appendTo 'body'
|
||||||
|
@ -39,3 +41,14 @@ describe 'chromium feature', ->
|
||||||
assert.equal global.changedByIframe, false
|
assert.equal global.changedByIframe, false
|
||||||
done()
|
done()
|
||||||
setTimeout isChanged, 30
|
setTimeout isChanged, 30
|
||||||
|
|
||||||
|
it 'can modify parent when sanbox is set to none', (done) ->
|
||||||
|
iframe = $('<iframe sandbox="none">')
|
||||||
|
iframe.hide()
|
||||||
|
iframe.attr 'src', "file://#{page}"
|
||||||
|
iframe.appendTo 'body'
|
||||||
|
isChanged = ->
|
||||||
|
iframe.remove()
|
||||||
|
assert.equal global.changedByIframe, true
|
||||||
|
done()
|
||||||
|
setTimeout isChanged, 30
|
||||||
|
|
Loading…
Add table
Reference in a new issue