Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: appname == 'thunderbird'
- Manifest: netwerk/test/unit/xpcshell.toml
"use strict";
function run_test() {
// check if hostname is unescaped before applying IDNA
Assert.equal(newURI.asciiHost, "xn--kkr.com");
// escaped UTF8
Assert.equal(newURI.asciiHost, "xn--kkr.com");
// There should be only allowed characters in hostname after
// unescaping and attempting to apply IDNA. "\x80" is illegal in
// UTF-8, so IDNA fails, and 0x80 is illegal in DNS too.
Assert.throws(
() => {
},
/NS_ERROR_MALFORMED_URI/,
"illegal UTF character"
);
// test parsing URL with all possible host terminators
Assert.equal(newURI.asciiHost, "example.com");
Assert.equal(newURI.asciiHost, "example.com");
Assert.equal(newURI.asciiHost, "example.com");
Assert.equal(newURI.asciiHost, "example.com");
// Test an intuitively weird character that is not actually on the
// forbidden domain code point list in the WHATWG URL Standard.
Assert.equal(newURI.asciiHost, "example.com;foo");
// Characters that are invalid in the host
Assert.throws(
() => {
},
/NS_ERROR_MALFORMED_URI/,
"bad escaped character"
);
Assert.throws(
() => {
},
/NS_ERROR_MALFORMED_URI/,
"bad escaped character"
);
Assert.throws(
() => {
},
/NS_ERROR_MALFORMED_URI/,
"bad escaped character"
);
Assert.throws(
() => {
},
/NS_ERROR_MALFORMED_URI/,
"bad escaped character"
);
Assert.throws(
() => {
},
/NS_ERROR_MALFORMED_URI/,
"bad escaped character"
);
}