OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 |
| 4 <head> |
| 5 <!-- Programmatically converted from a WebKit Reftest, please forgive result
ing idiosyncracies.--> |
| 6 <title>filesystem-urls-do-not-match-self</title> |
| 7 <script src="/resources/testharness.js"></script> |
| 8 <script src="/resources/testharnessreport.js"></script> |
| 9 <script src="../support/logTest.sub.js?logs=[]"></script> |
| 10 <script src="../support/alertAssert.sub.js?alerts=[]"></script> |
| 11 <!-- enforcing policy: |
| 12 script-src 'self' 'unsafe-inline' 'self'; connect-src 'self'; |
| 13 --> |
| 14 </head> |
| 15 |
| 16 <body> |
| 17 <p> |
| 18 filesystem: URLs are same-origin with the page in which they were create
d, but explicitly do not match the 'self' or '*' source in C
SP directives because they are more akin to 'unsafe-inline' content.. |
| 19 </p> |
| 20 <script> |
| 21 if(!window.webkitRequestFileSystem) { |
| 22 t_log = async_test(); |
| 23 t_log.set_status(t_log.NOTRUN, "No filesystem:// support, cannot run
test."); |
| 24 t_log.phase = t_log.phases.HAS_RESULT; |
| 25 t_log.done(); |
| 26 } else { |
| 27 function fail() { |
| 28 alert_assert("FAIL!"); |
| 29 } |
| 30 window.webkitRequestFileSystem( |
| 31 TEMPORARY, 1024 * 1024 /*1MB*/ , function(fs) { |
| 32 fs.root.getFile('fail.js', { |
| 33 create: true |
| 34 }, function(fileEntry) { |
| 35 fileEntry.createWriter(function(fileWriter) { |
| 36 fileWriter.onwriteend = function(e) { |
| 37 var script = document.createElement('script'); |
| 38 script.src = fileEntry.toURL('application/javasc
ript'); |
| 39 document.body.appendChild(script); |
| 40 }; |
| 41 // Create a new Blob and write it to pass.js. |
| 42 var b = new Blob(['fail();'], { |
| 43 type: 'application/javascript' |
| 44 }); |
| 45 fileWriter.write(b); |
| 46 }); |
| 47 }); |
| 48 }); |
| 49 var s = document.createElement('script'); |
| 50 s.async = true; |
| 51 s.defer = true; |
| 52 s.src = "../support/checkReport.sub.js?reportExists=true&reportF
ield=violated-directive&reportValue=script-src%20'self'%20'un
safe-inline'%20'*'" |
| 53 document.lastChild.appendChild(s); |
| 54 } |
| 55 |
| 56 |
| 57 </script> |
| 58 <div id="log"></div> |
| 59 |
| 60 </body> |
| 61 |
| 62 </html> |
OLD | NEW |