| Index: LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylenonce-basic-blocked-error-event.html
|
| diff --git a/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylenonce-basic-blocked-error-event.html b/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylenonce-basic-blocked-error-event.html
|
| index fe7117db59db25d8d6cda85f8539bf559091a8b2..50ae2ff22094a882bade4e457210585f0c401c0b 100644
|
| --- a/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylenonce-basic-blocked-error-event.html
|
| +++ b/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/stylenonce-basic-blocked-error-event.html
|
| @@ -6,14 +6,51 @@
|
| <script src="/resources/testharness.js"></script>
|
| <script src="/resources/testharnessreport.js"></script>
|
| <script>
|
| - function styleError() {
|
| + 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.nonce = "notavalidnonce";
|
| + 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.");
|
| - done();
|
| + 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>
|
| - <style nonce="nonceynonce">p { color: green; }</style>
|
| - <style nonce="notavalidnonce" onerror="styleError();">p { color: red; }</style>
|
| </head>
|
| +<body>
|
| + <style nonce="nonceynonce">p { color: green; }</style>
|
| + <style id="style1" nonce="notavalidnonce" onerror="styleError();">p { color: red; }</style>
|
| <p>A test paragraph</p>
|
| +</body>
|
| </html>
|
|
|