spec: No node integration in iframe

This commit is contained in:
Cheng Zhao 2015-01-21 17:05:19 -08:00
parent ef15b670a9
commit 7210f6e64d
2 changed files with 23 additions and 0 deletions

View file

@ -65,3 +65,19 @@ describe 'chromium feature', ->
assert.equal event.data, message
done()
worker.port.postMessage message
describe 'iframe', ->
iframe = null
beforeEach ->
iframe = document.createElement 'iframe'
afterEach ->
document.body.removeChild iframe
it 'does not have node integration', (done) ->
iframe.src = "file://#{fixtures}/pages/set-global.html"
document.body.appendChild iframe
iframe.onload = ->
assert.equal iframe.contentWindow.test, 'undefined undefined undefined'
done()

7
spec/fixtures/pages/set-global.html vendored Normal file
View file

@ -0,0 +1,7 @@
<html>
<body>
<script type="text/javascript" charset="utf-8">
window.test = [typeof require, typeof module, typeof process].join(' ')
</script>
</body>
</html>