OLD | NEW |
---|---|
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
Srirama
2016/08/10 06:59:47
html, head and body are optional elements, so you
sivag
2016/08/10 09:17:48
Done.
| |
3 <head> | 3 <head> |
4 <meta http-equiv="Content-Security-Policy" content="img-src 'self'"> | 4 <meta http-equiv="Content-Security-Policy" content="img-src 'self'"> |
5 <script src="../../resources/js-test.js"></script> | 5 <title>"This tests onerror event is fired if we change image src to a url blocke d by content-security-policy."</title> |
6 <script src="../../resources/testharness.js"></script> | |
7 <script src="../../resources/testharnessreport.js"></script> | |
6 <script> | 8 <script> |
7 description( | 9 async_test(function(t) { |
8 "This tests onerror event is fired if we change image src to a url blocked b y content-security-policy." | 10 var img = new Image(); |
9 ) | 11 img.onerror = t.step_func_done(function() { |
Srirama
2016/08/10 06:59:47
you can directly use t.step_func_done(), no need t
sivag
2016/08/10 09:17:48
Done.
| |
10 | 12 assert_true(true, "Test passed"); |
11 jsTestIsAsync = true; | 13 }); |
12 | 14 img.onload = t.step_func_done(function() { |
Srirama
2016/08/10 06:59:47
this isn't right, as the test will finish here and
sivag
2016/08/10 09:17:48
Done.
| |
13 function load() | 15 image.src = 'http://www.myfakesiteabc.com/image.png'; |
14 { | 16 }); |
15 var image = document.getElementById('test'); | 17 img.src = './color-jpeg-with-color-profile-expected.png'; |
16 image.onerror = function() { | 18 }); |
17 testPassed("error event fired."); | |
18 finishJSTest(); | |
19 }; | |
20 image.src = 'http://www.myfakesiteabc.com/image.png'; | |
21 | |
22 setTimeout(function() { | |
23 testFailed("error event is not fired.") | |
24 finishJSTest(); | |
25 }, 200); | |
26 } | |
27 </script> | 19 </script> |
28 | |
29 </head> | 20 </head> |
30 <body onload='load()'> | |
31 | |
32 <img src="./color-jpeg-with-color-profile-expected.png" id="test"></img> | |
33 | |
34 </body> | |
35 </html> | 21 </html> |
OLD | NEW |