gecko/parser/htmlparser/tests/mochitest/test_bug672453.html

95 lines
4.1 KiB
HTML

<!doctype html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=672453
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 672453</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=672453"
>Mozilla Bug 672453</a>
<iframe></iframe>
<script>
/** Test for Bug 672453 **/
var tests = [
"file_bug672453_not_declared.html",
"file_bug672453_late_meta.html",
"file_bug672453_meta_restart.html",
"file_bug672453_meta_unsupported.html",
"file_bug672453_http_unsupported.html",
"file_bug672453_bomless_utf16.html",
"file_bug672453_meta_utf16.html",
"file_bug672453_meta_non_superset.html"
];
var expectedErrors = [
{ errorMessage: "The character encoding of a framed document was not declared. The document may appear different if viewed without the document framing it.",
sourceName: "http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug672453_not_declared.html",
lineNumber: 0,
isWarning: true,
isException: false },
{ errorMessage: "The character encoding declaration of the framed HTML document was not found when prescanning the first 1024 bytes of the file. When viewed without the document framing it, the page will reload automatically. The encoding declaration needs to be moved to be within the first 1024 bytes of the file.",
sourceName: "http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug672453_late_meta.html",
lineNumber: 1028,
isWarning: true,
isException: false },
{ errorMessage: "The page was reloaded, because the character encoding declaration of the HTML document was not found when prescanning the first 1024 bytes of the file. The encoding declaration needs to be moved to be within the first 1024 bytes of the file.",
sourceName: "http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug672453_meta_restart.html",
lineNumber: 1028,
isWarning: true,
isException: false },
{ errorMessage: "An unsupported character encoding was declared for the HTML document using a meta tag. The declaration was ignored.",
sourceName: "http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug672453_meta_unsupported.html",
lineNumber: 1,
isWarning: false,
isException: false },
{ errorMessage: "An unsupported character encoding was declared on the transfer protocol level. The declaration was ignored.",
sourceName: "http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug672453_http_unsupported.html",
lineNumber: 0,
isWarning: false,
isException: false },
{ errorMessage: "Detected UTF-16-encoded Basic Latin-only text without a byte order mark and without a transfer protocol-level declaration. Encoding this content in UTF-16 is inefficient and the character encoding should have been declared in any case.",
sourceName: "http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug672453_bomless_utf16.html",
lineNumber: 0,
isWarning: false,
isException: false },
{ errorMessage: "A meta tag was used to declare the character encoding as UTF-16. This was interpreted as an UTF-8 declaration instead.",
sourceName: "http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug672453_meta_utf16.html",
lineNumber: 1,
isWarning: false,
isException: false },
{ errorMessage: "An unsupported character encoding was declared for the HTML document using a meta tag. The declaration was ignored.",
sourceName: "http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug672453_meta_non_superset.html",
lineNumber: 1,
isWarning: false,
isException: false }
];
SimpleTest.waitForExplicitFinish();
window.onload = function() {
var iframe = document.getElementsByTagName("iframe")[0];
function runNextTest() {
var url = tests.shift();
if (!url) {
SimpleTest.endMonitorConsole();
return;
}
iframe.src = url;
}
iframe.onload = runNextTest;
SimpleTest.monitorConsole(SimpleTest.finish, expectedErrors);
runNextTest();
}
</script>
</body>
</html>