Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE HTML> | |
| 2 <meta http-equiv="Content-Security-Policy" content="img-src 'self' www.{{host}}: {{ports[http][0]}}"> | |
| 3 <html> | |
| 4 <head> | |
| 5 <title>img element src attribute must match src list.</title> | |
| 6 <script src='/resources/testharness.js'></script> | |
| 7 <script src='/resources/testharnessreport.js'></script> | |
| 8 </head> | |
| 9 <body> | |
| 10 <div id='log'/> | |
| 11 | |
| 12 <script> | |
| 13 var t1 = async_test("img-src for relative path should load."); | |
| 14 var t2 = async_test("img-src from unapproved domains should not load"); | |
| 15 var t3 = async_test("img-src from approved domains should load"); | |
| 16 </script> | |
| 17 | |
| 18 <img src='/content-security-policy/support/pass.png' | |
| 19 onload='t1.done();' | |
| 20 onerror='t1.step(function() { assert_unreached("The img should have loa ded."); t1.done() });'> | |
| 21 | |
| 22 | |
| 23 <img src='http://www1.web-platform.test/content-security-policy/support/fail .png' | |
| 24 onload='t2.step(function() { assert_unreached("Image from unapproved do main was loaded."); t2.done()} );' | |
| 25 onerror='t2.done();'> | |
| 26 | |
| 27 <div id='t3'></div> | |
| 28 <script> | |
| 29 var t3img = document.createElement('img'); | |
| 30 t3img.onload = function() {t3.done();} | |
| 31 t3img.onerror = function() {t3.step(function() { assert_unreached(); t3. done();})} | |
| 32 t3img.src = location.protocol + '//www.' + location.hostname + ':' + loc ation.port + | |
| 33 '/content-security-policy/support/pass.png'; | |
| 34 var t3div = document.getElementById('t3'); | |
| 35 t3div.appendChild(t3img); | |
| 36 </script> | |
| 37 </body> | |
| 38 </html> | |
|
Mike West
2017/03/22 11:56:22
As long as you're rewriting the test, I'd suggest
andypaicu
2017/03/23 09:22:10
done
| |
| OLD | NEW |