Bug 801402 - Reintroduce x-windows-949 hack. r=hsivonen
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Fri, 09 Nov 2012 16:00:26 -0500
changeset 112873 3e88fade2d0cf33adf055163e07a6dce00d81007
parent 112872 1889ff1d55da9596e6ae946d627c16587e620ab8
child 112874 e57d9d6a66aeda907c6db8d331f765b39244faf3
push id23839
push userryanvm@gmail.com
push dateSat, 10 Nov 2012 01:34:49 +0000
treeherderautoland@a47525b93528 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsivonen
bugs801402
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 801402 - Reintroduce x-windows-949 hack. r=hsivonen
dom/encoding/TextDecoder.cpp
dom/encoding/labelsencodings.properties
dom/encoding/test/Makefile.in
dom/encoding/test/test_submit_euckr.html
--- a/dom/encoding/TextDecoder.cpp
+++ b/dom/encoding/TextDecoder.cpp
@@ -201,16 +201,23 @@ TextDecoder::GetEncoding(nsAString& aEnc
   // "utf-16".
   // This workaround should not be exposed to the public API and so "utf-16"
   // is returned by GetEncoding() if the internal encoding name is "utf-16le".
   if (mEncoding.EqualsLiteral("UTF-16LE")) {
     aEncoding.AssignLiteral("utf-16");
     return;
   }
 
+  // Similarly, "x-windows-949" is used for the "euc-kr" family. Therefore, if
+  // the internal encoding name is "x-windows-949", "euc-kr" is returned.
+  if (mEncoding.EqualsLiteral("x-windows-949")) {
+    aEncoding.AssignLiteral("euc-kr");
+    return;
+  }
+
   CopyASCIItoUTF16(mEncoding, aEncoding);
   nsContentUtils::ASCIIToLower(aEncoding);
 }
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(TextDecoder)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(TextDecoder)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TextDecoder)
--- a/dom/encoding/labelsencodings.properties
+++ b/dom/encoding/labelsencodings.properties
@@ -200,24 +200,24 @@ csiso2022jp=ISO-2022-JP
 iso-2022-jp=ISO-2022-JP
 csshiftjis=Shift_JIS
 ms_kanji=Shift_JIS
 shift-jis=Shift_JIS
 shift_jis=Shift_JIS
 sjis=Shift_JIS
 windows-31j=Shift_JIS
 x-sjis=Shift_JIS
-cseuckr=EUC-KR
-csksc56011987=EUC-KR
-euc-kr=EUC-KR
-iso-ir-149=EUC-KR
-korean=EUC-KR
-ks_c_5601-1987=EUC-KR
-ks_c_5601-1989=EUC-KR
-ksc5601=EUC-KR
-ksc_5601=EUC-KR
-windows-949=EUC-KR
+cseuckr=x-windows-949
+csksc56011987=x-windows-949
+euc-kr=x-windows-949
+iso-ir-149=x-windows-949
+korean=x-windows-949
+ks_c_5601-1987=x-windows-949
+ks_c_5601-1989=x-windows-949
+ksc5601=x-windows-949
+ksc_5601=x-windows-949
+windows-949=x-windows-949
 csiso2022kr=ISO-2022-KR
 iso-2022-kr=ISO-2022-KR
 utf-16=UTF-16LE
 utf-16le=UTF-16LE
 utf-16be=UTF-16BE
 x-user-defined=x-user-defined
--- a/dom/encoding/test/Makefile.in
+++ b/dom/encoding/test/Makefile.in
@@ -16,16 +16,17 @@ XPCSHELL_TESTS = unit
 
 MOCHITEST_FILES = \
   test_BOMEncoding.js \
   test_TextDecoder.html \
   test_TextDecoder.js \
   test_TextEncoder.html \
   test_TextEncoder.js \
   test_stringencoding.html \
+  test_submit_euckr.html \
   $(NULL)
 
 MOCHITEST_CHROME_FILES = \
   file_stringencoding.jsm \
   test_stringencoding.xul \
   $(NULL)
 
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/dom/encoding/test/test_submit_euckr.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta charset=utf-8>
+  <title>Test for euc-kr encoded form submission</title>
+  <script type="text/javascript" src="/resources/testharness.js"></script>
+  <script type="text/javascript" src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<iframe name="ifr"></iframe>
+<form accept-charset="euc-kr" action="abc" target="ifr">
+<input type="hidden" name="a" value="&#xAC02;">
+</form>
+<script>
+
+runTest();
+
+function runTest() {
+  var t = async_test("Test for euc-kr encoded form submission");
+  var f = document.forms[0];
+  var ifr = frames.ifr;
+  ifr.onload = function() {
+    t.step(function() {
+      assert_equals("".split.call(ifr.location, "?")[1], "a=%81A");
+    });
+    t.done();
+  };
+  f.submit();
+}
+
+</script>
+</body>
+</html>