Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
URLPattern: Adjust pathname canonicalization based on protocol.
This CL refines the pathname canonicalization routines to account for differences between "standard" URLs and what chrome calls "path" URLs. "Path" URLs are referred to as "cannot-be-a-base" URLs in the spec. To choose the canonicalization routine we look at the protocol pattern or string. If the protocol matches a "standard" scheme, then we choose "standard" canonicalization. We also ensure that empty string protocol values default to "standard" canonicalization. Otherwise we use the "path" URL canonicalization which is more lenient; e.g. it makes it easier to write javascript: URL paths, etc. This CL also exposes two new functions from the url component: 1. GetStandardSchemeList() returns the list of all known standard schemes. We need this in order to match them against our protocol pattern. For example, `http{s}?` should match as a standard protocol pattern since it matches both `http` and `https`. We can't use the IsStandard() function for this so we need to expose the whole list to iterate and check against. 2. CanonicalizePathURLPath() exposes the per-component canonicalization routine for "path" URLs. Previously only a full url parsing function was exposed. Discussed in: whatwg/urlpattern#33 Bug: 1141510 Change-Id: I3176a36d1e0eb2f8a0ccdf65fde346a4a623f9dd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2769358 Commit-Queue: Ben Kelly <wanderview@chromium.org> Reviewed-by: Charlie Harrison <csharrison@chromium.org> Reviewed-by: Jeremy Roman <jbroman@chromium.org> Cr-Commit-Position: refs/heads/master@{#865276}
- Loading branch information