Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URLPattern: Adjust pathname canonicalization based on protocol. #28154

Merged
merged 1 commit into from
Mar 22, 2021

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Mar 19, 2021

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}

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

@chromium-wpt-export-bot chromium-wpt-export-bot force-pushed the chromium-export-cl-2769358 branch 4 times, most recently from 6f1c175 to a35b879 Compare March 22, 2021 16:49
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}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants