| Index: third_party/WebKit/LayoutTests/external/wpt/content-security-policy/securitypolicyviolation/img-src-redirect-upgrade-reporting.https.html
|
| diff --git a/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/securitypolicyviolation/img-src-redirect-upgrade-reporting.https.html b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/securitypolicyviolation/img-src-redirect-upgrade-reporting.https.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..27611273babcfeb379d11c5fee16dc0fe004b636
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/securitypolicyviolation/img-src-redirect-upgrade-reporting.https.html
|
| @@ -0,0 +1,31 @@
|
| +<!doctype html>
|
| +<script src="/resources/testharness.js"></script>
|
| +<script src="/resources/testharnessreport.js"></script>
|
| +<script src="./support/testharness-helper.sub.js"></script>
|
| +<body></body>
|
| +<script>
|
| + function waitForViolation(el, t, policy, blocked_origin) {
|
| + return new Promise(resolve => {
|
| + el.addEventListener('securitypolicyviolation', e => {
|
| + if (e.originalPolicy == policy && (new URL(e.blockedURI)).origin == blocked_origin)
|
| + resolve(e);
|
| + else
|
| + t.unreached_func("Unexpected violation event for " + e.blockedURI)();
|
| + });
|
| + });
|
| + }
|
| +
|
| + async_test(t => {
|
| + var i = document.createElement("img");
|
| + var redirect = generateCrossOriginRedirectImage();
|
| + i.src = redirect.url;
|
| +
|
| + // Report-only policy should trigger a violation on the redirected request.
|
| + waitForViolation(window, t, "img-src https:", (new URL(redirect.target)).origin).then(t.step_func(e => {
|
| + t.done();
|
| + }));
|
| +
|
| + document.body.appendChild(i);
|
| + }, "Image that redirects to http:// URL prohibited by Report-Only must generate a violation report, even with upgrade-insecure-requests");
|
| +</script>
|
| +</html>
|
|
|