Bug 797385 - Part 2: Remove ibm864 usage. r=smontagu
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Wed, 10 Oct 2012 06:32:37 -0400
changeset 109849 01cf77723b86b273ce39738a1df99936cca34da1
parent 109848 3bafdb575a2efcf893a73435f68ecf4076f799b5
child 109850 8d0ae7bc88ae6f41329bc546f3d5c98dad9215f7
push id16234
push userryanvm@gmail.com
push dateWed, 10 Oct 2012 10:32:49 +0000
treeherdermozilla-inbound@dee0f227e656 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmontagu
bugs797385
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 797385 - Part 2: Remove ibm864 usage. r=smontagu
content/html/document/src/nsHTMLDocument.cpp
dom/encoding/EncodingUtils.cpp
dom/encoding/EncodingUtils.h
dom/encoding/test/unit/test_singlebytes.js
dom/locales/en-US/chrome/charsetTitles.properties
dom/plugins/base/nsPluginInstanceOwner.cpp
intl/uconv/tests/unit/test_decode_CP864.js
intl/uconv/tests/unit/test_encode_CP864.js
layout/base/nsPresContext.cpp
modules/libpref/src/init/all.js
toolkit/components/search/nsSearchService.js
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -628,18 +628,16 @@ nsHTMLDocument::StartDocumentLoad(const 
     } else {
       mParser->MarkAsNotScriptCreated(aCommand);
     }
   } else {
     mParser = do_CreateInstance(kCParserCID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
-  int32_t textType = GET_BIDI_OPTION_TEXTTYPE(GetBidiOptions());
-
   // Look for the parent document.  Note that at this point we don't have our
   // content viewer set up yet, and therefore do not have a useful
   // mParentDocument.
 
   // in this block of code, if we get an error result, we return it
   // but if we get a null pointer, that's perfectly legal for parent
   // and parentContentViewer
   nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aContainer));
@@ -784,23 +782,16 @@ nsHTMLDocument::StartDocumentLoad(const 
         // Don't propagate this error.
         rv = NS_OK;
       }
       
     } else {
       parserCharset = charset;
       parserCharsetSource = charsetSource;
     }
-
-    // ahmed
-    // Check if 864 but in Implicit mode !
-    if ((textType == IBMBIDI_TEXTTYPE_LOGICAL) &&
-        (charset.LowerCaseEqualsLiteral("ibm864"))) {
-      charset.AssignLiteral("IBM864i");
-    }
   }
 
   SetDocumentCharacterSetSource(charsetSource);
   SetDocumentCharacterSet(charset);
 
   // set doc charset to muCV for next document.
   // Don't propagate this back up to the parent document if we have one.
   if (muCV && !muCVIsParent)
--- a/dom/encoding/EncodingUtils.cpp
+++ b/dom/encoding/EncodingUtils.cpp
@@ -15,20 +15,16 @@ struct LabelEncoding
   const char* mLabel;
   const char* mEncoding;
 };
 
 static const LabelEncoding labelsEncodings[] = {
   {"unicode-1-1-utf-8", "utf-8"},
   {"utf-8", "utf-8"},
   {"utf8", "utf-8"},
-  {"cp864", "ibm864"},
-  {"csibm864", "ibm864"},
-  {"ibm-864", "ibm864"},
-  {"ibm864", "ibm864"},
   {"866", "ibm866"},
   {"cp866", "ibm866"},
   {"csibm866", "ibm866"},
   {"ibm866", "ibm866"},
   {"csisolatin2", "iso-8859-2"},
   {"iso-8859-2", "iso-8859-2"},
   {"iso-ir-101", "iso-8859-2"},
   {"iso8859-2", "iso-8859-2"},
--- a/dom/encoding/EncodingUtils.h
+++ b/dom/encoding/EncodingUtils.h
@@ -13,47 +13,47 @@ namespace dom {
 
 class EncodingUtils
 {
 public:
   NS_INLINE_DECL_REFCOUNTING(EncodingUtils)
 
   /**
    * Implements decode algorithm's step 1 & 2 from Encoding spec.
-   * http://dvcs.w3.org/hg/encoding/raw-file/tip/Overview.html#decode
+   * http://encoding.spec.whatwg.org/#decode
    *
    * @param     aData, incoming byte stream of data.
    * @param     aLength, incoming byte stream length.
    * @param     aRetval, outgoing encoding corresponding to valid data
    *            byte order mark.
    * @return    offset after the BOM bytes in byte stream
    *            where the actual data starts.
    */
   static uint32_t IdentifyDataOffset(const char* aData,
                                      const uint32_t aLength,
                                      const char*& aRetval);
 
   /**
    * Implements get an encoding algorithm from Encoding spec.
-   * http://dvcs.w3.org/hg/encoding/raw-file/tip/Overview.html#concept-encoding-get
+   * http://encoding.spec.whatwg.org/#concept-encoding-get
    * Given a label, this function returns the corresponding encoding or a
    * false.
    *
    * @param      aLabel, incoming label describing charset to be decoded.
    * @param      aRetEncoding, returning corresponding encoding for label.
    * @return     false if no encoding was found for label.
    *             true if valid encoding found.
    */
   static bool FindEncodingForLabel(const nsAString& aLabel,
                                    const char*& aOutEncoding);
 
   /**
    * Remove any leading and trailing space characters, following the
    * definition of space characters from Encoding spec.
-   * http://dvcs.w3.org/hg/encoding/raw-file/tip/Overview.html#terminology
+   * http://encoding.spec.whatwg.org/#terminology
    * Note that nsAString::StripWhitespace() doesn't exactly match the
    * definition. It also removes all matching chars in the string,
    * not just leading and trailing.
    *
    * @param      aString, string to be trimmed.
    */
   static void TrimSpaceCharacters(nsString& aString)
   {
--- a/dom/encoding/test/unit/test_singlebytes.js
+++ b/dom/encoding/test/unit/test_singlebytes.js
@@ -327,35 +327,35 @@ test(
     var expected = "\u306B\u307B\u3093"; // Nihon
     equal(TextDecoder("shift_jis").decode(new Uint8Array(jis)), expected);
   });
 
 test(
   "Supersets of ASCII decode ASCII correctly",
   38,
   function () {
-    var encodings = ["utf-8", "ibm864", "ibm866", "iso-8859-2", "iso-8859-3", "iso-8859-4", "iso-8859-5", "iso-8859-6", "iso-8859-7", "iso-8859-8", "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", "iso-2022-kr"];
+    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-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", "iso-2022-kr"];
 
     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;
         if (encoding === "iso-2022-kr" && (i === 0x0E || i === 0x0F || i === 0x1B))
           continue;
         // TODO: Gecko decoder bugs
-        if (encoding === "ibm864" && i === 0x25)
-          continue;
         if ((encoding === "big5" || encoding === "euc-kr") && i === 0x7F)
           continue;
 
         string += String.fromCharCode(i);
         bytes.push(i);
       }
       var ascii_encoded = TextEncoder('utf-8').encode(string);
       equal(TextDecoder(encoding).decode(ascii_encoded), string, encoding);
-      //arrayEqual(TextEncoder(encoding).encode(string), bytes, encoding);
+      if (encoding === "utf-8") {
+        arrayEqual(TextEncoder(encoding).encode(string), bytes, encoding);
+      }
     });
   });
--- a/dom/locales/en-US/chrome/charsetTitles.properties
+++ b/dom/locales/en-US/chrome/charsetTitles.properties
@@ -79,17 +79,16 @@ windows-1255.title = Hebrew (Windows-125
 windows-1256.title = Arabic (Windows-1256)
 x-user-defined.title = User Defined
 ibm866.title = Cyrillic/Russian (CP-866)
 ibm850.title = Western (IBM-850)
 ibm852.title = Central European (IBM-852)
 ibm855.title = Cyrillic (IBM-855)
 ibm857.title = Turkish (IBM-857)
 ibm862.title = Hebrew (IBM-862)
-ibm864.title = Arabic (IBM-864)
 ibm864i.title = Arabic (IBM-864-I)
 gb18030.title = Chinese Simplified (GB18030)
 x-mac-arabic.title = Arabic (MacArabic)
 x-iso-8859-6-8-x.title = Arabic (Langbox ISO-8859-6.8x)
 x-iso-8859-6-16.title = Arabic (Langbox ISO-8859-6.16)
 x-mac-farsi.title = Farsi (MacFarsi)
 x-mac-hebrew.title = Hebrew (MacHebrew)
 x-mac-devanagari.title = Hindi (MacDevanagari)
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -961,17 +961,16 @@ typedef struct {
 static const moz2javaCharset charsets[] = 
 {
     {"windows-1252",    "Cp1252"},
     {"IBM850",          "Cp850"},
     {"IBM852",          "Cp852"},
     {"IBM855",          "Cp855"},
     {"IBM857",          "Cp857"},
     {"IBM828",          "Cp862"},
-    {"IBM864",          "Cp864"},
     {"IBM866",          "Cp866"},
     {"windows-1250",    "Cp1250"},
     {"windows-1251",    "Cp1251"},
     {"windows-1253",    "Cp1253"},
     {"windows-1254",    "Cp1254"},
     {"windows-1255",    "Cp1255"},
     {"windows-1256",    "Cp1256"},
     {"windows-1257",    "Cp1257"},
--- a/intl/uconv/tests/unit/test_decode_CP864.js
+++ b/intl/uconv/tests/unit/test_decode_CP864.js
@@ -4,10 +4,10 @@ load('CharsetConversionTests.js');
 	
 const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9d\x9e\xa0\xa1\xa2\xa3\xa4\xa5\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe";
     
 const expectedString = " !\"#$\u066a&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00b0\u00b7\u2219\u221a\u2592\u2500\u2502\u253c\u2524\u252c\u251c\u2534\u2510\u250c\u2514\u2518\u03b2\u221e\u03c6\u00b1\u00bd\u00bc\u2248\u00ab\u00bb\ufef7\ufef8\ufefb\ufefc\u00a0\u00ad\ufe82\u00a3\u00a4\ufe84\u20ac\ufe8e\ufe8f\ufe95\ufe99\u060c\ufe9d\ufea1\ufea5\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\ufed1\u061b\ufeb1\ufeb5\ufeb9\u061f\u00a2\ufe80\ufe81\ufe83\ufe85\ufeca\ufe8b\ufe8d\ufe91\ufe93\ufe97\ufe9b\ufe9f\ufea3\ufea7\ufea9\ufeab\ufead\ufeaf\ufeb3\ufeb7\ufebb\ufebf\ufec1\ufec5\ufecb\ufecf\u00a6\u00ac\u00f7\u00d7\ufec9\u0640\ufed3\ufed7\ufedb\ufedf\ufee3\ufee7\ufeeb\ufeed\ufeef\ufef3\ufebd\ufecc\ufece\ufecd\ufee1\ufe7d\u0651\ufee5\ufee9\ufeec\ufef0\ufef2\ufed0\ufed5\ufef5\ufef6\ufedd\ufed9\ufef1\u25a0";
 
 const aliases = [ "IBM864", "ibm864", "cp864", "864", "csibm864", "ibm-864" ];
 
 function run_test() {
-  testDecodeAliases();
+  testDecodeAliasesInternal();
 }
--- a/intl/uconv/tests/unit/test_encode_CP864.js
+++ b/intl/uconv/tests/unit/test_encode_CP864.js
@@ -4,10 +4,10 @@ load('CharsetConversionTests.js');
 	
 const inString = " !\"#$\u066a&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00b0\u00b7\u2219\u221a\u2592\u2500\u2502\u253c\u2524\u252c\u251c\u2534\u2510\u250c\u2514\u2518\u03b2\u221e\u03c6\u00b1\u00bd\u00bc\u2248\u00ab\u00bb\ufef7\ufef8\ufefb\ufefc\u00a0\u00ad\ufe82\u00a3\u00a4\ufe84\u20ac\ufe8e\ufe8f\ufe95\ufe99\u060c\ufe9d\ufea1\ufea5\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\ufed1\u061b\ufeb1\ufeb5\ufeb9\u061f\u00a2\ufe80\ufe81\ufe83\ufe85\ufeca\ufe8b\ufe8d\ufe91\ufe93\ufe97\ufe9b\ufe9f\ufea3\ufea7\ufea9\ufeab\ufead\ufeaf\ufeb3\ufeb7\ufebb\ufebf\ufec1\ufec5\ufecb\ufecf\u00a6\u00ac\u00f7\u00d7\ufec9\u0640\ufed3\ufed7\ufedb\ufedf\ufee3\ufee7\ufeeb\ufeed\ufeef\ufef3\ufebd\ufecc\ufece\ufecd\ufee1\ufe7d\u0651\ufee5\ufee9\ufeec\ufef0\ufef2\ufed0\ufed5\ufef5\ufef6\ufedd\ufed9\ufef1\u25a0";
     
 const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9d\x9e\xa0\xa1\xa2\xa3\xa4\xa5\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe";
 
 const aliases = [ "IBM864", "ibm864", "cp864", "864", "csibm864", "ibm-864" ];
 
 function run_test() {
-  testEncodeAliases();
+  testEncodeAliasesInternal();
 }
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -168,18 +168,17 @@ nsPresContext::PrefChangedUpdateTimerCal
   if (presContext)
     presContext->UpdateAfterPreferencesChanged();
 }
 
 #ifdef IBMBIDI
 static bool
 IsVisualCharset(const nsCString& aCharset)
 {
-  if (aCharset.LowerCaseEqualsLiteral("ibm864")             // Arabic//ahmed
-      || aCharset.LowerCaseEqualsLiteral("ibm862")          // Hebrew
+  if (aCharset.LowerCaseEqualsLiteral("ibm862")             // Hebrew
       || aCharset.LowerCaseEqualsLiteral("iso-8859-8") ) {  // Hebrew
     return true; // visual text type
   }
   else {
     return false; // logical text type
   }
 }
 #endif // IBMBIDI
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -1255,17 +1255,17 @@ pref("converter.html2txt.header_strategy
 pref("intl.accept_languages",               "chrome://global/locale/intl.properties");
 pref("intl.menuitems.alwaysappendaccesskeys","chrome://global/locale/intl.properties");
 pref("intl.menuitems.insertseparatorbeforeaccesskeys","chrome://global/locale/intl.properties");
 pref("intl.charsetmenu.browser.static",     "chrome://global/locale/intl.properties");
 pref("intl.charsetmenu.browser.more1",      "ISO-8859-1, ISO-8859-15, IBM850, x-mac-roman, windows-1252, ISO-8859-14, ISO-8859-7, x-mac-greek, windows-1253, x-mac-icelandic, ISO-8859-10, ISO-8859-3");
 pref("intl.charsetmenu.browser.more2",      "ISO-8859-4, ISO-8859-13, windows-1257, IBM852, ISO-8859-2, x-mac-ce, windows-1250, x-mac-croatian, IBM855, ISO-8859-5, ISO-IR-111, KOI8-R, x-mac-cyrillic, windows-1251, IBM866, KOI8-U, x-mac-ukrainian, ISO-8859-16, x-mac-romanian");
 pref("intl.charsetmenu.browser.more3",      "GB2312, gbk, gb18030, HZ-GB-2312, ISO-2022-CN, Big5, Big5-HKSCS, x-euc-tw, EUC-JP, ISO-2022-JP, Shift_JIS, EUC-KR, x-windows-949, x-johab, ISO-2022-KR");
 pref("intl.charsetmenu.browser.more4",      "armscii-8, TIS-620, ISO-8859-11, windows-874, IBM857, ISO-8859-9, x-mac-turkish, windows-1254, x-viet-tcvn5712, VISCII, x-viet-vps, windows-1258, x-mac-devanagari, x-mac-gujarati, x-mac-gurmukhi");
-pref("intl.charsetmenu.browser.more5",      "ISO-8859-6, windows-1256, IBM864, ISO-8859-8-I, windows-1255, ISO-8859-8, IBM862");
+pref("intl.charsetmenu.browser.more5",      "ISO-8859-6, windows-1256, ISO-8859-8-I, windows-1255, ISO-8859-8, IBM862");
 pref("intl.charsetmenu.browser.unicode",    "UTF-8, UTF-16LE, UTF-16BE");
 pref("intl.charsetmenu.mailedit",           "chrome://global/locale/intl.properties");
 pref("intl.charsetmenu.browser.cache",      "");
 pref("intl.charsetmenu.mailview.cache",     "");
 pref("intl.charsetmenu.composer.cache",     "");
 pref("intl.charsetmenu.browser.cache.size", 5);
 pref("intl.charset.detector",               "chrome://global/locale/intl.properties");
 pref("intl.charset.default",                "chrome://global-platform/locale/intl.properties");
--- a/toolkit/components/search/nsSearchService.js
+++ b/toolkit/components/search/nsSearchService.js
@@ -452,17 +452,16 @@ function queryCharsetFromCode(aCode) {
   codes[35] = "x-mac-turkish";
   codes[513] = "ISO-8859-1";
   codes[514] = "ISO-8859-2";
   codes[517] = "ISO-8859-5";
   codes[518] = "ISO-8859-6";
   codes[519] = "ISO-8859-7";
   codes[520] = "ISO-8859-8";
   codes[521] = "ISO-8859-9";
-  codes[1049] = "IBM864";
   codes[1280] = "windows-1252";
   codes[1281] = "windows-1250";
   codes[1282] = "windows-1251";
   codes[1283] = "windows-1253";
   codes[1284] = "windows-1254";
   codes[1285] = "windows-1255";
   codes[1286] = "windows-1256";
   codes[1536] = "us-ascii";