Crash at com.apple.WebCore: -[WebRevealHighlight revealContext:drawRectsForItem:]
[WebKit-https.git] / LayoutTests / http / wpt / beacon / connect-src-beacon-blocked.sub.html
1 <!DOCTYPE html>
2 <meta http-equiv="Content-Security-Policy" content="connect-src 'self'">
3 <script src="/resources/testharness.js"></script>
4 <script src="/resources/testharnessreport.js"></script>
5 <script>
6     async_test(t => {
7       document.addEventListener("securitypolicyviolation", t.step_func_done(e => {
8         if (e.blockedURI != "http://{{domains[www]}}:{{ports[http][0]}}/common/text-plain.txt")
9             return;
10
11         assert_equals(e.violatedDirective, "connect-src");
12       }));
13
14       assert_true(navigator.sendBeacon("http://{{domains[www]}}:{{ports[http][0]}}/common/text-plain.txt"));
15     }, "sendBeacon should not throw.");
16
17     async_test(t => {
18       document.addEventListener("securitypolicyviolation", t.step_func_done(e => {
19         if (e.blockedURI != "http://{{domains[www]}}:{{ports[http][0]}}/common/text-plain.txt")
20             return;
21
22         assert_equals(e.violatedDirective, "connect-src");
23       }));
24
25       assert_true(navigator.sendBeacon("common/redirect-opt-in.py?status=307&location=http://{{domains[www]}}:{{ports[http][0]}}/common/text-plain.txt"));
26     }, "redirect case");
27 </script>