Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylehash-svg-style-basic-blocked-error-event.html

Issue 1049513003: Add error dispatch events to SVGStyleElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Nits Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylehash-svg-style-basic-blocked-error-event.html
diff --git a/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylehash-svg-style-basic-blocked-error-event.html b/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylehash-svg-style-basic-blocked-error-event.html
new file mode 100644
index 0000000000000000000000000000000000000000..772472494d10e0237ca08e23a5e5c3f42fa136f1
--- /dev/null
+++ b/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylehash-svg-style-basic-blocked-error-event.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>SVG Style element has error on bad style hash</title>
+ <meta http-equiv="Content-Security-Policy" content="style-src 'sha1-pfeR5wMA6np45oqDTP6Pj3tLpJo='">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <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 svg style.");
+ }
+
+ function setupStep2() {
+ var e = document.getElementById("svgelement");
+ var sty = document.createElementNS("http://www.w3.org/2000/svg", "style");
+ sty.innerHTML = "p { color: red; }";
+ sty.onerror = styleError;
+ e.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 svg 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 svg 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>
+ <svg id="svgelement" xmlns="http://www.w3.org/2000/svg" width="800" height="100">
+ <style>p { color: green; }</style>
+ <style id="style1" onerror="styleError();">p { color: red; }</style>
+ <p>A test paragraph</p>
+ </svg>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698