summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/websockets/constructor/002.html
blob: 94015979b0a19d1dbb76f15a8347e408ab0061a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!doctype html>
<title>WebSockets: new WebSocket(invalid url)</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../constants.js?pipe=sub></script>
<meta name="variant" content="">
<meta name="variant" content="?wss">
<div id=log></div>
<script>
test(function() {assert_throws("SyntaxError", function(){new WebSocket("/test")})});
test(function() {assert_throws("SyntaxError", function(){new WebSocket("ws://foo bar.com/")})});
test(function() {assert_throws("SyntaxError", function(){new WebSocket("wss://foo bar.com/")})});
test(function() {assert_throws("SyntaxError", function(){new WebSocket("http://"+location.host+"/")})});
test(function() {assert_throws("SyntaxError", function(){new WebSocket("mailto:example@example.org")})});
test(function() {assert_throws("SyntaxError", function(){new WebSocket("about:blank")})});
test(function() {assert_throws("SyntaxError", function(){new WebSocket(SCHEME_DOMAIN_PORT+"/#")})});
test(function() {assert_throws("SyntaxError", function(){new WebSocket(SCHEME_DOMAIN_PORT+"/#test")})});
test(function() {assert_throws("SyntaxError", function(){new WebSocket("?test")})});
test(function() {assert_throws("SyntaxError", function(){new WebSocket("#test")})});
</script>