Add a tokenizer for URLPatterns (#36362)

Not a lot of new tests start to pass because the actual parser is still
missing, so we're only passing tests for invalid inputs. The parser will
be added in the next PR.

This is part 3 of upstreaming the changes in
https://github.com/simonwuelker/servo/tree/urlpattern

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-04-07 08:25:32 +02:00 committed by GitHub
parent d1243a1867
commit 0a4174ad0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 543 additions and 112 deletions

View file

@ -347,27 +347,6 @@
[Pattern: [{"pathname":"/foo{/bar}*"}\] Inputs: [{"pathname":"/foo/"}\]]
expected: FAIL
[Pattern: [{"protocol":"(café)"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"username":"(café)"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"password":"(café)"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"hostname":"(café)"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"pathname":"(café)"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"search":"(café)"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"hash":"(café)"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"protocol":":café"}\] Inputs: [{"protocol":"foo"}\]]
expected: FAIL
@ -473,18 +452,12 @@
[Pattern: [{"pathname":"\\ud83d \\udeb2"}\] Inputs: [\]]
expected: FAIL
[Pattern: [{"pathname":":\\ud83d \\udeb2"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"pathname":":a󠄀b"}\] Inputs: [\]]
expected: FAIL
[Pattern: [{"pathname":"test/:a𐑐b"}\] Inputs: [{"pathname":"test/foo"}\]]
expected: FAIL
[Pattern: [{"pathname":":🚲"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"port":""}\] Inputs: [{"protocol":"http","port":"80"}\]]
expected: FAIL
@ -1366,27 +1339,6 @@
[Pattern: [{"pathname":"/foo{/bar}*"}\] Inputs: [{"pathname":"/foo/"}\]]
expected: FAIL
[Pattern: [{"protocol":"(café)"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"username":"(café)"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"password":"(café)"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"hostname":"(café)"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"pathname":"(café)"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"search":"(café)"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"hash":"(café)"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"protocol":":café"}\] Inputs: [{"protocol":"foo"}\]]
expected: FAIL
@ -1492,18 +1444,12 @@
[Pattern: [{"pathname":"\\ud83d \\udeb2"}\] Inputs: [\]]
expected: FAIL
[Pattern: [{"pathname":":\\ud83d \\udeb2"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"pathname":":a󠄀b"}\] Inputs: [\]]
expected: FAIL
[Pattern: [{"pathname":"test/:a𐑐b"}\] Inputs: [{"pathname":"test/foo"}\]]
expected: FAIL
[Pattern: [{"pathname":":🚲"}\] Inputs: undefined]
expected: FAIL
[Pattern: [{"port":""}\] Inputs: [{"protocol":"http","port":"80"}\]]
expected: FAIL