| OLD | NEW | 
|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> | 
| 2 <html> | 2 <html> | 
| 3 <head> | 3 <head> | 
| 4     <title>Style element has error on bad style hash</title> | 4     <title>Style element has error on bad style hash</title> | 
| 5     <meta http-equiv="Content-Security-Policy" content="style-src 'sha1-pfeR5wMA
    6np45oqDTP6Pj3tLpJo='"> | 5     <meta http-equiv="Content-Security-Policy" content="style-src 'sha1-pfeR5wMA
    6np45oqDTP6Pj3tLpJo='"> | 
| 6     <script src="/resources/testharness.js"></script> | 6     <script src="/resources/testharness.js"></script> | 
| 7     <script src="/resources/testharnessreport.js"></script> | 7     <script src="/resources/testharnessreport.js"></script> | 
| 8     <script> | 8     <script> | 
| 9         function styleError() { | 9         function styleError() { | 
| 10             var color = window.getComputedStyle(document.querySelector('p')).col
    or; | 10             var color = window.getComputedStyle(document.querySelector('p')).col
    or; | 
| 11             assert_equals(color, "rgb(0, 128, 0)", "The color of the paragraph i
    s still green."); | 11             assert_equals(color, "rgb(0, 128, 0)", "The color of the paragraph i
    s still green."); | 
| 12             done(); | 12             done(); | 
| 13         } | 13         } | 
| 14     </script> | 14     </script> | 
| 15     <style>p { color: green; }</style> | 15     <style>p { color: green; }</style> | 
| 16     <style onerror="styleError();">p { color: red; }</style> | 16     <style onerror="styleError();">p { color: red; }</style> | 
| 17 </head> | 17 </head> | 
|  | 18     <script> | 
|  | 19         function verifyStep1() { | 
|  | 20             var color = window.getComputedStyle(document.querySelector('p')).col
    or; | 
|  | 21             assert_equals(color, "rgb(0, 128, 0)", "The color of the paragraph i
    s still green after initial style."); | 
|  | 22         } | 
|  | 23 | 
|  | 24         function setupStep2() { | 
|  | 25             var sty = document.createElement("style"); | 
|  | 26             sty.innerHTML = "p { color: red; }"; | 
|  | 27             sty.onerror = styleError; | 
|  | 28             document.body.appendChild(sty); | 
|  | 29         } | 
|  | 30         function verifyStep2() { | 
|  | 31             var color = window.getComputedStyle(document.querySelector('p')).col
    or; | 
|  | 32             assert_equals(color, "rgb(0, 128, 0)", "The color of the paragraph i
    s still green after inserted style."); | 
|  | 33         } | 
|  | 34 | 
|  | 35         function setupStep3() { | 
|  | 36             var e = document.getElementById('style1'); | 
|  | 37             e.innerHTML = "p { color: blue; }"; | 
|  | 38         } | 
|  | 39         function verifyStep3() { | 
|  | 40             var color = window.getComputedStyle(document.querySelector('p')).col
    or; | 
|  | 41             assert_equals(color, "rgb(0, 128, 0)", "The color of the paragraph i
    s still green after changing style."); | 
|  | 42             test.done(); | 
|  | 43         } | 
|  | 44 | 
|  | 45         var verifySteps = [ verifyStep1, verifyStep2, verifyStep3 ]; | 
|  | 46         var setupSteps = [ setupStep2, setupStep3 ]; | 
|  | 47 | 
|  | 48         var test = async_test("Test that paragraph remains green and error event
    s received."); | 
|  | 49 | 
|  | 50         function styleError() { | 
|  | 51             test.step(function() { | 
|  | 52                 verifySteps.shift()(); | 
|  | 53                 var nextSetup = setupSteps.shift(); | 
|  | 54                 if (nextSetup) | 
|  | 55                     nextSetup(); | 
|  | 56             }); | 
|  | 57         } | 
|  | 58     </script> | 
|  | 59 </head> | 
|  | 60 <body> | 
|  | 61     <style>p { color: green; }</style> | 
|  | 62     <style id="style1" onerror="styleError();">p { color: red; }</style> | 
| 18     <p>A test paragraph</p> | 63     <p>A test paragraph</p> | 
|  | 64 </body> | 
| 19 </html> | 65 </html> | 
| OLD | NEW | 
|---|