Use the URLPattern specification instead of custom URL pattern parsing#1106
Use the URLPattern specification instead of custom URL pattern parsing#1106whimboo wants to merge 5 commits into
Conversation
|
@juliandescottes could you maybe do the initial review? |
juliandescottes
left a comment
There was a problem hiding this comment.
Looks like a great simplification. Overall I think this is fine, but we need to handle the error case.
|
@OrKoN could you please review the changes as well? Thanks! |
I filed #1109 for this follow-up work. |
|
@whimboo do you already have an implementation? I wonder what the effect on existing WPT tests will be |
@OrKoN, I haven't had when you were asking. But I spend some time today in updating our interception related code to check what will change. In general I noticed that several values are handled more permissively compared to our current implementation. The main differences are:
All the relevant test changes you can find in: https://bugzilla.mozilla.org/attachment.cgi?id=9568221 As given by Julian we expected breaking changes and from our side it looks ok. What do you think? |
|
I added a basic implementation here GoogleChromeLabs/chromium-bidi#4138 and there quite a few WPT tests that are failing, I wonder if the list of failed tests matches what you have? |
There is actually only a single test which seems to perma fail and some others that fail intermittently. Here a job which shows 3 failing tests: It looks like that I did not update this particular test file as part of my patch on https://phabricator.services.mozilla.com/D293101. I should take a look. Thanks for pointing out. |
@OrKoN these failing tests are not part of the public wdspec tests. But nevertheless here a quick investigation:
With all that I assume it should not be blocked to get the changes landed? |
|
@OrKoN over on https://phabricator.services.mozilla.com/D293101 I added a couple more tests to cover the additional features that we now allow to use by clients which URLPattern offers for us. It should apply to the upstream wpt repo (when you ignore the prefix in the path) so that you can run these tests with your implementation as well. Please let me know how it looks like. Thanks! |
|
One thing to keep in mind, and likely the most visible change for users, is that characters with special meaning in |
|
I had to push some smaller updates based on our internal review and that I saw that no note was added describing the new behavior + issue for the follow-up work. @juliandescottes please review again. Thanks |
|
@jgraham can you please review as well? Thanks |
| ()), U+002A (*), U+007B ({), U+007D (})» | ||
|
|
||
| 1. Let |result| be the empty string. | ||
| Issue(1109): Add support for additional {{URLPatternInit}} fields (e.g. |
There was a problem hiding this comment.
Although this is "cheap" in that we're just passing in extra options, I'm not quite convinced that they all make sense for WebDriver use cases.
|
|
||
| 1. If |pattern|["<code>port</code>"] is the empty string, return [=error=] | ||
| with [=error code=] [=invalid argument=]. | ||
| 1. Let |init| be a new {{URLPatternInit}}. |
There was a problem hiding this comment.
Technically you can't really do this; you're trying to create a JS object outside a realm. The URLPattern specification accepts an infra Map object as URLPatternInit in cases where it's not running in a JS realm. I think you want to use the entry point at https://urlpattern.spec.whatwg.org/#build-a-url-pattern-from-an-infra-value.
Fixes #919.
This change aligns our implementation for parsing and matching URL patterns with the URLPattern specification, ensuring consistent and spec-compliant behavior across matching operations. It reduces maintenance overhead by removing custom parsing code from the WebDriver BiDi specification, and leverages the native URLPattern implementation for improved correctness and clarity.
Existing functionality is preserved, but edge cases may now follow the semantics defined by the specification.
Follow-up work will extend support for additional
URLPatternInitfields that we do not support yet, and as well for handling thebaseURL, and parse options likeignoreCase.Preview | Diff