-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
URLPattern: Canonicalize pattern encoding.
This CL adds an encoding callback to liburlpattern::Parse(). The parse will invoke the given callback for plaintext parts of the pattern to validate and encode the characters. This callback mechanism is then used to apply the chromium url canonicalization code for each component pattern. There are a couple of behaviors in the canonicalizer that do not play well with this approach that the CL works around: 1. The port canonicalizer will replace an exact default port with the empty string. Since the liburlpattern::Parse() callback is invoked for partial values this CL instead implements this canoncilization separately before pattern compilation. 2. The URL canonicalizer will prepend a leading `/` character if there isn't one. Again, this behavior does not make sense when operating on partial values. In addition, URLPattern doesn't want this behavior at all since we often don't know the protocol and some types of URLs do not require the pathname to begin with `/`. This is worked around by simply detecting the addition of the `/` and stripping it off. The CL adds a number of additional WPT test cases validating the new canonicalization behavior. The behavior in this test has been discussed in this spec issue: whatwg/urlpattern#33 Bug: 1141510 Change-Id: I388be5d0cc57b125d44465b283050df5ed0b5321
- Loading branch information
1 parent
bd23e12
commit 135caf0
Showing
1 changed file
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters