| 14967 | } |
| 14968 | __name(isValidClientWindowBits, "isValidClientWindowBits"); |
| 14969 | function getURLRecord(url, baseURL) { |
| 14970 | let urlRecord; |
| 14971 | try { |
| 14972 | urlRecord = new URL(url, baseURL); |
| 14973 | } catch (e) { |
| 14974 | throw new DOMException(e, "SyntaxError"); |
| 14975 | } |
| 14976 | if (urlRecord.protocol === "http:") { |
| 14977 | urlRecord.protocol = "ws:"; |
| 14978 | } else if (urlRecord.protocol === "https:") { |
| 14979 | urlRecord.protocol = "wss:"; |
| 14980 | } |
| 14981 | if (urlRecord.protocol !== "ws:" && urlRecord.protocol !== "wss:") { |
| 14982 | throw new DOMException("expected a ws: or wss: url", "SyntaxError"); |
| 14983 | } |
| 14984 | if (urlRecord.hash.length || urlRecord.href.endsWith("#")) { |
| 14985 | throw new DOMException("hash", "SyntaxError"); |
| 14986 | } |
| 14987 | return urlRecord; |
| 14988 | } |
| 14989 | __name(getURLRecord, "getURLRecord"); |
| 14990 | function validateCloseCodeAndReason(code, reason) { |
| 14991 | if (code !== null) { |