2007-11-11 22:52:33 +03:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=399284
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 399284</title>
|
2019-04-16 06:50:44 +03:00
|
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
2007-11-11 22:52:33 +03:00
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=399284">Mozilla Bug 399284</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
/** Test for Bug 399284 **/
|
|
|
|
const testContent = "<p id='testPara'>The quick brown fox jumps over the lazy dog";
|
|
|
|
|
2014-05-08 13:32:00 +04:00
|
|
|
var decoders = [
|
|
|
|
"Big5",
|
|
|
|
"Big5-HKSCS",
|
|
|
|
"EUC-JP",
|
|
|
|
"EUC-KR",
|
|
|
|
"gb18030",
|
|
|
|
"IBM866",
|
|
|
|
"ISO-2022-JP",
|
|
|
|
"ISO-8859-3",
|
|
|
|
"ISO-8859-4",
|
|
|
|
"ISO-8859-5",
|
|
|
|
"ISO-8859-6",
|
|
|
|
"ISO-8859-7",
|
|
|
|
"ISO-8859-8",
|
|
|
|
"ISO-8859-8-I",
|
|
|
|
"ISO-8859-10",
|
|
|
|
"ISO-8859-13",
|
|
|
|
"ISO-8859-14",
|
|
|
|
"ISO-8859-15",
|
|
|
|
"ISO-8859-16",
|
|
|
|
"ISO-8859-2",
|
|
|
|
"KOI8-R",
|
|
|
|
"KOI8-U",
|
|
|
|
"Shift_JIS",
|
|
|
|
"windows-1250",
|
|
|
|
"windows-1251",
|
|
|
|
"windows-1252",
|
|
|
|
"windows-1253",
|
|
|
|
"windows-1254",
|
|
|
|
"windows-1255",
|
|
|
|
"windows-1256",
|
|
|
|
"windows-1257",
|
|
|
|
"windows-1258",
|
|
|
|
"windows-874",
|
|
|
|
"x-mac-cyrillic",
|
|
|
|
"UTF-8",
|
|
|
|
"UTF-16LE",
|
|
|
|
"UTF-16BE"
|
|
|
|
];
|
2007-11-11 22:52:33 +03:00
|
|
|
|
2014-05-08 13:32:00 +04:00
|
|
|
var decoder;
|
|
|
|
for (var i = 0; i < decoders.length; i++) {
|
|
|
|
var decoder = decoders[i];
|
|
|
|
var data;
|
|
|
|
|
2007-11-11 22:52:33 +03:00
|
|
|
// encode the content for non-ASCII compatible encodings
|
2012-11-08 03:04:22 +04:00
|
|
|
if (decoder == "UTF-16BE")
|
2007-11-11 22:52:33 +03:00
|
|
|
data = encodeUTF16BE(testContent);
|
2014-05-08 13:32:00 +04:00
|
|
|
else if (decoder == "UTF-16LE")
|
2007-11-11 22:52:33 +03:00
|
|
|
data = encodeUTF16LE(testContent);
|
|
|
|
else
|
|
|
|
data = encodeURI(testContent);
|
|
|
|
var dataURI = "data:text/html;charset=" + decoder + "," + data;
|
|
|
|
|
|
|
|
var testFrame = document.createElement("iframe");
|
|
|
|
frameID = decoder;
|
|
|
|
testFrame.setAttribute("id", frameID);
|
|
|
|
var testFrameObj = document.body.appendChild(testFrame);
|
2014-05-08 13:32:00 +04:00
|
|
|
testFrameObj.setAttribute("onload", "testFontSize('" + decoder + "')");
|
2007-11-11 22:52:33 +03:00
|
|
|
testFrameObj.contentDocument.location.assign(dataURI);
|
|
|
|
}
|
|
|
|
|
|
|
|
function encodeUTF16BE(string)
|
|
|
|
{
|
|
|
|
var encodedString = "";
|
|
|
|
for (i = 0; i < string.length; ++i) {
|
|
|
|
encodedString += "%00";
|
|
|
|
encodedString += encodeURI(string.charAt(i));
|
|
|
|
}
|
|
|
|
return encodedString;
|
|
|
|
}
|
|
|
|
|
|
|
|
function encodeUTF16LE(string)
|
|
|
|
{
|
|
|
|
var encodedString = "";
|
|
|
|
for (i = 0; i < string.length; ++i) {
|
|
|
|
encodedString += encodeURI(string.charAt(i));
|
|
|
|
encodedString += "%00";
|
|
|
|
}
|
|
|
|
return encodedString;
|
|
|
|
}
|
|
|
|
|
|
|
|
function testFontSize(frame)
|
|
|
|
{
|
2017-07-24 21:35:02 +03:00
|
|
|
var iframeDoc = SpecialPowers.wrap($(frame)).contentDocument;
|
2007-11-11 22:52:33 +03:00
|
|
|
var size = parseInt(iframeDoc.defaultView.
|
2019-07-19 00:00:21 +03:00
|
|
|
getComputedStyle(iframeDoc.getElementById("testPara")).
|
2007-11-11 22:52:33 +03:00
|
|
|
getPropertyValue("font-size"));
|
|
|
|
ok(size > 0, "font size assigned for " + frame);
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|