Index: LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylehash-basic-blocked-error-event.html |
diff --git a/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylehash-basic-blocked-error-event.html b/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylehash-basic-blocked-error-event.html |
index 893518e4f8358a5dac609aeb04b12f8415001309..21575e9c1c5385f20253afd4a271677c9a218536 100644 |
--- a/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylehash-basic-blocked-error-event.html |
+++ b/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylehash-basic-blocked-error-event.html |
@@ -15,5 +15,51 @@ |
<style>p { color: green; }</style> |
<style onerror="styleError();">p { color: red; }</style> |
</head> |
+ <script> |
+ function verifyStep1() { |
+ var color = window.getComputedStyle(document.querySelector('p')).color; |
+ assert_equals(color, "rgb(0, 128, 0)", "The color of the paragraph is still green after initial style."); |
+ } |
+ |
+ function setupStep2() { |
+ var sty = document.createElement("style"); |
+ sty.innerHTML = "p { color: red; }"; |
+ sty.onerror = styleError; |
+ document.body.appendChild(sty); |
+ } |
+ function verifyStep2() { |
+ var color = window.getComputedStyle(document.querySelector('p')).color; |
+ assert_equals(color, "rgb(0, 128, 0)", "The color of the paragraph is still green after inserted style."); |
+ } |
+ |
+ function setupStep3() { |
+ var e = document.getElementById('style1'); |
+ e.innerHTML = "p { color: blue; }"; |
+ } |
+ function verifyStep3() { |
+ var color = window.getComputedStyle(document.querySelector('p')).color; |
+ assert_equals(color, "rgb(0, 128, 0)", "The color of the paragraph is still green after changing style."); |
+ test.done(); |
+ } |
+ |
+ var verifySteps = [ verifyStep1, verifyStep2, verifyStep3 ]; |
+ var setupSteps = [ setupStep2, setupStep3 ]; |
+ |
+ var test = async_test("Test that paragraph remains green and error events received."); |
+ |
+ function styleError() { |
+ test.step(function() { |
+ verifySteps.shift()(); |
+ var nextSetup = setupSteps.shift(); |
+ if (nextSetup) |
+ nextSetup(); |
+ }); |
+ } |
+ </script> |
+</head> |
+<body> |
+ <style>p { color: green; }</style> |
+ <style id="style1" onerror="styleError();">p { color: red; }</style> |
<p>A test paragraph</p> |
+</body> |
</html> |