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

Side by Side Diff: LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylehash-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, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylehash-basic-blocked-error-event-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylehash-basic-blocked-error-event-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698