Skip to content
  • brettw's avatar
    Mark URLs with empty schemes as invalid. · 46f9b83f
    brettw authored
    Previously Chrome allowed empty schemes. This meant that URLs such as ":" or
    ":foo" were marked as valid.
    
    According to WHATWG:
      A scheme must be one ASCII alpha, followed by zero or more of ASCII
      alphanumeric, "+", "-", and ".".
    
    This change marks URLs with empty schemes as invalid.
    
    This forced some changes to the URL fixer and autocomplete systems to keep from breaking the behavior of input like ":w" (which we want to do a search). Previously the URL fixer would see ":w" as having a valid (but empty) scheme. Therefore, it would not attempt to prepend "http://" and the autocomplete system would make a GURL out of that literal string. GURL would interpret it as a "path" URL (with no host). AutocompleteInput::Parse checks for URLs with no host and a comment that this only happens for URLs beginning with a colon, and converts those to a query.
    
    With this change, ":w" becomes invalid and url_fixer attempts to prepend schemes. This changes the behavior for certain ...
    46f9b83f