Don't try to connect to "ws://"+location.host+"/" in WebSocket tests.

This will connect on port 80, which is not typically under the control of the
wpt server.
This commit is contained in:
Ms2ger 2015-06-11 20:11:50 +02:00
parent 6b886e545d
commit e8d691aa03
7 changed files with 512 additions and 16 deletions

View file

@ -6,18 +6,28 @@
<div id=log></div>
<script>
// empty string
test(function() {assert_throws("SyntaxError", function(){new WebSocket("ws://"+location.host+"/", "")})});
test(function() {
assert_throws("SyntaxError", function() {
new WebSocket(SCHEME_DOMAIN_PORT + '/empty-message', "")
})
});
// chars below U+0020 except U+0000; U+0000 is tested in a separate test
for (var i = 1; i < 0x20; ++i) {
test(function() {
assert_throws("SyntaxError", function(){new WebSocket("ws://"+location.host+"/", "a"+String.fromCharCode(i)+"b")}, 'char code '+i);
})
test(function() {
assert_throws("SyntaxError", function() {
new WebSocket(SCHEME_DOMAIN_PORT + '/empty-message',
"a"+String.fromCharCode(i)+"b")
}, 'char code '+i);
})
}
// some chars above U+007E
for (var i = 0x7F; i < 0x100; ++i) {
test(function() {
assert_throws("SyntaxError", function(){new WebSocket("ws://"+location.host+"/", "a"+String.fromCharCode(i)+"b")}, 'char code '+i);
})
test(function() {
assert_throws("SyntaxError", function() {
new WebSocket(SCHEME_DOMAIN_PORT + '/empty-message',
"a"+String.fromCharCode(i)+"b")
}, 'char code '+i);
})
}
</script>