Commit e3aa6108 authored by Antonio Sartori's avatar Antonio Sartori Committed by Chromium LUCI CQ

CSP: Fix asserted violatedDirective in WPT CSP report

Some Web Platform Tests for Content Security Policy were wrongly
expecting the violated directives of CSP reports for CSS styles to be
'style-src' instead of 'style-src-attr' and 'style-src-elem'. This
change fixes that.

Bug: 694525, 651742
Change-Id: Id13f697eaf8ed72fba1e56eb7b0f7ac2a5837408
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2580810
Commit-Queue: Antonio Sartori <antoniosartori@chromium.org>
Reviewed-by: default avatarArthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835608}
parent dfc20cf1
...@@ -1897,8 +1897,6 @@ crbug.com/694525 external/wpt/content-security-policy/navigation/to-javascript-p ...@@ -1897,8 +1897,6 @@ crbug.com/694525 external/wpt/content-security-policy/navigation/to-javascript-p
crbug.com/694525 external/wpt/content-security-policy/form-action/form-action-src-redirect-blocked.sub.html [ Skip ] crbug.com/694525 external/wpt/content-security-policy/form-action/form-action-src-redirect-blocked.sub.html [ Skip ]
crbug.com/694525 external/wpt/content-security-policy/script-src/worker-importscripts-blocked.sub.html [ Skip ] crbug.com/694525 external/wpt/content-security-policy/script-src/worker-importscripts-blocked.sub.html [ Skip ]
crbug.com/694525 external/wpt/content-security-policy/script-src/worker-set-timeout-blocked.sub.html [ Skip ] crbug.com/694525 external/wpt/content-security-policy/script-src/worker-set-timeout-blocked.sub.html [ Skip ]
crbug.com/694525 external/wpt/content-security-policy/style-src/inline-style-allowed-while-cloning-objects.sub.html [ Skip ]
crbug.com/694525 external/wpt/content-security-policy/style-src/style-blocked.sub.html [ Skip ]
crbug.com/694525 external/wpt/content-security-policy/unsafe-eval/eval-blocked-in-about-blank-iframe.sub.html [ Skip ] crbug.com/694525 external/wpt/content-security-policy/unsafe-eval/eval-blocked-in-about-blank-iframe.sub.html [ Skip ]
# These tests will be added back soon: # These tests will be added back soon:
......
This is a testharness.js-based test.
PASS Test that violation report event was fired
PASS inline-style-allowed-while-cloning-objects
PASS inline-style-allowed-while-cloning-objects 1
PASS inline-style-allowed-while-cloning-objects 2
PASS inline-style-allowed-while-cloning-objects 3
PASS inline-style-allowed-while-cloning-objects 4
PASS inline-style-allowed-while-cloning-objects 5
PASS inline-style-allowed-while-cloning-objects 6
PASS inline-style-allowed-while-cloning-objects 7
PASS inline-style-allowed-while-cloning-objects 8
PASS inline-style-allowed-while-cloning-objects 9
PASS inline-style-allowed-while-cloning-objects 10
PASS inline-style-allowed-while-cloning-objects 11
PASS inline-style-allowed-while-cloning-objects 12
PASS inline-style-allowed-while-cloning-objects 13
PASS inline-style-allowed-while-cloning-objects 14
PASS inline-style-allowed-while-cloning-objects 15
PASS inline-style-allowed-while-cloning-objects 16
PASS inline-style-allowed-while-cloning-objects 17
FAIL inline-style-allowed-while-cloning-objects 18 assert_equals: expected "rgb(238, 130, 238) none repeat scroll 0% 0% / auto padding-box border-box" but got "rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box"
FAIL inline-style-allowed-while-cloning-objects 19 assert_equals: expected "rgb(238, 130, 238) none repeat scroll 0% 0% / auto padding-box border-box" but got "rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box"
PASS inline-style-allowed-while-cloning-objects 20
PASS inline-style-allowed-while-cloning-objects 21
FAIL non-HTML namespace assert_equals: expected "" but got "background: rgb(238, 130, 238)"
Harness: the test ran to completion.
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
var t = async_test("Test that violation report event was fired"); var t = async_test("Test that violation report event was fired");
window.addEventListener("securitypolicyviolation", t.step_func_done(function(e) { window.addEventListener("securitypolicyviolation", t.step_func_done(function(e) {
assert_equals(e.violatedDirective, "style-src"); assert_equals(e.violatedDirective, "style-src-attr");
})); }));
window.onload = function() { window.onload = function() {
try { try {
......
This is a testharness.js-based test.
FAIL Expecting logs: ["violated-directive=style-src-elem","PASS"] assert_unreached: FAIL Reached unreachable code
Harness: the test ran to completion.
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<title>style-blocked</title> <title>style-blocked</title>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src='../support/logTest.sub.js?logs=["violated-directive=style-src","PASS"]'></script> <script src='../support/logTest.sub.js?logs=["violated-directive=style-src-elem","PASS"]'></script>
<script src="../support/alertAssert.sub.js?alerts=[]"></script> <script src="../support/alertAssert.sub.js?alerts=[]"></script>
<script> <script>
window.addEventListener('securitypolicyviolation', function(e) { window.addEventListener('securitypolicyviolation', function(e) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment