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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/eventsource/eventsource-constructor.html

Issue 2456013002: CSP: 'connect-src' should not cause exceptions. (Closed)
Patch Set: Ugh. Created 3 years, 9 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
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <meta http-equiv="Content-Security-Policy" content="connect-src http://inval id http://127.0.0.1"> 3 <meta http-equiv="Content-Security-Policy" content="connect-src http://inval id http://127.0.0.1">
4 </head> 4 </head>
5 <body> 5 <body>
6 <p>Test EventSource constructor functionality. Should print a series of PASS mes sages followed by DONE.</p> 6 <p>Test EventSource constructor functionality. Should print a series of PASS mes sages followed by DONE.</p>
7 <div id="result"></div> 7 <div id="result"></div>
8 <script> 8 <script>
9 function log(msg) { 9 function log(msg) {
10 document.getElementById("result").innerHTML += msg + "<br>"; 10 document.getElementById("result").innerHTML += msg + "<br>";
(...skipping 20 matching lines...) Expand all
31 31
32 try { 32 try {
33 new EventSource("http://webserver:eighty/"); 33 new EventSource("http://webserver:eighty/");
34 log("FAIL: no exception when passing an invalid URL to the EventSource const ructor"); 34 log("FAIL: no exception when passing an invalid URL to the EventSource const ructor");
35 } catch (e) { 35 } catch (e) {
36 log("PASS: passing an invalid URL to the EventSource constructor resulted in an exception (" + e + ")"); 36 log("PASS: passing an invalid URL to the EventSource constructor resulted in an exception (" + e + ")");
37 } 37 }
38 38
39 try { 39 try {
40 new EventSource("http://disallowed.example.com/"); 40 new EventSource("http://disallowed.example.com/");
41 log("FAIL: no exception when passing an URL blocked by Content Security Poli cy to the EventSource constructor"); 41 log("PASS: no exception when passing an URL blocked by Content Security Poli cy to the EventSource constructor");
42 } catch (e) { 42 } catch (e) {
43 log("PASS: passing a Content-Security-Policy-blocked URL to the EventSource constructor resulted in an exception (" + e + ")"); 43 log("FAIL: passing a Content-Security-Policy-blocked URL to the EventSource constructor resulted in an exception (" + e + ")");
44 } 44 }
45 45
46 try { 46 try {
47 var es = new EventSource("http://127.0.0.1/", {"withCredentials": false}); 47 var es = new EventSource("http://127.0.0.1/", {"withCredentials": false});
48 es.close(); 48 es.close();
49 if (!es.withCredentials) { 49 if (!es.withCredentials) {
50 log("PASS: no exception when passing a second argument to the EventSourc e constructor"); 50 log("PASS: no exception when passing a second argument to the EventSourc e constructor");
51 log("DONE"); 51 log("DONE");
52 } else 52 } else
53 log("FAIL: the 'withCredentials' property is unexpectedly true"); 53 log("FAIL: the 'withCredentials' property is unexpectedly true");
54 } catch (e) { 54 } catch (e) {
55 log("FAIL: passing a second argument to the EventSource constructor resulted in an exception (" + e + ")"); 55 log("FAIL: passing a second argument to the EventSource constructor resulted in an exception (" + e + ")");
56 } 56 }
57 57
58 if (window.testRunner) 58 if (window.testRunner)
59 testRunner.notifyDone(); 59 testRunner.notifyDone();
60 60
61 </script> 61 </script>
62 </body> 62 </body>
63 </html> 63 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698