1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:48:11 +00:00
serenity/Tests/LibWeb/Text/input/URL/url.html
Shannon Booth cb4c279e90 AK: Percent encode URL fragments when parsed
This fixes URL fragments containing characters in the fragment encoding
set that were not being correctly percent encoded.
2023-08-31 11:02:18 +02:00

29 lines
983 B
HTML

<script src="../include.js"></script>
<script>
test(() => {
function printURL(input) {
println(input);
const url = new URL(input);
println(`protocol => '${url.protocol}'`);
println(`username => '${url.username}'`);
println(`password => '${url.password}'`);
println(`host => '${url.host}'`);
println(`hostname => '${url.hostname}'`);
println(`port => '${url.port}'`);
println(`pathname => '${url.pathname}'`);
println(`search => '${url.search}'`);
println(`hash => '${url.hash}'`);
}
for (url of [
'ftp://serenityos.org:21',
'http://[0:1:0:1:0:1:0:1]',
'http://[1:0:1:0:1:0:1:0]',
'http://[1:1:0:0:1:0:0:0]/',
'unknown://serenityos.org:0',
'http://serenityos.org/cat?dog#meow"woof',
]) {
printURL(url);
}
});
</script>