test_bug1443344-2.html (1460B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1443344 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 1443344</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 <script type="application/javascript"> 12 13 /** Test for Bug 1443344 */ 14 SimpleTest.waitForExplicitFinish(); 15 16 var sheetURL = new URL("file_bug1443344.css", location.href); 17 sheetURL.protocol = "http"; 18 var link = document.createElement("link"); 19 link.href = `data:text/css,@import url("data:text/css,@import url('${sheetURL}');");` 20 link.rel = "stylesheet"; 21 var loadFired = false, errorFired = false; 22 link.onload = () => loadFired = true; 23 link.onerror = () => errorFired = true; 24 document.head.appendChild(link); 25 26 addLoadEvent(() => { 27 is(loadFired, false, "Should not fire onload for erroring @import"); 28 is(errorFired, true, "Should fire onerror for erroring @import"); 29 is(getComputedStyle($("importTarget")).color, "rgb(0, 255, 0)", 30 "Erroring sheet should not load"); 31 SimpleTest.finish(); 32 }); 33 34 </script> 35 <style> 36 #importTarget { color: rgb(0, 255, 0); } 37 </style> 38 </head> 39 <body> 40 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1443344">Mozilla Bug 1443344</a> 41 <p id="display"><div id="importTarget"></div></p> 42 <div id="content" style="display: none"> 43 44 </div> 45 <pre id="test"> 46 </pre> 47 </body> 48 </html>