• David Van Cleve's avatar
    Revert URLPattern wildcard to again match some invalid URLs · 6fbca674
    David Van Cleve authored
    This is a partial revert of r715320, which changed
    URLPattern::MatchesURL to decline to match all invalid
    (!GURL::is_valid) URLs. This was an inadvertent behavior change;
    it wasn't clear what the intended behavior was in this case.
    
    Reverting this seems to resolve crbug.com/1041880, a bug involving
    some PDF loads from blob: URLs getting stuck as gray boxes. While
    r715320 was originally made to resolve a crash---namely, MatchesURL
    would crash on URLs with empty paths---the follow-up commit r718423
    adds logic that will still suffice to prevent this crash (this
    is tested by ExtensionURLPatternTest.WildcardMatchesPathlessUrl and
    ExtensionURLPatternTest.NonwildcardDoesntMatchPathlessUrl).
    
    Changes:
    - URLPattern: revert the behavior change and update documentation
    to reflect that intended behavior is actually to allow the wildcard
    '<all_urls>' pattern to match invalid URLs
    - URLPattern tests: update to reflect the intended new behavior
    
    Bug: 1041880
    
    R=devlin
    
    Change-Id: I4f4571c70d0f0dbd7b52cdadbf96a7ea6854cfe0
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2022251Reviewed-by: default avatarCharlie Reis <creis@chromium.org>
    Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
    Commit-Queue: David Van Cleve <davidvc@chromium.org>
    Commit-Queue: Charlie Reis <creis@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#735510}
    6fbca674
url_pattern.cc 25.5 KB