Backed out changeset 75c44bd10b14 (bug 945215) for web-platform-2 test failures

This commit is contained in:
Carsten "Tomcat" Book 2014-09-24 12:43:01 +02:00
parent 7237bc85fb
commit 42d80f53d3
21 changed files with 162 additions and 31 deletions

View File

@ -32,6 +32,8 @@ support-files =
file_bug670318.html
file_bug852909.pdf
file_bug852909.png
file_bug941562-child.html
file_bug941562.html
file_bug1046022.html
print_postdata.sjs
test-form_sjis.html
@ -85,6 +87,8 @@ skip-if = e10s # Bug ?????? - test touches content (adds event listener to conte
[browser_bug852909.js]
skip-if = e10s # Bug ?????? - event handler checks event.target is the content document and test e10s-utils doesn't do that.
[browser_bug92473.js]
skip-if = e10s # Bug ?????? - BrowserSetForcedCharacterSet() in browser.js references docShell
[browser_bug941562.js]
skip-if = e10s # Bug ?????? - event handler checks event.target is the content document and test e10s-utils doesn't do that.
[browser_uriFixupIntegration.js]
skip-if = e10s

View File

@ -0,0 +1,39 @@
function test() {
waitForExplicitFinish();
var rootDir = "http://mochi.test:8888/browser/docshell/test/browser/";
gBrowser.selectedTab = gBrowser.addTab(rootDir + "file_bug941562.html");
gBrowser.selectedBrowser.addEventListener("load", afterOpen, true);
}
function afterOpen(event) {
if (event.target != gBrowser.contentDocument) {
return;
}
gBrowser.selectedBrowser.removeEventListener("load", afterOpen, true);
gBrowser.selectedBrowser.addEventListener("load", afterChangeCharset, true);
is(gBrowser.contentDocument.documentElement.textContent.indexOf('\u20AC'), 140, "Parent doc should be windows-1252 initially");
is(gBrowser.contentDocument.getElementsByTagName("iframe")[0].contentDocument.documentElement.textContent.indexOf('\u4E2D'), 77, "Child doc should be HZ-GB-2312 initially");
BrowserSetForcedCharacterSet("windows-1251");
}
function afterChangeCharset(event) {
if (event.target != gBrowser.contentDocument) {
return;
}
gBrowser.selectedBrowser.removeEventListener("load", afterChangeCharset, true);
is(gBrowser.contentDocument.documentElement.textContent.indexOf('\u0402'), 140, "Parent doc should decode as windows-1251 subsequently");
is(gBrowser.contentDocument.getElementsByTagName("iframe")[0].contentDocument.documentElement.textContent.indexOf('\u4E2D'), 77, "Child doc should decode as HZ-GB-2312 subsequently");
is(gBrowser.contentDocument.characterSet, "windows-1251", "Parent doc should report windows-1251 subsequently");
is(gBrowser.contentDocument.getElementsByTagName("iframe")[0].contentDocument.characterSet, "HZ-GB-2312", "Child doc should report HZ-GB-2312 subsequently");
gBrowser.removeCurrentTab();
finish();
}

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="hz-gb-2312">
<meta content="width=device-width, initial-scale=1" name="viewport">
<title>meta declaration in parent and meta HZ in child</title>
</head>
<body>
<p>China if decoded as HZ: ~{VP~}</p>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="windows-1252">
<meta content="width=device-width, initial-scale=1" name="viewport">
<title>meta declaration in parent and meta HZ in child</title>
</head>
<body>
<h1>meta declaration in parent and meta HZ in child</h1>
<p>Euro sign if decoded as Windows-1252: €</p>
<p>a with diaeresis if decoded as Windows-1252: ä</p>
<iframe src="file_bug941562-child.html"></iframe>
</body>
</html>

View File

@ -187,7 +187,7 @@ gbk=gbk
iso-ir-58=gbk
x-gbk=gbk
gb18030=gb18030
hz-gb-2312=replacement
hz-gb-2312=HZ-GB-2312
big5=Big5
big5-hkscs=Big5-HKSCS
cn-big5=Big5

View File

@ -1 +0,0 @@
<meta charset=utf-8><EFBFBD>

View File

@ -1 +0,0 @@
<meta charset=HZ-GB-2312>

View File

@ -1,3 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<iframe src="data:text/html;charset=utf-8,<2C><iframe src='data:text/html;charset=utf-8,PASS'></iframe>" width=400 height=200></iframe>

View File

@ -1,17 +0,0 @@
<!DOCTYPE html>
<html class=reftest-wait>
<meta charset=utf-8>
<script>
function runTest() {
var r = document.documentElement;
var d = window[0].document;
var i = d.createElement("iframe");
i.src = "data:text/html,PASS";
i.onload = function() {
r.removeAttribute("class");
}
d.body.appendChild(i);
}
</script>
<body onload="runTest();">
<iframe src="bug945215-1.html" width=400 height=200></iframe>

View File

@ -1,5 +1,3 @@
== bug863728-1.html bug863728-1-ref.html
== bug863728-2.html bug863728-2-ref.html
== bug863728-3.html bug863728-3-ref.html
== bug945215-1.html bug945215-1-ref.html
== bug945215-2.html bug945215-2-ref.html

View File

@ -5,6 +5,7 @@ unit/test_big5.js
unit/test_euc-jp.js
unit/test_euc-kr.js
unit/test_gbk.js
unit/test_hz-gb-2312.js
unit/test_iso-2022-jp.js
unit/test_iso-2022-kr.js
unit/test_shift_jis.js

View File

@ -342,6 +342,7 @@ function testDecoderGetEncoding()
{encoding: "x-mac-cyrillic", labels: ["x-mac-cyrillic", "x-mac-ukrainian"]},
{encoding: "gbk", labels: ["chinese", "csgb2312", "csiso58gb231280", "gb2312", "gb_2312", "gb_2312-80", "gbk", "iso-ir-58", "x-gbk"]},
{encoding: "gb18030", labels: ["gb18030"]},
{encoding: "hz-gb-2312", labels: ["hz-gb-2312"]},
{encoding: "big5", labels: ["big5", "cn-big5", "csbig5", "x-x-big5"]},
{encoding: "big5-hkscs", labels: ["big5-hkscs"]},
{encoding: "euc-jp", labels: ["cseucpkdfmtjapanese", "euc-jp", "x-euc-jp"]},
@ -351,7 +352,7 @@ function testDecoderGetEncoding()
{encoding: "utf-16le", labels: ["utf-16", "utf-16le"]},
{encoding: "utf-16be", labels: ["utf-16be"]},
{encoding: "x-user-defined", labels: ["x-user-defined"]},
{error: "TypeError", labels: ["x-windows-949", "\u0130SO-8859-1", "csiso2022kr", "iso-2022-kr", "iso-2022-cn", "iso-2022-cn-ext", "replacement", "hz-gb-2312"]},
{error: "TypeError", labels: ["x-windows-949", "\u0130SO-8859-1", "csiso2022kr", "iso-2022-kr", "iso-2022-cn", "iso-2022-cn-ext", "replacement"]},
];
for (var le of labelEncodings) {

View File

@ -18,6 +18,7 @@ setup({explicit_timeout: true});
<!-- TODO: test for all single-byte encoding indexes -->
<script type="text/javascript" src="unit/test_gbk.js"></script>
<!-- TODO: gb18030 -->
<script type="text/javascript" src="unit/test_hz-gb-2312.js"></script>
<script type="text/javascript" src="unit/test_big5.js"></script>
<script type="text/javascript" src="unit/test_euc-jp.js"></script>
<script type="text/javascript" src="unit/test_iso-2022-jp.js"></script>

View File

@ -5,5 +5,6 @@ skip-if = e10s
[test_euc-jp.js]
[test_euc-kr.js]
[test_gbk.js]
[test_hz-gb-2312.js]
[test_iso-2022-jp.js]
[test_shift_jis.js]

File diff suppressed because one or more lines are too long

View File

@ -163,13 +163,15 @@ test(
test(
function () {
var encodings = ["utf-8", "ibm866", "iso-8859-2", "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", "koi8-r", "koi8-u", "macintosh", "windows-874", "windows-1250", "windows-1251", "windows-1252", "windows-1253", "windows-1254", "windows-1255", "windows-1256", "windows-1257", "windows-1258", "x-mac-cyrillic", "gbk", "gb18030", "big5", "euc-jp", "iso-2022-jp", "shift_jis", "euc-kr", "x-user-defined"];
var encodings = ["utf-8", "ibm866", "iso-8859-2", "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", "koi8-r", "koi8-u", "macintosh", "windows-874", "windows-1250", "windows-1251", "windows-1252", "windows-1253", "windows-1254", "windows-1255", "windows-1256", "windows-1257", "windows-1258", "x-mac-cyrillic", "gbk", "gb18030", "hz-gb-2312", "big5", "euc-jp", "iso-2022-jp", "shift_jis", "euc-kr", "x-user-defined"];
encodings.forEach(function (encoding) {
var string = '', bytes = [];
for (var i = 0; i < 128; ++i) {
// Encodings that have escape codes in 0x00-0x7F
if (encoding === "hz-gb-2312" && i === 0x7E)
continue;
if (encoding === "iso-2022-jp" && i === 0x1B)
continue;
@ -206,7 +208,7 @@ test(
var utf_encodings = ["utf-8", "utf-16le", "utf-16be"];
var legacy_encodings = ["ibm866", "iso-8859-2", "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", "koi8-r", "koi8-u", "macintosh", "windows-874", "windows-1250", "windows-1251", "windows-1252", "windows-1253", "windows-1254", "windows-1255", "windows-1256", "windows-1257", "windows-1258", "x-mac-cyrillic", "gbk", "gb18030", "big5", "euc-jp", "iso-2022-jp", "shift_jis", "euc-kr", "x-user-defined"];
var legacy_encodings = ["ibm866", "iso-8859-2", "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", "koi8-r", "koi8-u", "macintosh", "windows-874", "windows-1250", "windows-1251", "windows-1252", "windows-1253", "windows-1254", "windows-1255", "windows-1256", "windows-1257", "windows-1258", "x-mac-cyrillic", "gbk", "gb18030", "hz-gb-2312", "big5", "euc-jp", "iso-2022-jp", "shift_jis", "euc-kr", "x-user-defined"];
utf_encodings.forEach(function(encoding) {
assert_equals(new TextDecoder(encoding).encoding, encoding);

View File

@ -9,5 +9,6 @@ tail =
[test_euc-jp.js]
[test_euc-kr.js]
[test_gbk.js]
[test_hz-gb-2312.js]
[test_iso-2022-jp.js]
[test_shift_jis.js]

View File

@ -22,7 +22,6 @@ const charset = "HZ-GB-2312";
function run_test() {
var converter = CreateScriptableConverter();
converter.isInternal = true;
checkEncode(converter, charset, inASCII, expectedASCII);
checkEncode(converter, charset, inMixed, expectedMixed);

View File

@ -1,4 +1,4 @@
const charset = "HZ-GB-2312";
const charset = "hz-gb-2312";
function dumpStrings(inString, outString) {
var dispIn = "";
@ -28,7 +28,6 @@ function run_test() {
"nsIScriptableUnicodeConverter");
var converter = new ScriptableUnicodeConverter();
converter.isInternal = true;
converter.charset = charset;
var leadByte, trailByte;

View File

@ -0,0 +1,67 @@
/* Test case for bug 90411
*
* Uses nsIConverterInputStream to decode GB_HK test.
*
* Sample text is:
* 问他谁是傻瓜了5分钟但是他谁不要求仍然是一个傻瓜永远
* 我听见 我忘记; 我看见 我记住; 我做 我了解
*/
const sample = "~{NJK{K-JGI59OAK~}5~{7VVS!%235+JG%23,K{K-2;R*GsHTH;JGR;8vI59OS@T6!%23~} ~{NRL}<{~} ~{NRM|<G~}; ~{NR?4<{~} ~{NR<GW!~}; ~{NRWv~} ~{NRAK=b!%23~}";
const expected = "\u95EE\u4ED6\u8C01\u662F\u50BB\u74DC\u4E865\u5206\u949F\u3002\u4F46\u662F\uFF0C\u4ED6\u8C01\u4E0D\u8981\u6C42\u4ECD\u7136\u662F\u4E00\u4E2A\u50BB\u74DC\u6C38\u8FDC\u3002 \u6211\u542C\u89C1 \u6211\u5FD8\u8BB0; \u6211\u770B\u89C1 \u6211\u8BB0\u4F4F; \u6211\u505A \u6211\u4E86\u89E3\u3002";
const charset="HZ-GB-2312";
function testCase(bufferLength)
{
var dataURI = "data:text/plain;charset=" + charset + "," + sample;
var IOService = Components.Constructor("@mozilla.org/network/io-service;1",
"nsIIOService");
var ConverterInputStream =
Components.Constructor("@mozilla.org/intl/converter-input-stream;1",
"nsIConverterInputStream",
"init");
var ios = new IOService();
var channel = ios.newChannel(dataURI, "", null);
var testInputStream = channel.open();
var testConverter = new ConverterInputStream(testInputStream,
charset,
bufferLength,
0xFFFD);
if (!(testConverter instanceof
Components.interfaces.nsIUnicharLineInputStream))
throw "not line input stream";
var outStr = "";
var more;
do {
// read the line and check for eof
var line = {};
more = testConverter.readLine(line);
outStr += line.value;
} while (more);
if (outStr != expected) {
dump("Failed with bufferLength = " + bufferLength + "\n");
if (outStr.length == expected.length) {
for (i = 0; i < outStr.length; ++i) {
if (outStr.charCodeAt(i) != expected.charCodeAt(i)) {
dump(i + ": " + outStr.charCodeAt(i).toString(16) + " != " + expected.charCodeAt(i).toString(16) + "\n");
}
}
}
}
// escape the strings before comparing for better readability
do_check_eq(escape(outStr), escape(expected));
}
function run_test()
{
testCase(32);
testCase(33);
}

View File

@ -30,6 +30,7 @@ support-files =
[test_bug563618.js]
[test_bug601429.js]
[test_bug699673.js]
[test_bug90411.js]
[test_bug715319.euc_jp.js]
[test_bug715319.gb2312.js]
[test_bug715319.dbcs.js]