blob: 5405ed5cc674d663ffa66ab7f098a3eeef1aaa8f [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="resources/utilities.js"></script>
<!-- Set the base so that the current URL does not affect the tests. -->
<base href="">
</head>
<body>
<script>
description("This ensure we do not mess up the bytes when an URL is partially parsed and is invalid.")
// Those are all invalid URLs. They should not be partially modified by the parser.
var testSet = [
// Empty Authority for a standard hierachical URL.
'http:///',
'https:///',
'ftp:///',
'gopher:///',
'ws:///',
'wss:///',
// Invalid Authority.
'foo://tête à tête@host/',
'foo://user:tête à tête@host/',
' foo://<>@host/ ',
' foo://user:<>@host/ ',
'foo://user:password@[xxxxx]/tête à tête/',
// The '?' is a path separator and make sure the hostname is not encoded in punicode. The hostname is an invalid IPV6 hostname.
'foo://user:password@[?tête à tête/',
'foo://user:password@[?tête à tête]/',
'foo://user:password@host:tête à tête/',
'foo://user:password@host:80tête à tête',
'foo://user:password@host:tête à tête/',
'foo://user:password@host:80tête à tête',
// The schemes "ws:", "ftp:", "http:", "https:", "gother:" take a shortcut during parsing so we test them separately.
'ws:/tête',
'ftp:/tête',
'http:/tête',
'https:/tête',
'gopher:/tête',
];
for (var i = 0; i < testSet.length; ++i) {
src = canonicalize(testSet[i]);
expected = testSet[i].trim();
shouldBe('src', 'expected');
}
successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>