forked from mirrors/gecko-dev
Automatic update from web-platform-tests WebSocket: allow HTTP(S) URLs This makes it possible for people to pass relative URLs. They are immediately translated to the ws: or wss: scheme. This change also removes a number of redundant tests. -- wpt-commits: 590d5d63ebbd2c29a8fd986e2101d766aa17df00 wpt-pr: 39955
19 lines
479 B
JavaScript
19 lines
479 B
JavaScript
test(() => {
|
|
const url = new URL ("/", location);
|
|
url.protocol = "http";
|
|
const httpURL = url.href;
|
|
url.protocol = "https";
|
|
const httpsURL = url.href;
|
|
url.protocol = "ws";
|
|
const wsURL = url.href;
|
|
url.protocol = "wss";
|
|
const wssURL = url.href;
|
|
|
|
let ws = new WebSocket(httpURL);
|
|
assert_equals(ws.url, wsURL);
|
|
ws.close();
|
|
|
|
ws = new WebSocket(httpsURL);
|
|
assert_equals(ws.url, wssURL);
|
|
ws.close();
|
|
}, "WebSocket: ensure both HTTP schemes are supported");
|