1
0
Fork 0
firefox/netwerk/test/mochitests/test_anchor_query_encoding.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

44 lines
1.4 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE HTML>
<html>
<head>
<meta charset="windows-1251">
<title>Testing &#x3C;a&#x3E;.href (windows-1251)</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript">
const UTF_8 = '%C3%A5';
const WINDOWS_1251 = '%26%23229%3B';
function test_scheme(url, expected) {
var a = document.createElement('a');
a.setAttribute('href', url);
ok(a.href.includes(expected), `Expected: ${expected}, Actual: ${a.href}`);
}
add_task(async function test_bug1883033() {
// Scheme http (getting <a>.href)
// eslint-disable-next-line @microsoft/sdl/no-insecure-url
test_scheme("http://example.invalid/?x=\u00E5", WINDOWS_1251);
// Scheme https (getting <a>.href)
test_scheme("https://example.invalid/?x=\u00E5", WINDOWS_1251);
// If encoding is not UTF-8 and urls scheme is "ws" or "wss",
// then encoding should be set to UTF-8.
// Scheme ws (getting <a>.href)
test_scheme("ws://example.invalid/?x=\u00E5", UTF_8);
// Scheme wss (getting <a>.href)
test_scheme("wss://example.invalid/?x=\u00E5", UTF_8);
// If encoding is not UTF-8 and url is not special,
// then encoding should be UTF-8.
// Scheme ssh (getting <a>.href)
test_scheme("ssh://foo/?x=\u00E5", UTF_8);
});
</script>
</head>
<body>
</body>
</html>