278
*/
279
export function resolveAddressBarInputType(rawInput: string): AddressBarInputKind {
281
>
if (trimmed.length === 0) {
282
return 'empty';
283
}
284
285
const schemeMatch = SCHEME_REGEX.exec(trimmed);
287
>
const afterScheme = schemeMatch ? trimmed.slice(schemeMatch[0].length) : '';
288
>
const hasSchemeSeparator = afterScheme.startsWith('//');
289
>
// Only treat the leading `xxx:` as a scheme if it's a recognized scheme
290
>
// or is followed by `//`. This avoids mis-parsing inputs like
291
>
// `localhost:3000` or `sub.example.com:8080/path`, which Chromium's
292
>
// URLFixerUpper resolves as host:port URLs rather than scheme operands.
293
>
const scheme = candidateScheme && (ALL_KNOWN_SCHEMES.has(candidateScheme) || hasSchemeSeparator)
294
? candidateScheme
295
: undefined;
296
>
const isHttpScheme = scheme === 'http' || scheme === 'https';
browserSearch.ts
297
>
298
>
if (scheme && !isHttpScheme) {
299
if (scheme === 'file') {
300
return 'url';