file_websocket_csp_upgrade.html (714B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Bug 1729897: Allow unsecure websocket from localhost page with CSP: upgrade-insecure </title> 6 <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> 7 </head> 8 <body> 9 <script type="application/javascript"> 10 /* load socket using ws */ 11 var wsSocket = new WebSocket("ws://localhost/tests/dom/security/test/csp/file_websocket_self"); 12 wsSocket.onopen = function(e) { 13 window.parent.postMessage({result: "self-ws-loaded", url: wsSocket.url}, "*"); 14 }; 15 wsSocket.onerror = function(e) { 16 window.parent.postMessage({result: "self-ws-blocked"}, "*"); 17 }; 18 </script> 19 </body> 20 </html>