]> khamidou — GitHub mirrors - electron.git/commitdiff
spec: No node integration in iframe
authorCheng Zhao <zcbenz@gmail.com>
Thu, 22 Jan 2015 01:05:19 +0000 (17:05 -0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 22 Jan 2015 01:05:19 +0000 (17:05 -0800)
spec/chromium-spec.coffee
spec/fixtures/pages/set-global.html [new file with mode: 0644]

index 5899f9260434c6f2368ae009d44f097925ff3e9b..d433672cb2e857782cab1d5e942a9042c532e0d6 100644 (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()
diff --git a/spec/fixtures/pages/set-global.html b/spec/fixtures/pages/set-global.html
new file mode 100644 (file)
index 0000000..70d7cdc
--- /dev/null
@@ -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>