* `HOST_CHARS_REGEX` at the call site).
*/
const needsUrlParse = host.startsWith('[') || !/^[\x00-\x7F]*$/.test(host);
if (!needsUrlParse) {
return host;
}
try {
return new URL(`http://${host}`).hostname;
Frontier kind: Code frontier
unlabeled · c_98e5b2f98a76
9 tests · 3685 LOC · 19 files · introduces 0 tests · 55 LOC · 1 file
The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.
Introduced files, introduced tests, and structurally relevant concept specialization
In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.
Graph controls are ready.
Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.
Every exact file and test below is linked only from the concept that introduces it.
mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/browserView/test/common/browserSearch.test|title=BrowserSearch - resolveAddressBarInput input is trimmed before classification|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/browserView/test/common/browserSearch.test|title=BrowserSearch - resolveAddressBarInput whitespace in the path/query/fragment is a URL (percent-encoded later)|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/charCode.test|title=CharCode has good values|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/path.test|title=Paths (Node Implementation) path|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/uri.test|title=URI File paths containing apostrophes break URI parsing and cannot be opened #276075|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/uri.test|title=URI URI#file, win-speciale|occurrence=1Every collected test enters the hierarchy at exactly one concept.
No tests are introduced at this concept. Its intent tests are introduced by other concepts.
Every collected source range enters the hierarchy at exactly one concept.
1 file ranked by introduced lines: 55 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.
* `HOST_CHARS_REGEX` at the call site).
*/
const needsUrlParse = host.startsWith('[') || !/^[\x00-\x7F]*$/.test(host);
if (!needsUrlParse) {
return host;
}
try {
return new URL(`http://${host}`).hostname;
}
const sepMatch = /[/?#]/.exec(rest);
const authority = sepMatch ? rest.slice(0, sepMatch.index) : rest;
const pathAndRest = sepMatch ? rest.slice(sepMatch.index) : '';
let userinfo: string | undefined;
let hostport = authority;
const atIdx = authority.lastIndexOf('@');
if (atIdx >= 0) {
userinfo = authority.slice(0, atIdx);
hostport = authority.slice(atIdx + 1);
}
let host = hostport;
let port: string | undefined;
if (host.startsWith('[')) {
const end = host.indexOf(']');
if (end >= 0) {
}
}
const colonIdx = host.lastIndexOf(':');
if (colonIdx >= 0) {
const maybePort = host.slice(colonIdx + 1);
if (PORT_REGEX.test(maybePort)) {
}
}
return { userinfo, host, port, pathAndRest };
}
function hasKnownTld(host: string): boolean {
return 'unknown';
}
// http / https / scheme-less from here on. Strip the scheme prefix (and
// optional `//`) for authority parsing — but only if we actually
// recognized a scheme above. For inputs like `localhost:3000` where
// `candidateScheme` is set but `scheme` is undefined, we leave the
// colon in place so it's parsed as host:port.
let rest = trimmed;
if (scheme) {
rest = trimmed.slice(schemeMatch![0].length);
if (rest.startsWith('//')) {
}
}
const { userinfo, host: rawHost, port, pathAndRest } = parseHostAndPath(rest);
// Host-less input that starts with `/` is treated as an absolute path URL
// (e.g. `/usr/local/bin`, `//example.com`).
if (rawHost.length === 0) {
return pathAndRest.startsWith('/') ? 'url' : 'query';
}
// Canonicalize the host via the WHATWG URL parser: converts Unicode
// hostnames to punycode/IDN and validates/canonicalizes bracketed IPv6
// literals. Falls back to `query` if the host can't be canonicalized.
const host = toAsciiHost(rawHost);
if (host === undefined) {
return 'query';
}
// A canonicalized bracketed IPv6 literal is a URL.
if (host.startsWith('[') && host.endsWith(']')) {
return 'url';
}
// Validate host characters.
if (!HOST_CHARS_REGEX.test(host)) {
return 'query';
}
// IPv4 dotted-quad.
const ipv4Match = IPV4_REGEX.exec(host);
if (ipv4Match) {
const octets = ipv4Match.slice(1, 5).map(Number);
if (octets.every(o => o <= 255)) {