Skip to content

Commit c48d587

Browse files
domeniccodex
andcommitted
Test constructor as a non-special URL scheme
Add parsing cases for the non-special `constructor` scheme with an opaque path, a hierarchical path without a host, and an opaque host with a port and an empty path. This catches JavaScript implementations that accidentally inherit the `constructor` property when looking up special schemes in an object, as in jsdom/whatwg-url#342. Co-Authored-By: codex <[email protected]>
1 parent 73b3c13 commit c48d587

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

‎url/resources/urltestdata.json‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9638,6 +9638,51 @@
96389638
"hash": ""
96399639
},
96409640
"Non-special schemes that some implementations might incorrectly treat as special",
9641+
{
9642+
"input": "constructor:example",
9643+
"base": null,
9644+
"href": "constructor:example",
9645+
"origin": "null",
9646+
"protocol": "constructor:",
9647+
"username": "",
9648+
"password": "",
9649+
"host": "",
9650+
"hostname": "",
9651+
"port": "",
9652+
"pathname": "example",
9653+
"search": "",
9654+
"hash": ""
9655+
},
9656+
{
9657+
"input": "constructor:/example",
9658+
"base": null,
9659+
"href": "constructor:/example",
9660+
"origin": "null",
9661+
"protocol": "constructor:",
9662+
"username": "",
9663+
"password": "",
9664+
"host": "",
9665+
"hostname": "",
9666+
"port": "",
9667+
"pathname": "/example",
9668+
"search": "",
9669+
"hash": ""
9670+
},
9671+
{
9672+
"input": "constructor://HOST:80",
9673+
"base": null,
9674+
"href": "constructor://HOST:80",
9675+
"origin": "null",
9676+
"protocol": "constructor:",
9677+
"username": "",
9678+
"password": "",
9679+
"host": "HOST:80",
9680+
"hostname": "HOST",
9681+
"port": "80",
9682+
"pathname": "",
9683+
"search": "",
9684+
"hash": ""
9685+
},
96419686
{
96429687
"input": "data://example.com:8080/pathname?search#hash",
96439688
"base": null,

0 commit comments

Comments
 (0)