mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 00:25:12 +00:00
We were completely missing this spec step here. Also leave a FIXME for the pre-existing implementation of this step, as this doesn't match the spec.
35 lines
1.2 KiB
HTML
35 lines
1.2 KiB
HTML
<script src="../include.js"></script>
|
|
<script>
|
|
test(() => {
|
|
function printURL(input, base) {
|
|
if (base === undefined)
|
|
println(`new URL('${input}', ${base})`);
|
|
else
|
|
println(`new URL('${input}', '${base}')`);
|
|
|
|
const url = new URL(input, base);
|
|
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 [
|
|
{ input: 'ftp://serenityos.org:21' },
|
|
{ input: 'http://[0:1:0:1:0:1:0:1]' },
|
|
{ input: 'http://[1:0:1:0:1:0:1:0]' },
|
|
{ input: 'http://[1:1:0:0:1:0:0:0]/' },
|
|
{ input: 'unknown://serenityos.org:0' },
|
|
{ input: 'http://serenityos.org/cat?dog#meow"woof' },
|
|
{ input: '/hello', base: 'file://friends/' },
|
|
]) {
|
|
printURL(url.input, url.base);
|
|
}
|
|
});
|
|
</script>
|