1 2 3 4 5 6 7 8 9 10 11 12 13 14
[ "test", "?", null, 123, ].forEach(input => { test(() => { const url = new URL(input, location); url.protocol = "ws"; const ws = new WebSocket(input); assert_equals(ws.url, url.href); ws.close(); }, `Create WebSocket - Pass a non absolute URL: ${input}`); });