mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-16 08:02:52 +00:00
Parsing last as an IPV4 number was not returning true in "ends with a number" as the parsing of that part was overflowing. This means that the URL is not considered to be an IPv4 address, and is treated as a valid domain. Helpfully, the spec also points out in a note that this step is equivalent to simply checking that the last part ends with 0x followed by only hex digits - which doesn't suffer from any overflow problem! Arguably this is an editorial issue in the spec where this should be clarified a little bit. But for now, fixing this fixes 3 sub tests in WPT for: https://wpt.live/url/url-constructor.any.html
22 lines
589 B
HTML
22 lines
589 B
HTML
<script src="../include.js"></script>
|
|
<script>
|
|
test(() => {
|
|
const urls = [
|
|
{ input: 'file://xn--/p' },
|
|
{ input: 'http://0xffffffff1' },
|
|
];
|
|
|
|
for (url of urls) {
|
|
if (url.base === undefined)
|
|
println(`new URL('${url.input}', ${url.base})`);
|
|
else
|
|
println(`new URL('${url.input}', '${url.base}')`);
|
|
|
|
try {
|
|
new URL(url.input, url.base);
|
|
} catch (e) {
|
|
println(`error creating URL: '${e}'`);
|
|
}
|
|
}
|
|
});
|
|
</script>
|