style-src-error-event-fires.html (914B)
1 <!doctype html> 2 <html> 3 <head> 4 <meta http-equiv="Content-Security-Policy" content="style-src 'none';"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 8 <script> 9 function styleError(t) { 10 t.done(); 11 } 12 13 function styleLoad(t) { 14 t.unreached_func("Should not be able to load style"); 15 } 16 17 var t1 = async_test("Test error event fires on stylesheet link"); 18 var t2 = async_test("Test error event fires on inline style") 19 </script> 20 21 </head> 22 <body> 23 <div id='log'></div> 24 25 <div id="content">Lorem ipsum</div> 26 27 <link onerror="styleError(t1)" onload="styleLoad(t1)" href="/content-security-policy/style-src/resources/style-src.css" rel=stylesheet type=text/css> 28 29 <style onerror="styleError(t2)" onload="styleLoad(t2)"> 30 #content { margin-left: 2px; } 31 </style> 32 33 </body> 34 </html>