Skip to content

fixed quirks::parse_pattern of WPT [{ "pathname": "/(\\m)" }] #64

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

edgul
Copy link

@edgul edgul commented Jul 31, 2025

URLPattern crate doesn't seem to test for quirks::parse_pattern but one of the failing tests when invoked from firefox

{
    "pattern": [{ "pathname": "/(\\m)" }],
    "expected_obj": "error"
  },

Relevant spec location: https://urlpattern.spec.whatwg.org/#compile-a-component
I'm not seeing the place in the algorithm where we should explicitly run the parser eval, but the spec notes the following:
"
The specification uses regular expressions to perform all matching, but this is not mandated. Implementations are free to perform matching directly against the part list when possible; e.g. when there are no custom regexp matching groups. If there are custom regular expressions, however, its important that they be immediately evaluated in the compile a component algorithm so an error can be thrown if they are invalid.
"

This is a bit of a hack and probably we should just be feeding Spidermonkey regex into the pattern, but it seems to fix the test without breaking anything else.

@edgul edgul force-pushed the wpt-slash-slash-m branch from 00dccf7 to da87019 Compare July 31, 2025 21:06
@edgul edgul force-pushed the wpt-slash-slash-m branch from da87019 to aff4bd1 Compare July 31, 2025 21:11
@edgul
Copy link
Author

edgul commented Aug 6, 2025

Hey @lucacasonato, I'm not able to add a reviewer, can you take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant