mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Auto merge of #9400 - jmr0:websocket, r=nox
Fixing websocket subprotocol header validation This takes care of https://github.com/servo/servo/issues/9034 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9400) <!-- Reviewable:end -->
This commit is contained in:
commit
e74021baaa
7 changed files with 109 additions and 38 deletions
|
@ -33316,7 +33316,22 @@
|
|||
},
|
||||
"local_changes": {
|
||||
"deleted": [],
|
||||
"items": {},
|
||||
"items": {
|
||||
"testharness": {
|
||||
"websockets/Create-asciiSep-protocol-string.htm": [
|
||||
{
|
||||
"path": "websockets/Create-asciiSep-protocol-string.htm",
|
||||
"url": "/websockets/Create-asciiSep-protocol-string.htm"
|
||||
}
|
||||
],
|
||||
"websockets/Create-protocols-repeated-case-insensitive.htm": [
|
||||
{
|
||||
"path": "websockets/Create-protocols-repeated-case-insensitive.htm",
|
||||
"url": "/websockets/Create-protocols-repeated-case-insensitive.htm"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"reftest_nodes": {}
|
||||
},
|
||||
"reftest_nodes": {
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>W3C WebSocket API - Create WebSocket - ascii protocol string with separator</title>
|
||||
<script type="text/javascript" src="/resources/testharness.js"></script>
|
||||
<script type="text/javascript" src="/resources/testharnessreport.js"></script>
|
||||
<script type="text/javascript" src="websocket.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
if(window.WebSocket) {
|
||||
test(function () {
|
||||
var asciiWithSep = "/echo";
|
||||
var wsocket;
|
||||
assert_throws("SYNTAX_ERR", function () { wsocket = CreateWebSocketWithAsciiSep(asciiWithSep) });
|
||||
}, "W3C WebSocket API - Create WebSocket - Pass a valid URL and a protocol string with an ascii separator character - SYNTAX_ERR is thrown")
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>W3C WebSocket API - Create WebSocket - repeated protocols with different case</title>
|
||||
<script type="text/javascript" src="/resources/testharness.js"></script>
|
||||
<script type="text/javascript" src="/resources/testharnessreport.js"></script>
|
||||
<script type="text/javascript" src="websocket.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
test(function () {
|
||||
var wsocket;
|
||||
assert_throws("SYNTAX_ERR", function () { wsocket = CreateWebSocketWithRepeatedProtocolsCaseInsensitive() });
|
||||
}, "W3C WebSocket API - Create WebSocket - Pass a valid URL and an array of protocol strings with repeated values but different case - SYNTAX_ERR is thrown")
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -8,6 +8,7 @@ var __CONTROLPATH = "control";
|
|||
var __PROTOCOL = "echo";
|
||||
var __PROTOCOLS = ["echo", "chat"];
|
||||
var __REPEATED__PROTOCOLS = ["echo", "echo"];
|
||||
var __REPEATED__PROTOCOLS_CASE_INSENSITIVE = ["echo", "eCho"];
|
||||
var __URL;
|
||||
var __IS__WEBSOCKET;
|
||||
var __PASS = "Pass";
|
||||
|
@ -47,6 +48,12 @@ function CreateWebSocketNonAsciiProtocol(nonAsciiProtocol) {
|
|||
wsocket = new WebSocket(__URL, nonAsciiProtocol);
|
||||
}
|
||||
|
||||
function CreateWebSocketWithAsciiSep(asciiWithSep) {
|
||||
IsWebSocket();
|
||||
__URL = "ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
|
||||
wsocket = new WebSocket(__URL, asciiWithSep);
|
||||
}
|
||||
|
||||
function CreateWebSocketWithBlockedPort(blockedPort) {
|
||||
IsWebSocket();
|
||||
__URL = "wss://" + __SERVER__NAME + ":" + blockedPort + "/" + __PATH;
|
||||
|
@ -71,6 +78,12 @@ function CreateWebSocketWithRepeatedProtocols() {
|
|||
wsocket = new WebSocket(__URL, __REPEATED__PROTOCOLS);
|
||||
}
|
||||
|
||||
function CreateWebSocketWithRepeatedProtocolsCaseInsensitive() {
|
||||
IsWebSocket();
|
||||
__URL = "ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
|
||||
wsocket = new WebSocket(__URL, __REPEATED__PROTOCOLS_CASE_INSENSITIVE);
|
||||
}
|
||||
|
||||
function CreateWebSocket(isSecure, isProtocol, isProtocols) {
|
||||
IsWebSocket();
|
||||
if (isSecure) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue