Lines Matching refs:scheme

1 function urlString({ scheme = "https",
9 return `${scheme}://${username}:${password}@${host}:${port}/${pathname}?${search}#${hash}`;
12 function urlRecord(scheme) {
13 return new URL(urlString({ scheme }));
16 for(const scheme of ["https", "wpt++"]) {
30 const expected = scheme === "https" ? (stripped ? "http" : "https") : (stripped ? "wpt--" : "wpt++");
31 const url = urlRecord(scheme);
32 url.protocol = String.fromCodePoint(i) + (scheme === "https" ? "http" : "wpt--");
34 assert_equals(url.href, urlString({ scheme: expected }), "href");
35 }, `Setting protocol with leading ${cpReference} (${scheme}:)`);
38 const expected = scheme === "https" ? (stripped ? "http" : "https") : (stripped ? "wpt--" : "wpt++");
39 const url = urlRecord(scheme);
40 url.protocol = (scheme === "https" ? "http" : "wpt--") + String.fromCodePoint(i);
42 assert_equals(url.href, urlString({ scheme: expected }), "href");
43 }, `Setting protocol with ${cpReference} before inserted colon (${scheme}:)`);
55 const url = urlRecord(scheme);
58 assert_equals(url.href, urlString({ scheme, [property]: expected }), "href");
59 }, `Setting ${property} with ${type} ${cpReference} (${scheme}:)`);
64 ["leading", (scheme === "https" ? cpString : encodeURIComponent(cpString)) + "test", String.fromCodePoint(i) + "test"],
65 ["middle", "te" + (scheme === "https" ? cpString : encodeURIComponent(cpString)) + "st", "te" + String.fromCodePoint(i) + "st"],
66 ["trailing", "test" + (scheme === "https" ? cpString : encodeURIComponent(cpString)), "test" + String.fromCodePoint(i)]
69 const expected = i === 0x00 || (scheme === "https" && i === 0x1F) ? "host" : stripped ? "test" : expectedPart;
70 const url = urlRecord(scheme);
73 assert_equals(url.href, urlString({ scheme, host: expected }), "href");
74 }, `Setting host with ${type} ${cpReference} (${scheme}:)`);
77 const expected = i === 0x00 || (scheme === "https" && i === 0x1F) ? "host" : stripped ? "test" : expectedPart;
78 const url = urlRecord(scheme);
81 assert_equals(url.href, urlString({ scheme, host: expected }), "href");
82 }, `Setting hostname with ${type} ${cpReference} (${scheme}:)`);
87 const url = urlRecord(scheme);
90 assert_equals(url.href, urlString({ scheme, port: expected }), "href");
91 }, `Setting port with leading ${cpReference} (${scheme}:)`);
95 const url = urlRecord(scheme);
98 assert_equals(url.href, urlString({ scheme, port: expected }), "href");
99 }, `Setting port with middle ${cpReference} (${scheme}:)`);
103 const url = urlRecord(scheme);
106 assert_equals(url.href, urlString({ scheme, port: expected }), "href");
107 }, `Setting port with trailing ${cpReference} (${scheme}:)`);
117 const url = urlRecord(scheme);
120 assert_equals(url.href, urlString({ scheme, [property]: expected }), "href");
121 }, `Setting ${property} with ${type} ${cpReference} (${scheme}:)`);