]> khamidou — GitHub mirrors - electron.git/commitdiff
Update specs with new sandbox setting.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 10 Mar 2014 14:42:03 +0000 (22:42 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 10 Mar 2014 14:42:03 +0000 (22:42 +0800)
spec/chromium-spec.coffee

index 91461a3e00a23ec4800fb781092f1227931b1762..f9be63079eafe1377d19f757df3260b5c9163be4 100644 (file)
@@ -25,12 +25,14 @@ describe 'chromium feature', ->
       assert.equal b.constructor.name, 'BrowserWindow'
       b.destroy()
 
-  describe 'iframe with sandbox attribute', ->
-    it 'can not modify parent', (done) ->
-      page = path.join fixtures, 'pages', 'change-parent.html'
+  describe 'iframe', ->
+    page = path.join fixtures, 'pages', 'change-parent.html'
+
+    beforeEach ->
       global.changedByIframe = false
 
-      iframe = $('<iframe sandbox="allow-scripts">')
+    it 'can not modify parent by default', (done) ->
+      iframe = $('<iframe>')
       iframe.hide()
       iframe.attr 'src', "file://#{page}"
       iframe.appendTo 'body'
@@ -39,3 +41,14 @@ describe 'chromium feature', ->
         assert.equal global.changedByIframe, false
         done()
       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