OLD | NEW |
1 This tests whether we correct parse various space characters in the sandbox attr
ibute.<br> | 1 This tests whether we correct parse various space characters in the sandbox attr
ibute.<br> |
2 <script> | 2 <script> |
3 var testCases = [ | 3 var testCases = [ |
4 [' ', 'PASS: Space is a delimiter character.'], | 4 [' ', 'PASS: Space is a delimiter character.'], |
5 ['\t', 'PASS: Tab is a delimiter.'], | 5 ['\t', 'PASS: Tab is a delimiter.'], |
6 ['x', 'FAIL: x is not a delimiter.'], | 6 ['x', 'FAIL: x is not a delimiter.'], |
7 ['\r', 'PASS: Return is a delimiter.'], | 7 ['\r', 'PASS: Return is a delimiter.'], |
8 ['\n', 'PASS: Newline is a delimiter.'], | 8 ['\n', 'PASS: Newline is a delimiter.'], |
9 ['\v', 'FAIL: Vertical tab is not a delimiter.'], | 9 ['\v', 'FAIL: Vertical tab is not a delimiter.'], |
10 ['\f', 'PASS: Form feed is a delimiter.'], | 10 ['\f', 'PASS: Form feed is a delimiter.'], |
11 ] | 11 ] |
12 | 12 |
13 function next() { | 13 function next() { |
14 if (testCases.length) { | 14 if (testCases.length) { |
15 var testCase = testCases.pop(); | 15 var testCase = testCases.pop(); |
16 testCharacter.apply(null, testCase); | 16 testCharacter.apply(null, testCase); |
17 return; | 17 return; |
18 } | 18 } |
19 | 19 |
20 if (window.testRunner) | 20 if (window.testRunner) |
21 testRunner.notifyDone(); | 21 testRunner.notifyDone(); |
22 } | 22 } |
23 | 23 |
24 function testCharacter(possibleDelimiter, message) { | 24 function testCharacter(possibleDelimiter, message) { |
25 var policy = "allow-scripts" + possibleDelimiter + "allow-forms"; | 25 var policy = "allow-scripts" + possibleDelimiter + "allow-forms"; |
26 var iframe = document.createElement('iframe'); | 26 var iframe = document.createElement('iframe'); |
27 iframe.sandbox = policy; | 27 iframe.sandbox = policy; |
28 iframe.src = "data:text/html,<script>alert('" + message + "');<\/script>"; | 28 iframe.src = "data:text/html,<script>console.log('" + message + "');<\/scrip
t>"; |
29 iframe.onload = next; | 29 iframe.onload = next; |
30 document.body.appendChild(iframe); | 30 document.body.appendChild(iframe); |
31 } | 31 } |
32 | 32 |
33 if (window.testRunner) { | 33 if (window.testRunner) { |
34 testRunner.dumpAsText(); | 34 testRunner.dumpAsText(); |
35 testRunner.waitUntilDone(); | 35 testRunner.waitUntilDone(); |
36 } | 36 } |
37 | 37 |
38 next(); | 38 next(); |
39 | 39 |
40 </script> | 40 </script> |
OLD | NEW |