Bug 943252 m-c part - Remove dead code related to the old Character Encoding menu implementation. r=Unfocused.
authorHenri Sivonen <hsivonen@hsivonen.fi>
Wed, 30 Apr 2014 10:41:15 +0300
changeset 181353 9eb4f13a78d83b07063d1f0d789a7bd7ac4541d2
parent 181352 c8b374bf936b485e7b1404ca36285f1e47734d06
child 181354 9ff13ffd5f259fd0fc0f444ba95b1fa6c4199b15
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersUnfocused
bugs943252
milestone32.0a1
Bug 943252 m-c part - Remove dead code related to the old Character Encoding menu implementation. r=Unfocused.
browser/components/customizableui/content/panelUI.js
modules/libpref/src/init/all.js
toolkit/components/build/nsToolkitCompsModule.cpp
toolkit/components/intl/moz.build
toolkit/components/intl/nsCharsetMenu.cpp
toolkit/components/intl/nsCharsetMenu.h
toolkit/components/moz.build
toolkit/content/charsetOverlay.js
toolkit/content/charsetOverlay.xul
toolkit/content/customizeCharset.js
toolkit/content/customizeCharset.xul
toolkit/content/jar.mn
toolkit/locales/en-US/chrome/global/charsetOverlay.dtd
toolkit/locales/en-US/chrome/global/customizeCharset.dtd
toolkit/locales/en-US/chrome/global/intl.properties
toolkit/locales/jar.mn
--- a/browser/components/customizableui/content/panelUI.js
+++ b/browser/components/customizableui/content/panelUI.js
@@ -358,27 +358,16 @@ const PanelUI = {
       let iconAnchor =
         document.getAnonymousElementByAttribute(aAnchor, "class",
                                                 "toolbarbutton-icon");
 
       tempPanel.openPopup(iconAnchor || aAnchor, "bottomcenter topright");
     }
   },
 
-  /**
-   * Open a dialog window that allow the user to customize listed character sets.
-   */
-  onCharsetCustomizeCommand: function() {
-    this.hide();
-    window.openDialog("chrome://global/content/customizeCharset.xul",
-                      "PrefWindow",
-                      "chrome,modal=yes,resizable=yes",
-                      "browser");
-  },
-
   onWidgetAfterDOMChange: function(aNode, aNextNode, aContainer, aWasRemoval) {
     if (aContainer != this.contents) {
       return;
     }
     if (aWasRemoval) {
       aNode.removeAttribute("auto-hyphens");
     }
   },
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -1435,27 +1435,16 @@ pref("network.proxy.autoconfig_retry_int
 pref("network.stricttransportsecurity.preloadlist", true);
 
 pref("converter.html2txt.structs",          true); // Output structured phrases (strong, em, code, sub, sup, b, i, u)
 pref("converter.html2txt.header_strategy",  1); // 0 = no indention; 1 = indention, increased with header level; 2 = numbering and slight indention
 
 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, macintosh, 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-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, ISO-8859-8-I, windows-1255, ISO-8859-8, IBM862");
-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.fallback.override",      "");
 pref("intl.charset.fallback.tld",           true);
 pref("intl.ellipsis",                       "chrome://global-platform/locale/intl.properties");
 pref("intl.locale.matchOS",                 false);
 // fallback charset list for Unicode conversion (converting from Unicode)
 // currently used for mail send only to handle symbol characters (e.g Euro, trademark, smartquotes)
 // for ISO-8859-1
--- a/toolkit/components/build/nsToolkitCompsModule.cpp
+++ b/toolkit/components/build/nsToolkitCompsModule.cpp
@@ -15,17 +15,16 @@
 #include "nsParentalControlsServiceWin.h"
 #endif
 
 #include "nsAlertsService.h"
 
 #include "nsDownloadManager.h"
 #include "DownloadPlatform.h"
 #include "nsDownloadProxy.h"
-#include "nsCharsetMenu.h"
 #include "rdf.h"
 
 #include "nsTypeAheadFind.h"
 
 #ifdef MOZ_URL_CLASSIFIER
 #include "ApplicationReputation.h"
 #include "nsUrlClassifierDBService.h"
 #include "nsUrlClassifierStreamUpdater.h"
@@ -106,17 +105,16 @@ NS_DEFINE_NAMED_CID(NS_TYPEAHEADFIND_CID
 #ifdef MOZ_URL_CLASSIFIER
 NS_DEFINE_NAMED_CID(NS_APPLICATION_REPUTATION_SERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERPREFIXSET_CID);
 NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERDBSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERSTREAMUPDATER_CID);
 NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERUTILS_CID);
 #endif
 NS_DEFINE_NAMED_CID(NS_BROWSERSTATUSFILTER_CID);
-NS_DEFINE_NAMED_CID(NS_CHARSETMENU_CID);
 #if defined(USE_MOZ_UPDATER)
 NS_DEFINE_NAMED_CID(NS_UPDATEPROCESSOR_CID);
 #endif
 NS_DEFINE_NAMED_CID(FINALIZATIONWITNESSSERVICE_CID);
 NS_DEFINE_NAMED_CID(NATIVE_OSFILE_INTERNALS_SERVICE_CID);
 
 static const Module::CIDEntry kToolkitCIDs[] = {
   { &kNS_TOOLKIT_APPSTARTUP_CID, false, nullptr, nsAppStartupConstructor },
@@ -133,17 +131,16 @@ static const Module::CIDEntry kToolkitCI
 #ifdef MOZ_URL_CLASSIFIER
   { &kNS_APPLICATION_REPUTATION_SERVICE_CID, false, nullptr, ApplicationReputationServiceConstructor },
   { &kNS_URLCLASSIFIERPREFIXSET_CID, false, nullptr, nsUrlClassifierPrefixSetConstructor },
   { &kNS_URLCLASSIFIERDBSERVICE_CID, false, nullptr, nsUrlClassifierDBServiceConstructor },
   { &kNS_URLCLASSIFIERSTREAMUPDATER_CID, false, nullptr, nsUrlClassifierStreamUpdaterConstructor },
   { &kNS_URLCLASSIFIERUTILS_CID, false, nullptr, nsUrlClassifierUtilsConstructor },
 #endif
   { &kNS_BROWSERSTATUSFILTER_CID, false, nullptr, nsBrowserStatusFilterConstructor },
-  { &kNS_CHARSETMENU_CID, false, nullptr, NS_NewCharsetMenu },
 #if defined(USE_MOZ_UPDATER)
   { &kNS_UPDATEPROCESSOR_CID, false, nullptr, nsUpdateProcessorConstructor },
 #endif
   { &kFINALIZATIONWITNESSSERVICE_CID, false, nullptr, FinalizationWitnessServiceConstructor },
   { &kNATIVE_OSFILE_INTERNALS_SERVICE_CID, false, nullptr, NativeOSFileInternalsServiceConstructor },
   { nullptr }
 };
 
@@ -163,17 +160,16 @@ static const Module::ContractIDEntry kTo
   { NS_APPLICATION_REPUTATION_SERVICE_CONTRACTID, &kNS_APPLICATION_REPUTATION_SERVICE_CID },
   { NS_URLCLASSIFIERPREFIXSET_CONTRACTID, &kNS_URLCLASSIFIERPREFIXSET_CID },
   { NS_URLCLASSIFIERDBSERVICE_CONTRACTID, &kNS_URLCLASSIFIERDBSERVICE_CID },
   { NS_URICLASSIFIERSERVICE_CONTRACTID, &kNS_URLCLASSIFIERDBSERVICE_CID },
   { NS_URLCLASSIFIERSTREAMUPDATER_CONTRACTID, &kNS_URLCLASSIFIERSTREAMUPDATER_CID },
   { NS_URLCLASSIFIERUTILS_CONTRACTID, &kNS_URLCLASSIFIERUTILS_CID },
 #endif
   { NS_BROWSERSTATUSFILTER_CONTRACTID, &kNS_BROWSERSTATUSFILTER_CID },
-  { NS_RDF_DATASOURCE_CONTRACTID_PREFIX NS_CHARSETMENU_PID, &kNS_CHARSETMENU_CID },
 #if defined(USE_MOZ_UPDATER)
   { NS_UPDATEPROCESSOR_CONTRACTID, &kNS_UPDATEPROCESSOR_CID },
 #endif
   { FINALIZATIONWITNESSSERVICE_CONTRACTID, &kFINALIZATIONWITNESSSERVICE_CID },
   { NATIVE_OSFILE_INTERNALS_SERVICE_CONTRACTID, &kNATIVE_OSFILE_INTERNALS_SERVICE_CID },
   { nullptr }
 };
 
deleted file mode 100644
--- a/toolkit/components/intl/moz.build
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-SOURCES += [
-    'nsCharsetMenu.cpp',
-]
-
-FINAL_LIBRARY = 'toolkitcomps'
deleted file mode 100644
--- a/toolkit/components/intl/nsCharsetMenu.cpp
+++ /dev/null
@@ -1,1797 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsIServiceManager.h"
-#include "nsIComponentManager.h" 
-#include "rdf.h"
-#include "nsIRDFDataSource.h"
-#include "nsIRDFService.h"
-#include "nsIRDFContainerUtils.h"
-#include "nsRDFCID.h"
-#include "nsXPIDLString.h"
-#include "nsCharsetMenu.h"
-#include "nsICharsetConverterManager.h"
-#include "nsICollation.h"
-#include "nsCollationCID.h"
-#include "nsILocaleService.h"
-#include "nsIPrefService.h"
-#include "nsIPrefBranch.h"
-#include "nsIPrefLocalizedString.h"
-#include "nsICurrentCharsetListener.h"
-#include "nsQuickSort.h"
-#include "nsIObserver.h"
-#include "nsStringEnumerator.h"
-#include "nsTArray.h"
-#include "nsIObserverService.h"
-#include "nsIRequestObserver.h"
-#include "nsCRT.h"
-#include "prmem.h"
-#include "mozilla/ModuleUtils.h"
-#include "nsCycleCollectionParticipant.h"
-
-//----------------------------------------------------------------------------
-// Global functions and data [declaration]
-
-static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
-static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
-static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
-static NS_DEFINE_CID(kRDFContainerCID, NS_RDFCONTAINER_CID);
-
-static const char kURINC_BrowserAutodetMenuRoot[] = "NC:BrowserAutodetMenuRoot";
-static const char kURINC_BrowserCharsetMenuRoot[] = "NC:BrowserCharsetMenuRoot";
-static const char kURINC_BrowserMoreCharsetMenuRoot[] = "NC:BrowserMoreCharsetMenuRoot";
-static const char kURINC_BrowserMore1CharsetMenuRoot[] = "NC:BrowserMore1CharsetMenuRoot";
-static const char kURINC_BrowserMore2CharsetMenuRoot[] = "NC:BrowserMore2CharsetMenuRoot";
-static const char kURINC_BrowserMore3CharsetMenuRoot[] = "NC:BrowserMore3CharsetMenuRoot";
-static const char kURINC_BrowserMore4CharsetMenuRoot[] = "NC:BrowserMore4CharsetMenuRoot";
-static const char kURINC_BrowserMore5CharsetMenuRoot[] = "NC:BrowserMore5CharsetMenuRoot";
-static const char kURINC_MaileditCharsetMenuRoot[] = "NC:MaileditCharsetMenuRoot";
-static const char kURINC_MailviewCharsetMenuRoot[] = "NC:MailviewCharsetMenuRoot";
-static const char kURINC_ComposerCharsetMenuRoot[] = "NC:ComposerCharsetMenuRoot";
-static const char kURINC_DecodersRoot[] = "NC:DecodersRoot";
-static const char kURINC_EncodersRoot[] = "NC:EncodersRoot";
-DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Name);
-DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, BookmarkSeparator);
-DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, CharsetDetector);
-DEFINE_RDF_VOCAB(RDF_NAMESPACE_URI, NC, type);
-
-// Note here that browser and mailview have the same static area and cache 
-// size but the cache itself is separate.
-
-#define kBrowserStaticPrefKey       "intl.charsetmenu.browser.static"
-#define kBrowserCachePrefKey        "intl.charsetmenu.browser.cache"
-#define kBrowserCacheSizePrefKey    "intl.charsetmenu.browser.cache.size"
-
-#define kMailviewStaticPrefKey      "intl.charsetmenu.browser.static"
-#define kMailviewCachePrefKey       "intl.charsetmenu.mailview.cache"
-#define kMailviewCacheSizePrefKey   "intl.charsetmenu.browser.cache.size"
-
-#define kComposerStaticPrefKey      "intl.charsetmenu.browser.static"
-#define kComposerCachePrefKey       "intl.charsetmenu.composer.cache"
-#define kComposerCacheSizePrefKey   "intl.charsetmenu.browser.cache.size"
-
-#define kMaileditPrefKey            "intl.charsetmenu.mailedit"
-
-//----------------------------------------------------------------------------
-// Class nsMenuEntry [declaration]
-
-/**
- * A little class holding all data needed for a menu item.
- *
- * @created         18/Apr/2000
- * @author  Catalin Rotaru [CATA]
- */
-class nsMenuEntry
-{
-public: 
-  // memory & ref counting & leak prevention stuff
-  nsMenuEntry() { MOZ_COUNT_CTOR(nsMenuEntry); }
-  ~nsMenuEntry() { MOZ_COUNT_DTOR(nsMenuEntry); }
-
-  nsAutoCString mCharset;
-  nsAutoString      mTitle;
-};
-
-//----------------------------------------------------------------------------
-// Class nsCharsetMenu [declaration]
-
-/**
- * The Charset Converter menu.
- *
- * God, our GUI programming disgusts me.
- *
- * @created         23/Nov/1999
- * @author  Catalin Rotaru [CATA]
- */
-class nsCharsetMenu : public nsIRDFDataSource, public nsICurrentCharsetListener
-{
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsCharsetMenu, nsIRDFDataSource)
-
-private:
-  static nsIRDFResource * kNC_BrowserAutodetMenuRoot;
-  static nsIRDFResource * kNC_BrowserCharsetMenuRoot;
-  static nsIRDFResource * kNC_BrowserMoreCharsetMenuRoot;
-  static nsIRDFResource * kNC_BrowserMore1CharsetMenuRoot;
-  static nsIRDFResource * kNC_BrowserMore2CharsetMenuRoot;
-  static nsIRDFResource * kNC_BrowserMore3CharsetMenuRoot;
-  static nsIRDFResource * kNC_BrowserMore4CharsetMenuRoot;
-  static nsIRDFResource * kNC_BrowserMore5CharsetMenuRoot;
-  static nsIRDFResource * kNC_MaileditCharsetMenuRoot;
-  static nsIRDFResource * kNC_MailviewCharsetMenuRoot;
-  static nsIRDFResource * kNC_ComposerCharsetMenuRoot;
-  static nsIRDFResource * kNC_DecodersRoot;
-  static nsIRDFResource * kNC_EncodersRoot;
-  static nsIRDFResource * kNC_Name;
-  static nsIRDFResource * kNC_CharsetDetector;
-  static nsIRDFResource * kNC_BookmarkSeparator;
-  static nsIRDFResource * kRDF_type;
-
-  static nsIRDFDataSource * mInner;
-
-  bool mInitialized;
-  bool mMailviewMenuInitialized;
-  bool mComposerMenuInitialized;
-  bool mMaileditMenuInitialized;
-  bool mSecondaryTiersInitialized;
-  bool mAutoDetectInitialized;
-  bool mOthersInitialized;
-
-  nsTArray<nsMenuEntry*> mMailviewMenu;
-  int32_t                mMailviewCacheStart;
-  int32_t                mMailviewCacheSize;
-  int32_t                mMailviewMenuRDFPosition;
-
-  nsTArray<nsMenuEntry*> mComposerMenu;
-  int32_t                mComposerCacheStart;
-  int32_t                mComposerCacheSize;
-  int32_t                mComposerMenuRDFPosition;
-
-  nsCOMPtr<nsIRDFService>               mRDFService;
-  nsCOMPtr<nsICharsetConverterManager> mCCManager;
-  nsCOMPtr<nsIPrefBranch>               mPrefs;
-  nsCOMPtr<nsIObserver>                 mCharsetMenuObserver;
-  nsTArray<nsCString>                   mDecoderList;
-
-  nsresult Done();
-
-  nsresult FreeResources();
-
-  nsresult InitStaticMenu(nsTArray<nsCString>& aDecs,
-                          nsIRDFResource * aResource,
-                          const char * aKey,
-                          nsTArray<nsMenuEntry*> * aArray);
-  nsresult InitCacheMenu(nsTArray<nsCString>& aDecs,
-                         nsIRDFResource * aResource,
-                         const char * aKey,
-                         nsTArray<nsMenuEntry*> * aArray);
-  
-  nsresult InitMoreMenu(nsTArray<nsCString>& aDecs,
-                        nsIRDFResource * aResource,
-                        const char * aFlag);
-  
-  nsresult InitMoreSubmenus(nsTArray<nsCString>& aDecs);
-
-  static nsresult SetArrayFromEnumerator(nsIUTF8StringEnumerator* aEnumerator,
-                                         nsTArray<nsCString>& aArray);
-  
-  nsresult AddCharsetToItemArray(nsTArray<nsMenuEntry*>* aArray,
-                                 const nsAFlatCString& aCharset,
-                                 nsMenuEntry ** aResult,
-                                 int32_t aPlace);
-  nsresult AddCharsetArrayToItemArray(nsTArray<nsMenuEntry*> &aArray,
-                                      const nsTArray<nsCString>& aCharsets);
-  nsresult AddMenuItemToContainer(nsIRDFContainer * aContainer,
-    nsMenuEntry * aItem, nsIRDFResource * aType, const char * aIDPrefix,
-    int32_t aPlace);
-  nsresult AddMenuItemArrayToContainer(nsIRDFContainer * aContainer,
-    nsTArray<nsMenuEntry*> * aArray, nsIRDFResource * aType);
-  nsresult AddCharsetToContainer(nsTArray<nsMenuEntry*> * aArray,
-                                 nsIRDFContainer * aContainer,
-                                 const nsAFlatCString& aCharset,
-                                 const char * aIDPrefix,
-    int32_t aPlace, int32_t aRDFPlace);
-
-  nsresult AddFromPrefsToMenu(nsTArray<nsMenuEntry*> * aArray,
-                              nsIRDFContainer * aContainer,
-                              const char * aKey,
-                              nsTArray<nsCString>& aDecs,
-                              const char * aIDPrefix);
-  nsresult AddFromNolocPrefsToMenu(nsTArray<nsMenuEntry*> * aArray,
-                                   nsIRDFContainer * aContainer,
-                                   const char * aKey,
-                                   nsTArray<nsCString>& aDecs,
-                                   const char * aIDPrefix);
-  nsresult AddFromStringToMenu(char * aCharsetList,
-                               nsTArray<nsMenuEntry*> * aArray,
-                               nsIRDFContainer * aContainer,
-                               nsTArray<nsCString>& aDecs,
-                               const char * aIDPrefix);
-
-  nsresult AddSeparatorToContainer(nsIRDFContainer * aContainer);
-  nsresult AddCharsetToCache(const nsAFlatCString& aCharset,
-                             nsTArray<nsMenuEntry*> * aArray,
-                             nsIRDFResource * aRDFResource,
-                             uint32_t aCacheStart, uint32_t aCacheSize,
-                             int32_t aRDFPlace);
-
-  nsresult WriteCacheToPrefs(nsTArray<nsMenuEntry*> * aArray, int32_t aCacheStart,
-    const char * aKey);
-  nsresult UpdateCachePrefs(const char * aCacheKey, const char * aCacheSizeKey,
-    const char * aStaticKey, const char16_t * aCharset);
-
-  nsresult ClearMenu(nsIRDFContainer * aContainer, nsTArray<nsMenuEntry*> * aArray);
-  nsresult RemoveLastMenuItem(nsIRDFContainer * aContainer,
-                              nsTArray<nsMenuEntry*> * aArray);
-
-  nsresult RemoveFlaggedCharsets(nsTArray<nsCString>& aList, const nsString& aProp);
-  nsresult NewRDFContainer(nsIRDFDataSource * aDataSource,
-    nsIRDFResource * aResource, nsIRDFContainer ** aResult);
-  void FreeMenuItemArray(nsTArray<nsMenuEntry*> * aArray);
-  int32_t FindMenuItemInArray(const nsTArray<nsMenuEntry*>* aArray,
-                              const nsAFlatCString& aCharset,
-                              nsMenuEntry ** aResult);
-  nsresult ReorderMenuItemArray(nsTArray<nsMenuEntry*> * aArray);
-  nsresult GetCollation(nsICollation ** aCollation);
-
-public:
-  nsCharsetMenu();
-  virtual ~nsCharsetMenu();
-
-  nsresult Init();
-  nsresult InitMaileditMenu();
-  nsresult InitMailviewMenu();
-  nsresult InitComposerMenu();
-  nsresult InitOthers();
-  nsresult InitSecondaryTiers();
-  nsresult InitAutodetMenu();
-  nsresult RefreshMailviewMenu();
-  nsresult RefreshMaileditMenu();
-  nsresult RefreshComposerMenu();
-
-  //--------------------------------------------------------------------------
-  // Interface nsICurrentCharsetListener [declaration]
-
-  NS_IMETHOD SetCurrentCharset(const char16_t * aCharset);
-  NS_IMETHOD SetCurrentMailCharset(const char16_t * aCharset);
-  NS_IMETHOD SetCurrentComposerCharset(const char16_t * aCharset);
-
-  //--------------------------------------------------------------------------
-  // Interface nsIRDFDataSource [declaration]
-
-  NS_DECL_NSIRDFDATASOURCE
-};
-
-//----------------------------------------------------------------------------
-// Global functions and data [implementation]
-
-nsresult
-NS_NewCharsetMenu(nsISupports * aOuter, const nsIID & aIID, 
-                  void ** aResult)
-{
-  if (!aResult) {
-    return NS_ERROR_NULL_POINTER;
-  }
-  if (aOuter) {
-    *aResult = nullptr;
-    return NS_ERROR_NO_AGGREGATION;
-  }
-  nsCharsetMenu* inst = new nsCharsetMenu();
-  if (!inst) {
-    *aResult = nullptr;
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-  nsresult res = inst->QueryInterface(aIID, aResult);
-  if (NS_FAILED(res)) {
-    *aResult = nullptr;
-    delete inst;
-  }
-  return res;
-}
-
-struct charsetMenuSortRecord {
-  nsMenuEntry* item;
-  uint8_t*     key;
-  uint32_t     len;
-
-};
-
-static int CompareMenuItems(const void* aArg1, const void* aArg2, void *data)
-{
-  int32_t res; 
-  nsICollation * collation = (nsICollation *) data;
-  charsetMenuSortRecord *rec1 = (charsetMenuSortRecord *) aArg1;
-  charsetMenuSortRecord *rec2 = (charsetMenuSortRecord *) aArg2;
-
-  collation->CompareRawSortKey(rec1->key, rec1->len, rec2->key, rec2->len, &res);
-
-  return res;
-}
-
-nsresult
-nsCharsetMenu::SetArrayFromEnumerator(nsIUTF8StringEnumerator* aEnumerator,
-                                      nsTArray<nsCString>& aArray)
-{
-  nsresult rv;
-  
-  bool hasMore;
-  rv = aEnumerator->HasMore(&hasMore);
-  
-  nsAutoCString value;
-  while (NS_SUCCEEDED(rv) && hasMore) {
-    rv = aEnumerator->GetNext(value);
-    if (NS_SUCCEEDED(rv))
-      aArray.AppendElement(value);
-
-    rv = aEnumerator->HasMore(&hasMore);
-  }
-
-  return rv;
-}
-  
-
-class nsIgnoreCaseCStringComparator
-{
-  public:
-    bool Equals(const nsACString& a, const nsACString& b) const
-    {
-      return nsCString(a).Equals(b, nsCaseInsensitiveCStringComparator());
-    }
-
-    bool LessThan(const nsACString& a, const nsACString& b) const
-    { 
-      return a < b;
-    }
-};
-
-//----------------------------------------------------------------------------
-// Class nsCharsetMenuObserver
-
-class nsCharsetMenuObserver : public nsIObserver {
-
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIOBSERVER
-
-  nsCharsetMenuObserver(nsCharsetMenu * menu)
-    : mCharsetMenu(menu)
-  {
-  }
-
-  virtual ~nsCharsetMenuObserver() {}
-
-private:
-  nsCharsetMenu* mCharsetMenu;
-};
-
-NS_IMPL_ISUPPORTS(nsCharsetMenuObserver, nsIObserver)
-
-NS_IMETHODIMP nsCharsetMenuObserver::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *someData)
-{
-  nsresult rv = NS_OK;
- 
-  //XUL event handler
-  if (!nsCRT::strcmp(aTopic, "charsetmenu-selected")) {
-    nsDependentString nodeName(someData);
-    rv = mCharsetMenu->Init();
-    if (nodeName.EqualsLiteral("composer")) {
-      rv = mCharsetMenu->InitComposerMenu();
-    }
-    if (nodeName.EqualsLiteral("mailview")) {
-      rv = mCharsetMenu->InitMailviewMenu();
-    }
-    if (nodeName.EqualsLiteral("mailedit")) {
-      rv = mCharsetMenu->InitMaileditMenu();
-      rv = mCharsetMenu->InitOthers();
-    }
-    if (nodeName.EqualsLiteral("more-menu")) {
-      rv = mCharsetMenu->InitSecondaryTiers();
-      rv = mCharsetMenu->InitAutodetMenu();
-    }
-    if (nodeName.EqualsLiteral("other")) {
-      rv = mCharsetMenu->InitOthers();
-      rv = mCharsetMenu->InitMaileditMenu();
-    }
-  }
-   
-   //pref event handler
-  if (!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
-    nsDependentString prefName(someData);
-
-    if (prefName.EqualsLiteral(kBrowserStaticPrefKey)) {
-      // refresh menus which share this pref
-      rv = mCharsetMenu->RefreshMailviewMenu();
-      NS_ENSURE_SUCCESS(rv, rv);
-      rv = mCharsetMenu->RefreshComposerMenu();
-    }
-    else if (prefName.EqualsLiteral(kMaileditPrefKey)) {
-      rv = mCharsetMenu->RefreshMaileditMenu();
-    }
-  }
-
-  return rv;
-}
-
-//----------------------------------------------------------------------------
-// Class nsCharsetMenu [implementation]
-
-NS_IMPL_CYCLE_COLLECTION_CLASS(nsCharsetMenu)
-
-NS_IMPL_CYCLE_COLLECTION_UNLINK_0(nsCharsetMenu)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsCharsetMenu)
-  cb.NoteXPCOMChild(nsCharsetMenu::mInner);
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsCharsetMenu)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(nsCharsetMenu)
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsCharsetMenu)
-  NS_INTERFACE_MAP_ENTRY(nsIRDFDataSource)
-  NS_INTERFACE_MAP_ENTRY(nsICurrentCharsetListener)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIRDFDataSource)
-NS_INTERFACE_MAP_END
-
-nsIRDFDataSource * nsCharsetMenu::mInner = nullptr;
-nsIRDFResource * nsCharsetMenu::kNC_BrowserAutodetMenuRoot = nullptr;
-nsIRDFResource * nsCharsetMenu::kNC_BrowserCharsetMenuRoot = nullptr;
-nsIRDFResource * nsCharsetMenu::kNC_BrowserMoreCharsetMenuRoot = nullptr;
-nsIRDFResource * nsCharsetMenu::kNC_BrowserMore1CharsetMenuRoot = nullptr;
-nsIRDFResource * nsCharsetMenu::kNC_BrowserMore2CharsetMenuRoot = nullptr;
-nsIRDFResource * nsCharsetMenu::kNC_BrowserMore3CharsetMenuRoot = nullptr;
-nsIRDFResource * nsCharsetMenu::kNC_BrowserMore4CharsetMenuRoot = nullptr;
-nsIRDFResource * nsCharsetMenu::kNC_BrowserMore5CharsetMenuRoot = nullptr;
-nsIRDFResource * nsCharsetMenu::kNC_MaileditCharsetMenuRoot = nullptr;
-nsIRDFResource * nsCharsetMenu::kNC_MailviewCharsetMenuRoot = nullptr;
-nsIRDFResource * nsCharsetMenu::kNC_ComposerCharsetMenuRoot = nullptr;
-nsIRDFResource * nsCharsetMenu::kNC_DecodersRoot = nullptr;
-nsIRDFResource * nsCharsetMenu::kNC_EncodersRoot = nullptr;
-nsIRDFResource * nsCharsetMenu::kNC_Name = nullptr;
-nsIRDFResource * nsCharsetMenu::kNC_CharsetDetector = nullptr;
-nsIRDFResource * nsCharsetMenu::kNC_BookmarkSeparator = nullptr;
-nsIRDFResource * nsCharsetMenu::kRDF_type = nullptr;
-
-nsCharsetMenu::nsCharsetMenu() 
-: mInitialized(false), 
-  mMailviewMenuInitialized(false),
-  mComposerMenuInitialized(false),
-  mMaileditMenuInitialized(false),
-  mSecondaryTiersInitialized(false),
-  mAutoDetectInitialized(false),
-  mOthersInitialized(false)
-{
-  nsresult res = NS_OK;
-
-  //get charset manager
-  mCCManager = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &res);
-
-  //initialize skeleton RDF source
-  mRDFService = do_GetService(kRDFServiceCID, &res);
-
-  if (NS_SUCCEEDED(res))  {
-    mRDFService->RegisterDataSource(this, false);
-  
-    CallCreateInstance(kRDFInMemoryDataSourceCID, &mInner);
-
-    mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BrowserCharsetMenuRoot),
-                             &kNC_BrowserCharsetMenuRoot);
-  }
-
-  //get pref service
-  nsCOMPtr<nsIPrefService> PrefService = do_GetService(NS_PREFSERVICE_CONTRACTID, &res);
-  if (NS_SUCCEEDED(res))
-    res = PrefService->GetBranch(nullptr, getter_AddRefs(mPrefs));
-
-  //register event listener
-  mCharsetMenuObserver = new nsCharsetMenuObserver(this);
-
-  if (mCharsetMenuObserver)  {
-    nsCOMPtr<nsIObserverService> observerService = 
-             do_GetService("@mozilla.org/observer-service;1", &res);
-
-    if (NS_SUCCEEDED(res))
-      res = observerService->AddObserver(mCharsetMenuObserver, 
-                                         "charsetmenu-selected", 
-                                         false);
-  }
-
-  NS_ASSERTION(NS_SUCCEEDED(res), "Failed to initialize nsCharsetMenu");
-}
-
-nsCharsetMenu::~nsCharsetMenu() 
-{
-  Done();
-
-  FreeMenuItemArray(&mMailviewMenu);
-  FreeMenuItemArray(&mComposerMenu);
-
-  FreeResources();
-}
-
-nsresult nsCharsetMenu::RefreshMailviewMenu()
-{
-  nsresult res = NS_OK;
-
-  nsCOMPtr<nsIRDFContainer> container;
-  res = NewRDFContainer(mInner, kNC_MailviewCharsetMenuRoot, getter_AddRefs(container));
-  if (NS_FAILED(res)) return res;
-
-  // clean the menu
-  res = ClearMenu(container, &mMailviewMenu);
-  if (NS_FAILED(res)) return res;
-
-  nsCOMPtr<nsIUTF8StringEnumerator> decoders;
-  res = mCCManager->GetDecoderList(getter_AddRefs(decoders));
-  if (NS_FAILED(res)) return res;
-
-  nsTArray<nsCString> decs;
-  SetArrayFromEnumerator(decoders, decs);
-  
-  res = AddFromPrefsToMenu(&mMailviewMenu, container, kMailviewStaticPrefKey, 
-                           decs, "charset.");
-  NS_ASSERTION(NS_SUCCEEDED(res), "error initializing static charset menu from prefs");
-
-  // mark the end of the static area, the rest is cache
-  mMailviewCacheStart = mMailviewMenu.Length();
-
-  res = InitCacheMenu(decs, kNC_MailviewCharsetMenuRoot, 
-    kMailviewCachePrefKey, &mMailviewMenu);
-  NS_ASSERTION(NS_SUCCEEDED(res), "error initializing mailview cache charset menu");
-
-  return res;
-}
-
-nsresult nsCharsetMenu::RefreshMaileditMenu()
-{
-  nsresult res;
-
-  nsCOMPtr<nsIRDFContainer> container;
-  res = NewRDFContainer(mInner, kNC_MaileditCharsetMenuRoot, getter_AddRefs(container));
-  NS_ENSURE_SUCCESS(res, res);
-
-  nsCOMPtr<nsISimpleEnumerator> enumerator;
-  res = container->GetElements(getter_AddRefs(enumerator));
-  NS_ENSURE_SUCCESS(res, res);
-
-  // clear the menu
-  nsCOMPtr<nsISupports> supports;
-  while (NS_SUCCEEDED(enumerator->GetNext(getter_AddRefs(supports)))) {
-    nsCOMPtr<nsIRDFNode> node = do_QueryInterface(supports);
-
-    res = mInner->Unassert(kNC_MaileditCharsetMenuRoot, kNC_Name, node);
-    NS_ENSURE_SUCCESS(res, res);
-
-    res = container->RemoveElement(node, false);
-    NS_ENSURE_SUCCESS(res, res);
-  }
-
-  // get a list of available encoders
-  nsCOMPtr<nsIUTF8StringEnumerator> encoders;
-  res = mCCManager->GetEncoderList(getter_AddRefs(encoders));
-  NS_ENSURE_SUCCESS(res, res);
-
-  nsTArray<nsCString> encs;
-  SetArrayFromEnumerator(encoders, encs);
-  
-  // add menu items from pref
-  res = AddFromPrefsToMenu(nullptr, container, kMaileditPrefKey, encs, nullptr);
-  NS_ASSERTION(NS_SUCCEEDED(res), "error initializing mailedit charset menu from prefs");
-
-  return res;
-}
-
-nsresult nsCharsetMenu::RefreshComposerMenu()
-{
-  nsresult res = NS_OK;
-
-  nsCOMPtr<nsIRDFContainer> container;
-  res = NewRDFContainer(mInner, kNC_ComposerCharsetMenuRoot, getter_AddRefs(container));
-  if (NS_FAILED(res)) return res;
-
-  // clean the menu
-  res = ClearMenu(container, &mComposerMenu);
-  if (NS_FAILED(res)) return res;
-
-  nsCOMPtr<nsIUTF8StringEnumerator> decoders;
-  res = mCCManager->GetDecoderList(getter_AddRefs(decoders));
-  if (NS_FAILED(res)) return res;
-
-  nsTArray<nsCString> decs;
-  SetArrayFromEnumerator(decoders, decs);
-  
-  res = AddFromPrefsToMenu(&mComposerMenu, container, kComposerStaticPrefKey, 
-                           decs, "charset.");
-  NS_ASSERTION(NS_SUCCEEDED(res), "error initializing static charset menu from prefs");
-
-  // mark the end of the static area, the rest is cache
-  mComposerCacheStart = mComposerMenu.Length();
-
-  res = InitCacheMenu(decs, kNC_ComposerCharsetMenuRoot, 
-    kComposerCachePrefKey, &mComposerMenu);
-  NS_ASSERTION(NS_SUCCEEDED(res), "error initializing composer cache charset menu");
-
-  return res;
-}
-
-nsresult nsCharsetMenu::Init() 
-{
-  nsresult res = NS_OK;
-
-  if (!mInitialized)  {
-
-    //enumerate decoders
-    nsCOMPtr<nsIUTF8StringEnumerator> decoders;
-    res = mCCManager->GetDecoderList(getter_AddRefs(decoders));
-    if (NS_FAILED(res)) return res;
-
-    SetArrayFromEnumerator(decoders, mDecoderList);
-
-    //initialize all remaining RDF template nodes
-    mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BrowserAutodetMenuRoot),
-                             &kNC_BrowserAutodetMenuRoot);
-    mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BrowserMoreCharsetMenuRoot),
-                             &kNC_BrowserMoreCharsetMenuRoot);
-    mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BrowserMore1CharsetMenuRoot),
-                             &kNC_BrowserMore1CharsetMenuRoot);
-    mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BrowserMore2CharsetMenuRoot),
-                             &kNC_BrowserMore2CharsetMenuRoot);
-    mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BrowserMore3CharsetMenuRoot),
-                             &kNC_BrowserMore3CharsetMenuRoot);
-    mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BrowserMore4CharsetMenuRoot),
-                             &kNC_BrowserMore4CharsetMenuRoot);
-    mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BrowserMore5CharsetMenuRoot),
-                             &kNC_BrowserMore5CharsetMenuRoot);
-    mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_MaileditCharsetMenuRoot),
-                             &kNC_MaileditCharsetMenuRoot);
-    mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_MailviewCharsetMenuRoot),
-                             &kNC_MailviewCharsetMenuRoot);
-    mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_ComposerCharsetMenuRoot),
-                             &kNC_ComposerCharsetMenuRoot);
-    mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_DecodersRoot),
-                             &kNC_DecodersRoot);
-    mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_EncodersRoot),
-                             &kNC_EncodersRoot);
-    mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_Name),
-                             &kNC_Name);
-    mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_CharsetDetector),
-                             &kNC_CharsetDetector);
-    mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BookmarkSeparator),
-                             &kNC_BookmarkSeparator);
-    mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_type), &kRDF_type);
-
-    nsIRDFContainerUtils * rdfUtil = nullptr;
-    res = CallGetService(kRDFContainerUtilsCID, &rdfUtil);
-    if (NS_FAILED(res)) goto done;
-
-    res = rdfUtil->MakeSeq(mInner, kNC_BrowserAutodetMenuRoot, nullptr);
-    if (NS_FAILED(res)) goto done;
-    res = rdfUtil->MakeSeq(mInner, kNC_BrowserCharsetMenuRoot, nullptr);
-    if (NS_FAILED(res)) goto done;
-    res = rdfUtil->MakeSeq(mInner, kNC_BrowserMoreCharsetMenuRoot, nullptr);
-    if (NS_FAILED(res)) goto done;
-    res = rdfUtil->MakeSeq(mInner, kNC_BrowserMore1CharsetMenuRoot, nullptr);
-    if (NS_FAILED(res)) goto done;
-    res = rdfUtil->MakeSeq(mInner, kNC_BrowserMore2CharsetMenuRoot, nullptr);
-    if (NS_FAILED(res)) goto done;
-    res = rdfUtil->MakeSeq(mInner, kNC_BrowserMore3CharsetMenuRoot, nullptr);
-    if (NS_FAILED(res)) goto done;
-    res = rdfUtil->MakeSeq(mInner, kNC_BrowserMore4CharsetMenuRoot, nullptr);
-    if (NS_FAILED(res)) goto done;
-    res = rdfUtil->MakeSeq(mInner, kNC_BrowserMore5CharsetMenuRoot, nullptr);
-    if (NS_FAILED(res)) goto done;
-    res = rdfUtil->MakeSeq(mInner, kNC_MaileditCharsetMenuRoot, nullptr);
-    if (NS_FAILED(res)) goto done;
-    res = rdfUtil->MakeSeq(mInner, kNC_MailviewCharsetMenuRoot, nullptr);
-    if (NS_FAILED(res)) goto done;
-    res = rdfUtil->MakeSeq(mInner, kNC_ComposerCharsetMenuRoot, nullptr);
-    if (NS_FAILED(res)) goto done;
-    res = rdfUtil->MakeSeq(mInner, kNC_DecodersRoot, nullptr);
-    if (NS_FAILED(res)) goto done;
-    res = rdfUtil->MakeSeq(mInner, kNC_EncodersRoot, nullptr);
-    if (NS_FAILED(res)) goto done;
-
-  done:
-    NS_IF_RELEASE(rdfUtil);
-    if (NS_FAILED(res)) return res;
-  }
-  mInitialized = NS_SUCCEEDED(res);
-  return res;
-}
-
-nsresult nsCharsetMenu::Done() 
-{
-  nsresult res = NS_OK;
-  res = mRDFService->UnregisterDataSource(this);
-
-  NS_IF_RELEASE(kNC_BrowserAutodetMenuRoot);
-  NS_IF_RELEASE(kNC_BrowserCharsetMenuRoot);
-  NS_IF_RELEASE(kNC_BrowserMoreCharsetMenuRoot);
-  NS_IF_RELEASE(kNC_BrowserMore1CharsetMenuRoot);
-  NS_IF_RELEASE(kNC_BrowserMore2CharsetMenuRoot);
-  NS_IF_RELEASE(kNC_BrowserMore3CharsetMenuRoot);
-  NS_IF_RELEASE(kNC_BrowserMore4CharsetMenuRoot);
-  NS_IF_RELEASE(kNC_BrowserMore5CharsetMenuRoot);
-  NS_IF_RELEASE(kNC_MaileditCharsetMenuRoot);
-  NS_IF_RELEASE(kNC_MailviewCharsetMenuRoot);
-  NS_IF_RELEASE(kNC_ComposerCharsetMenuRoot);
-  NS_IF_RELEASE(kNC_DecodersRoot);
-  NS_IF_RELEASE(kNC_EncodersRoot);
-  NS_IF_RELEASE(kNC_Name);
-  NS_IF_RELEASE(kNC_CharsetDetector);
-  NS_IF_RELEASE(kNC_BookmarkSeparator);
-  NS_IF_RELEASE(kRDF_type);
-  NS_IF_RELEASE(mInner);
-
-  return res;
-}
-
-/**
- * Free the resources no longer needed by the component.
- */
-nsresult nsCharsetMenu::FreeResources()
-{
-  nsresult res = NS_OK;
-
-  if (mCharsetMenuObserver) {
-    mPrefs->RemoveObserver(kBrowserStaticPrefKey, mCharsetMenuObserver);
-    mPrefs->RemoveObserver(kMaileditPrefKey, mCharsetMenuObserver);
-    /* nsIObserverService has to have released nsCharsetMenu already */
-  }
-
-  mRDFService = nullptr;
-  mCCManager  = nullptr;
-  mPrefs      = nullptr;
-
-  return res;
-}
-
-nsresult nsCharsetMenu::InitMaileditMenu() 
-{
-  nsresult res = NS_OK;
-
-  if (!mMaileditMenuInitialized)  {
-    nsCOMPtr<nsIRDFContainer> container;
-    res = NewRDFContainer(mInner, kNC_MaileditCharsetMenuRoot, getter_AddRefs(container));
-    if (NS_FAILED(res)) return res;
-
-    //enumerate encoders
-    // this would bring in a whole bunch of 'font encoders' as well as genuine 
-    // charset encoders, but it's safe because we rely on prefs to filter
-    // them out. Moreover, 'customize' menu lists only genuine charset 
-    // encoders further guarding  against  'font encoders' sneaking in. 
-    nsCOMPtr<nsIUTF8StringEnumerator> encoders;
-    res = mCCManager->GetEncoderList(getter_AddRefs(encoders));
-    if (NS_FAILED(res))  return res;
-
-    nsTArray<nsCString> maileditEncoderList;
-    SetArrayFromEnumerator(encoders, maileditEncoderList);
-  
-    res = AddFromPrefsToMenu(nullptr, container, kMaileditPrefKey,
-                             maileditEncoderList, nullptr);
-    NS_ASSERTION(NS_SUCCEEDED(res), "error initializing mailedit charset menu from prefs");
-
-    // register prefs callback
-    mPrefs->AddObserver(kMaileditPrefKey, mCharsetMenuObserver, false);
-  }
-
-  mMaileditMenuInitialized = NS_SUCCEEDED(res);
-
-  return res;
-}
-
-nsresult nsCharsetMenu::InitMailviewMenu() 
-{
-  nsresult res = NS_OK;
-
-  if (!mMailviewMenuInitialized)  {
-    nsCOMPtr<nsIRDFContainer> container;
-    res = NewRDFContainer(mInner, kNC_MailviewCharsetMenuRoot, getter_AddRefs(container));
-    if (NS_FAILED(res)) return res;
-
-    nsTArray<nsCString> mailviewDecoderList(mDecoderList);
-
-    res = InitStaticMenu(mailviewDecoderList, kNC_MailviewCharsetMenuRoot, 
-                         kMailviewStaticPrefKey, &mMailviewMenu);
-    NS_ASSERTION(NS_SUCCEEDED(res), "error initializing mailview static charset menu");
-
-    // mark the end of the static area, the rest is cache
-    mMailviewCacheStart = mMailviewMenu.Length();
-    mPrefs->GetIntPref(kMailviewCacheSizePrefKey, &mMailviewCacheSize);
-
-    // compute the position of the menu in the RDF container
-    res = container->GetCount(&mMailviewMenuRDFPosition);
-    if (NS_FAILED(res)) return res;
-    // this "1" here is a correction necessary because the RDF container 
-    // elements are numbered from 1 (why god, WHY?!?!?!)
-    mMailviewMenuRDFPosition -= mMailviewCacheStart - 1;
-
-    res = InitCacheMenu(mailviewDecoderList, kNC_MailviewCharsetMenuRoot, 
-      kMailviewCachePrefKey, &mMailviewMenu);
-    NS_ASSERTION(NS_SUCCEEDED(res), "error initializing mailview cache charset menu");
-  }
-
-  mMailviewMenuInitialized = NS_SUCCEEDED(res);
-
-  return res;
-}
-
-nsresult nsCharsetMenu::InitComposerMenu() 
-{
-  nsresult res = NS_OK;
-
-  if (!mComposerMenuInitialized)  {
-    nsCOMPtr<nsIRDFContainer> container;
-    res = NewRDFContainer(mInner, kNC_ComposerCharsetMenuRoot, getter_AddRefs(container));
-    if (NS_FAILED(res)) return res;
-
-    nsTArray<nsCString> composerDecoderList(mDecoderList);
-
-    // even if we fail, the show must go on
-    res = InitStaticMenu(composerDecoderList, kNC_ComposerCharsetMenuRoot, 
-      kComposerStaticPrefKey, &mComposerMenu);
-    NS_ASSERTION(NS_SUCCEEDED(res), "error initializing composer static charset menu");
-
-    // mark the end of the static area, the rest is cache
-    mComposerCacheStart = mComposerMenu.Length();
-    mPrefs->GetIntPref(kComposerCacheSizePrefKey, &mComposerCacheSize);
-
-    // compute the position of the menu in the RDF container
-    res = container->GetCount(&mComposerMenuRDFPosition);
-    if (NS_FAILED(res)) return res;
-    // this "1" here is a correction necessary because the RDF container 
-    // elements are numbered from 1 (why god, WHY?!?!?!)
-    mComposerMenuRDFPosition -= mComposerCacheStart - 1;
-
-    res = InitCacheMenu(composerDecoderList, kNC_ComposerCharsetMenuRoot, 
-      kComposerCachePrefKey, &mComposerMenu);
-    NS_ASSERTION(NS_SUCCEEDED(res), "error initializing composer cache charset menu");
-  }
-
-  mComposerMenuInitialized = NS_SUCCEEDED(res);
-
-  return res;
-}
-
-nsresult nsCharsetMenu::InitOthers() 
-{
-  nsresult res = NS_OK;
-
-  if (!mOthersInitialized) {
-    nsTArray<nsCString> othersDecoderList(mDecoderList);
-
-    res = InitMoreMenu(othersDecoderList, kNC_DecodersRoot, ".notForBrowser");                 
-    if (NS_FAILED(res))  return res;
-
-    // Using mDecoderList instead of GetEncoderList(), we can avoid having to
-    // tag a whole bunch of 'font encoders' with '.notForOutgoing' in 
-    // charsetData.properties file. 
-    nsTArray<nsCString> othersEncoderList(mDecoderList);
-
-    res = InitMoreMenu(othersEncoderList, kNC_EncodersRoot, ".notForOutgoing");                 
-    if (NS_FAILED(res)) return res;
-  }
-
-  mOthersInitialized = NS_SUCCEEDED(res);
-
-  return res;
-}
-
-/**
- * Inits the secondary tiers of the charset menu. Because currently all the CS 
- * menus are sharing the secondary tiers, one should call this method only 
- * once for all of them.
- */
-nsresult nsCharsetMenu::InitSecondaryTiers()
-{
-  nsresult res = NS_OK;
-
-  if (!mSecondaryTiersInitialized)  {
-    nsTArray<nsCString> secondaryTiersDecoderList(mDecoderList);
-
-    res = InitMoreSubmenus(secondaryTiersDecoderList);
-    NS_ASSERTION(NS_SUCCEEDED(res), "err init browser charset more submenus");
-
-    res = InitMoreMenu(secondaryTiersDecoderList, kNC_BrowserMoreCharsetMenuRoot, ".notForBrowser");
-    NS_ASSERTION(NS_SUCCEEDED(res), "err init browser charset more menu");
-  }
-
-  mSecondaryTiersInitialized = NS_SUCCEEDED(res);
-
-  return res;
-}
-
-nsresult nsCharsetMenu::InitStaticMenu(nsTArray<nsCString>& aDecs,
-                                       nsIRDFResource * aResource,
-                                       const char * aKey,
-                                       nsTArray<nsMenuEntry*> * aArray)
-{
-  nsresult res = NS_OK;
-  nsCOMPtr<nsIRDFContainer> container;
-
-  res = NewRDFContainer(mInner, aResource, getter_AddRefs(container));
-  if (NS_FAILED(res)) return res;
-
-  // XXX work around bug that causes the submenus to be first instead of last
-  res = AddSeparatorToContainer(container);
-  NS_ASSERTION(NS_SUCCEEDED(res), "error adding separator to container");
-
-  res = AddFromPrefsToMenu(aArray, container, aKey, aDecs, "charset.");
-  NS_ASSERTION(NS_SUCCEEDED(res), "error initializing static charset menu from prefs");
-
-  return res;
-}
-
-nsresult nsCharsetMenu::InitCacheMenu(
-                        nsTArray<nsCString>& aDecs,
-                        nsIRDFResource * aResource,
-                        const char * aKey,
-                        nsTArray<nsMenuEntry*> * aArray)
-{
-  nsresult res = NS_OK;
-  nsCOMPtr<nsIRDFContainer> container;
-
-  res = NewRDFContainer(mInner, aResource, getter_AddRefs(container));
-  if (NS_FAILED(res)) return res;
-
-  res = AddFromNolocPrefsToMenu(aArray, container, aKey, aDecs, "charset.");
-  NS_ASSERTION(NS_SUCCEEDED(res), "error initializing cache charset menu from prefs");
-
-  return res;
-}
-
-nsresult nsCharsetMenu::InitAutodetMenu()
-{
-  nsresult res = NS_OK;
-
-  if (!mAutoDetectInitialized) {
-    nsTArray<nsMenuEntry*> chardetArray;
-    nsCOMPtr<nsIRDFContainer> container;
-    nsTArray<nsCString> detectorArray;
-
-    res = NewRDFContainer(mInner, kNC_BrowserAutodetMenuRoot, getter_AddRefs(container));
-    if (NS_FAILED(res)) return res;
-
-    nsCOMPtr<nsIUTF8StringEnumerator> detectors;
-    res = mCCManager->GetCharsetDetectorList(getter_AddRefs(detectors));
-    if (NS_FAILED(res)) goto done;
-
-    res = SetArrayFromEnumerator(detectors, detectorArray);
-    if (NS_FAILED(res)) goto done;
-    
-    res = AddCharsetArrayToItemArray(chardetArray, detectorArray);
-    if (NS_FAILED(res)) goto done;
-
-    // reorder the array
-    res = ReorderMenuItemArray(&chardetArray);
-    if (NS_FAILED(res)) goto done;
-
-    res = AddMenuItemArrayToContainer(container, &chardetArray, 
-      kNC_CharsetDetector);
-    if (NS_FAILED(res)) goto done;
-
-  done:
-    // free the elements in the nsTArray<nsMenuEntry*>
-    FreeMenuItemArray(&chardetArray);
-  }
-
-  mAutoDetectInitialized = NS_SUCCEEDED(res);
-
-  return res;
-}
-
-nsresult nsCharsetMenu::InitMoreMenu(nsTArray<nsCString>& aDecs, 
-                                     nsIRDFResource * aResource, 
-                                     const char * aFlag)
-{
-  nsresult res = NS_OK;
-  nsCOMPtr<nsIRDFContainer> container;
-  nsTArray<nsMenuEntry*> moreMenu;
-
-  res = NewRDFContainer(mInner, aResource, getter_AddRefs(container));
-  if (NS_FAILED(res)) goto done;
-
-  // remove charsets "not for browser"
-  res = RemoveFlaggedCharsets(aDecs, NS_ConvertASCIItoUTF16(aFlag));
-  if (NS_FAILED(res)) goto done;
-
-  res = AddCharsetArrayToItemArray(moreMenu, aDecs);
-  if (NS_FAILED(res)) goto done;
-
-  // reorder the array
-  res = ReorderMenuItemArray(&moreMenu);
-  if (NS_FAILED(res)) goto done;
-
-  res = AddMenuItemArrayToContainer(container, &moreMenu, nullptr);
-  if (NS_FAILED(res)) goto done;
-
-done:
-  // free the elements in the nsTArray<nsMenuEntry*>
-  FreeMenuItemArray(&moreMenu);
-
-  return res;
-}
-
-// XXX please make this method more general; the cut&pasted code is laughable
-nsresult nsCharsetMenu::InitMoreSubmenus(nsTArray<nsCString>& aDecs)
-{
-  nsresult res = NS_OK;
-
-  nsCOMPtr<nsIRDFContainer> container1;
-  nsCOMPtr<nsIRDFContainer> container2;
-  nsCOMPtr<nsIRDFContainer> container3;
-  nsCOMPtr<nsIRDFContainer> container4;
-  nsCOMPtr<nsIRDFContainer> container5;
-  const char key1[] = "intl.charsetmenu.browser.more1";
-  const char key2[] = "intl.charsetmenu.browser.more2";
-  const char key3[] = "intl.charsetmenu.browser.more3";
-  const char key4[] = "intl.charsetmenu.browser.more4";
-  const char key5[] = "intl.charsetmenu.browser.more5";
-
-  res = NewRDFContainer(mInner, kNC_BrowserMore1CharsetMenuRoot, 
-    getter_AddRefs(container1));
-  if (NS_FAILED(res)) return res;
-  AddFromNolocPrefsToMenu(nullptr, container1, key1, aDecs, nullptr);
-
-  res = NewRDFContainer(mInner, kNC_BrowserMore2CharsetMenuRoot, 
-    getter_AddRefs(container2));
-  if (NS_FAILED(res)) return res;
-  AddFromNolocPrefsToMenu(nullptr, container2, key2, aDecs, nullptr);
-
-  res = NewRDFContainer(mInner, kNC_BrowserMore3CharsetMenuRoot, 
-    getter_AddRefs(container3));
-  if (NS_FAILED(res)) return res;
-  AddFromNolocPrefsToMenu(nullptr, container3, key3, aDecs, nullptr);
-
-  res = NewRDFContainer(mInner, kNC_BrowserMore4CharsetMenuRoot, 
-    getter_AddRefs(container4));
-  if (NS_FAILED(res)) return res;
-  AddFromNolocPrefsToMenu(nullptr, container4, key4, aDecs, nullptr);
-
-  res = NewRDFContainer(mInner, kNC_BrowserMore5CharsetMenuRoot, 
-    getter_AddRefs(container5));
-  if (NS_FAILED(res)) return res;
-  AddFromNolocPrefsToMenu(nullptr, container5, key5, aDecs, nullptr);
-
-  return res;
-}
-
-nsresult nsCharsetMenu::AddCharsetToItemArray(nsTArray<nsMenuEntry*> *aArray,
-                                              const nsAFlatCString& aCharset,
-                                              nsMenuEntry ** aResult,
-                                              int32_t aPlace)
-{
-  nsresult res = NS_OK;
-  nsMenuEntry * item = nullptr; 
-
-  if (aResult != nullptr) *aResult = nullptr;
-  
-  item = new nsMenuEntry();
-  if (item == nullptr) {
-    res = NS_ERROR_OUT_OF_MEMORY;
-    goto done;
-  }
-
-  item->mCharset = aCharset;
-
-  if (NS_FAILED(mCCManager->GetCharsetTitle(aCharset.get(), item->mTitle))) {
-    item->mTitle.AssignWithConversion(aCharset.get());
-  }
-
-  if (aArray != nullptr) {
-    if (aPlace < 0) {
-      aArray->AppendElement(item);
-    } else {
-      aArray->InsertElementsAt(aPlace, 1, item);
-    }
-  }
-
-  if (aResult != nullptr) *aResult = item;
-
-  // if we have made another reference to "item", do not delete it 
-  if ((aArray != nullptr) || (aResult != nullptr)) item = nullptr; 
-
-done:
-  if (item != nullptr) delete item;
-
-  return res;
-}
-
-nsresult
-nsCharsetMenu::AddCharsetArrayToItemArray(nsTArray<nsMenuEntry*>& aArray,
-                                          const nsTArray<nsCString>& aCharsets)
-{
-  uint32_t count = aCharsets.Length();
-
-  for (uint32_t i = 0; i < count; i++) {
-
-    const nsCString& str = aCharsets[i];
-    nsresult res = AddCharsetToItemArray(&aArray, str, nullptr, -1);
-    
-    if (NS_FAILED(res))
-      return res;
-  }
-
-  return NS_OK;
-}
-
-// aPlace < -1 for Remove
-// aPlace < 0 for Append
-nsresult nsCharsetMenu::AddMenuItemToContainer(
-                        nsIRDFContainer * aContainer,
-                        nsMenuEntry * aItem,
-                        nsIRDFResource * aType,
-                        const char * aIDPrefix,
-                        int32_t aPlace) 
-{
-  nsresult res = NS_OK;
-  nsCOMPtr<nsIRDFResource> node;
-
-  nsAutoCString id;
-  if (aIDPrefix != nullptr) id.Assign(aIDPrefix);
-  id.Append(aItem->mCharset);
-
-  // Make up a unique ID and create the RDF NODE
-  res = mRDFService->GetResource(id, getter_AddRefs(node));
-  if (NS_FAILED(res)) return res;
-
-  const char16_t * title = aItem->mTitle.get();
-
-  // set node's title
-  nsCOMPtr<nsIRDFLiteral> titleLiteral;
-  res = mRDFService->GetLiteral(title, getter_AddRefs(titleLiteral));
-  if (NS_FAILED(res)) return res;
-
-  if (aPlace < -1) {
-    res = Unassert(node, kNC_Name, titleLiteral);
-    if (NS_FAILED(res)) return res;
-  } else {
-    res = Assert(node, kNC_Name, titleLiteral, true);
-    if (NS_FAILED(res)) return res;
-  }
-
-  if (aType != nullptr) {
-    if (aPlace < -1) {
-      res = Unassert(node, kRDF_type, aType);
-      if (NS_FAILED(res)) return res;
-    } else {
-      res = Assert(node, kRDF_type, aType, true);
-      if (NS_FAILED(res)) return res;
-    }
-  }
-
-  // Add the element to the container
-  if (aPlace < -1) {
-    res = aContainer->RemoveElement(node, true);
-    if (NS_FAILED(res)) return res;
-  } else if (aPlace < 0) {
-    res = aContainer->AppendElement(node);
-    if (NS_FAILED(res)) return res;
-  } else {
-    res = aContainer->InsertElementAt(node, aPlace, true);
-    if (NS_FAILED(res)) return res;
-  } 
-
-  return res;
-}
-
-nsresult nsCharsetMenu::AddMenuItemArrayToContainer(
-                        nsIRDFContainer * aContainer,
-                        nsTArray<nsMenuEntry*> * aArray,
-                        nsIRDFResource * aType) 
-{
-  uint32_t count = aArray->Length();
-  nsresult res = NS_OK;
-
-  for (uint32_t i = 0; i < count; i++) {
-    nsMenuEntry * item = aArray->ElementAt(i);
-    if (item == nullptr) return NS_ERROR_UNEXPECTED;
-
-    res = AddMenuItemToContainer(aContainer, item, aType, nullptr, -1);
-    if (NS_FAILED(res)) return res;
-  }
-
-  return NS_OK;
-}
-
-nsresult nsCharsetMenu::AddCharsetToContainer(nsTArray<nsMenuEntry*> *aArray,
-                                              nsIRDFContainer * aContainer,
-                                              const nsAFlatCString& aCharset,
-                                              const char * aIDPrefix,
-                                              int32_t aPlace,
-                                              int32_t aRDFPlace)
-{
-  nsresult res = NS_OK;
-  nsMenuEntry * item = nullptr; 
-  
-  res = AddCharsetToItemArray(aArray, aCharset, &item, aPlace);
-  if (NS_FAILED(res)) goto done;
-
-  res = AddMenuItemToContainer(aContainer, item, nullptr, aIDPrefix, 
-    aPlace + aRDFPlace);
-  if (NS_FAILED(res)) goto done;
-
-  // if we have made another reference to "item", do not delete it 
-  if (aArray != nullptr) item = nullptr; 
-
-done:
-  if (item != nullptr) delete item;
-
-  return res;
-}
-
-nsresult nsCharsetMenu::AddFromPrefsToMenu(
-                        nsTArray<nsMenuEntry*> * aArray,
-                        nsIRDFContainer * aContainer,
-                        const char * aKey,
-                        nsTArray<nsCString>& aDecs,
-                        const char * aIDPrefix)
-{
-  nsresult res = NS_OK;
-
-  nsCOMPtr<nsIPrefLocalizedString> pls;
-  res = mPrefs->GetComplexValue(aKey, NS_GET_IID(nsIPrefLocalizedString), getter_AddRefs(pls));
-  if (NS_FAILED(res)) return res;
-
-  if (pls) {
-    nsXPIDLString ucsval;
-    pls->ToString(getter_Copies(ucsval));
-    NS_ConvertUTF16toUTF8 utf8val(ucsval);
-    if (ucsval)
-      res = AddFromStringToMenu(utf8val.BeginWriting(), aArray,
-                                aContainer, aDecs, aIDPrefix);
-  }
-
-  return res;
-}
-
-nsresult
-nsCharsetMenu::AddFromNolocPrefsToMenu(nsTArray<nsMenuEntry*> * aArray,
-                                       nsIRDFContainer * aContainer,
-                                       const char * aKey,
-                                       nsTArray<nsCString>& aDecs,
-                                       const char * aIDPrefix)
-{
-  nsresult res = NS_OK;
-
-  char * value = nullptr;
-  res = mPrefs->GetCharPref(aKey, &value);
-  if (NS_FAILED(res)) return res;
-
-  if (value != nullptr) {
-    res = AddFromStringToMenu(value, aArray, aContainer, aDecs, aIDPrefix);
-    nsMemory::Free(value);
-  }
-
-  return res;
-}
-
-nsresult nsCharsetMenu::AddFromStringToMenu(
-                        char * aCharsetList,
-                        nsTArray<nsMenuEntry*> * aArray,
-                        nsIRDFContainer * aContainer,
-                        nsTArray<nsCString>& aDecs,
-                        const char * aIDPrefix)
-{
-  nsresult res = NS_OK;
-  char * p = aCharsetList;
-  char * q = p;
-  while (*p != 0) {
-	  for (; (*q != ',') && (*q != ' ') && (*q != 0); q++) {;}
-    char temp = *q;
-    *q = 0;
-
-    // if this charset is not on the accepted list of charsets, ignore it
-    int32_t index;
-    index = aDecs.IndexOf(nsAutoCString(p), 0, nsIgnoreCaseCStringComparator());
-    if (index >= 0) {
-
-      // else, add it to the menu
-      res = AddCharsetToContainer(aArray, aContainer, nsDependentCString(p),
-                                  aIDPrefix, -1, 0);
-      NS_ASSERTION(NS_SUCCEEDED(res), "cannot add charset to menu");
-      if (NS_FAILED(res)) break;
-
-      aDecs.RemoveElementAt(index);
-    }
-
-    *q = temp;
-    for (; (*q == ',') || (*q == ' '); q++) {;}
-    p=q;
-  }
-
-  return NS_OK;
-}
-
-nsresult nsCharsetMenu::AddSeparatorToContainer(nsIRDFContainer * aContainer)
-{
-  nsAutoCString str;
-  str.AssignLiteral("----");
-
-  // hack to generate unique id's for separators
-  static int32_t u = 0;
-  u++;
-  str.AppendInt(u);
-
-  nsMenuEntry item;
-  item.mCharset = str;
-  item.mTitle.AssignWithConversion(str.get());
-
-  return AddMenuItemToContainer(aContainer, &item, kNC_BookmarkSeparator, 
-    nullptr, -1);
-}
-
-nsresult
-nsCharsetMenu::AddCharsetToCache(const nsAFlatCString& aCharset,
-                                 nsTArray<nsMenuEntry*> * aArray,
-                                 nsIRDFResource * aRDFResource,
-                                 uint32_t aCacheStart,
-                                 uint32_t aCacheSize,
-                                 int32_t aRDFPlace)
-{
-  int32_t i;
-  nsresult res = NS_OK;
-
-  i = FindMenuItemInArray(aArray, aCharset, nullptr);
-  if (i >= 0) return res;
-
-  nsCOMPtr<nsIRDFContainer> container;
-  res = NewRDFContainer(mInner, aRDFResource, getter_AddRefs(container));
-  if (NS_FAILED(res)) return res;
-
-  // if too many items, remove last one
-  if (aArray->Length() - aCacheStart >= aCacheSize){
-    res = RemoveLastMenuItem(container, aArray);
-    if (NS_FAILED(res)) return res;
-  }
-
-  res = AddCharsetToContainer(aArray, container, aCharset, "charset.", 
-                              aCacheStart, aRDFPlace);
-
-  return res;
-}
-
-nsresult nsCharsetMenu::WriteCacheToPrefs(nsTArray<nsMenuEntry*> * aArray,
-                                          int32_t aCacheStart,
-                                          const char * aKey)
-{
-  nsresult res = NS_OK;
-
-  // create together the cache string
-  nsAutoCString cache;
-  nsAutoCString sep(NS_LITERAL_CSTRING(", "));
-  uint32_t count = aArray->Length();
-
-  for (uint32_t i = aCacheStart; i < count; i++) {
-    nsMenuEntry * item = aArray->ElementAt(i);
-    if (item != nullptr) {    
-      cache.Append(item->mCharset);
-      if (i < count - 1) {
-        cache.Append(sep);
-      }
-    }
-  }
-
-  // write the pref
-  res = mPrefs->SetCharPref(aKey, cache.get());
-
-  return res;
-}
-
-nsresult nsCharsetMenu::UpdateCachePrefs(const char * aCacheKey,
-                                         const char * aCacheSizeKey,
-                                         const char * aStaticKey,
-                                         const char16_t * aCharset)
-{
-  nsresult rv = NS_OK;
-  nsXPIDLCString cachePrefValue;
-  nsXPIDLCString staticPrefValue;
-  NS_LossyConvertUTF16toASCII currentCharset(aCharset);
-  int32_t cacheSize = 0;
-
-  mPrefs->GetCharPref(aCacheKey, getter_Copies(cachePrefValue));
-  mPrefs->GetCharPref(aStaticKey, getter_Copies(staticPrefValue));
-  rv = mPrefs->GetIntPref(aCacheSizeKey, &cacheSize);
-
-  if (NS_FAILED(rv) || cacheSize <= 0)
-    return NS_ERROR_UNEXPECTED;
-
-  if ((cachePrefValue.Find(currentCharset) == kNotFound) && 
-      (staticPrefValue.Find(currentCharset) == kNotFound)) {
-
-    if (!cachePrefValue.IsEmpty())
-      cachePrefValue.Insert(", ", 0);
-
-    cachePrefValue.Insert(currentCharset, 0);
-    if (cacheSize < (int32_t) cachePrefValue.CountChar(',') + 1)
-      cachePrefValue.Truncate(cachePrefValue.RFindChar(','));
-
-    rv = mPrefs->SetCharPref(aCacheKey, cachePrefValue);
-  }
-
-  return rv;
-}
-
-nsresult nsCharsetMenu::ClearMenu(nsIRDFContainer        * aContainer,
-                                  nsTArray<nsMenuEntry*> * aArray)
-{
-  nsresult res = NS_OK;
-
-  // clean the RDF data source
-  uint32_t count = aArray->Length();
-  for (uint32_t i = 0; i < count; i++) {
-    nsMenuEntry * item = aArray->ElementAt(i);
-    if (item != nullptr) {    
-      res = AddMenuItemToContainer(aContainer, item, nullptr, "charset.", -2);
-      if (NS_FAILED(res)) return res;
-    }
-  }
-
-  // clean the internal data structures
-  FreeMenuItemArray(aArray);
-
-  return res;
-}
-
-nsresult nsCharsetMenu::RemoveLastMenuItem(nsIRDFContainer * aContainer,
-                                           nsTArray<nsMenuEntry*> * aArray)
-{
-  nsresult res = NS_OK;
-
-  int32_t last = aArray->Length() - 1;
-  if (last >= 0) {
-    nsMenuEntry * item = aArray->ElementAt(last);
-    if (item != nullptr) {    
-      res = AddMenuItemToContainer(aContainer, item, nullptr, "charset.", -2);
-      if (NS_FAILED(res)) return res;
-
-      aArray->RemoveElementAt(last);
-    }
-  }
-
-  return res;
-}
-
-nsresult nsCharsetMenu::RemoveFlaggedCharsets(nsTArray<nsCString>& aList, 
-                                              const nsString& aProp)
-{
-  nsresult res = NS_OK;
-  uint32_t count;
-
-  count = aList.Length();
-  if (NS_FAILED(res)) return res;
-
-  nsAutoString str;
-  for (uint32_t i = 0; i < count; i++) {
-
-    res = mCCManager->GetCharsetData(aList[i].get(), aProp.get(), str);
-    if (NS_FAILED(res)) continue;
-
-    aList.RemoveElementAt(i);
-
-    i--; 
-    count--;
-  }
-
-  return NS_OK;
-}
-
-nsresult nsCharsetMenu::NewRDFContainer(nsIRDFDataSource * aDataSource, 
-                                        nsIRDFResource * aResource, 
-                                        nsIRDFContainer ** aResult)
-{
-  nsresult res = CallCreateInstance(kRDFContainerCID, aResult);
-  if (NS_FAILED(res)) return res;
-
-  res = (*aResult)->Init(aDataSource, aResource);
-  if (NS_FAILED(res)) NS_RELEASE(*aResult);
-
-  return res;
-}
-
-void nsCharsetMenu::FreeMenuItemArray(nsTArray<nsMenuEntry*> * aArray)
-{
-  uint32_t count = aArray->Length();
-  for (uint32_t i = 0; i < count; i++) {
-    nsMenuEntry * item = aArray->ElementAt(i);
-    if (item != nullptr) {
-      delete item;
-    }
-  }
-  aArray->Clear();
-}
-
-int32_t nsCharsetMenu::FindMenuItemInArray(const nsTArray<nsMenuEntry*>* aArray,
-                                           const nsAFlatCString& aCharset,
-                                           nsMenuEntry ** aResult)
-{
-  uint32_t count = aArray->Length();
-
-  for (uint32_t i=0; i < count; i++) {
-    nsMenuEntry * item = aArray->ElementAt(i);
-    if (item->mCharset == aCharset) {
-      if (aResult != nullptr) *aResult = item;
-      return i;
-    }
-  }
-
-  if (aResult != nullptr) *aResult = nullptr;
-  return -1;
-}
-
-nsresult nsCharsetMenu::ReorderMenuItemArray(nsTArray<nsMenuEntry*> * aArray)
-{
-  nsresult res = NS_OK;
-  nsCOMPtr<nsICollation> collation;
-  uint32_t count = aArray->Length();
-  uint32_t i;
-
-  // we need to use a temporary array
-  charsetMenuSortRecord *array = new charsetMenuSortRecord [count];
-  NS_ENSURE_TRUE(array, NS_ERROR_OUT_OF_MEMORY);
-  for (i = 0; i < count; i++)
-    array[i].key = nullptr;
-
-  res = GetCollation(getter_AddRefs(collation));
-  if (NS_FAILED(res))
-    goto done;
-
-  for (i = 0; i < count && NS_SUCCEEDED(res); i++) {
-    array[i].item = aArray->ElementAt(i);
-
-    res = collation->AllocateRawSortKey(nsICollation::kCollationCaseInSensitive, 
-                                       (array[i].item)->mTitle, &array[i].key, &array[i].len);
-  }
-
-  // reorder the array
-  if (NS_SUCCEEDED(res)) {
-    NS_QuickSort(array, count, sizeof(*array), CompareMenuItems, collation);
-
-    // move the elements from the temporary array into the the real one
-    aArray->Clear();
-    for (i = 0; i < count; i++) {
-      aArray->AppendElement(array[i].item);
-    }
-  }
-
-done:
-  for (i = 0; i < count; i++) {
-    PR_FREEIF(array[i].key);
-  }
-  delete [] array;
-  return res;
-}
-
-nsresult nsCharsetMenu::GetCollation(nsICollation ** aCollation)
-{
-  nsresult res = NS_OK;
-  nsCOMPtr<nsILocale> locale = nullptr;
-  nsICollationFactory * collationFactory = nullptr;
-  
-  nsCOMPtr<nsILocaleService> localeServ = 
-           do_GetService(NS_LOCALESERVICE_CONTRACTID, &res);
-  if (NS_FAILED(res)) return res;
-
-  res = localeServ->GetApplicationLocale(getter_AddRefs(locale));
-  if (NS_FAILED(res)) return res;
-
-  res = CallCreateInstance(NS_COLLATIONFACTORY_CONTRACTID, &collationFactory);
-  if (NS_FAILED(res)) return res;
-
-  res = collationFactory->CreateCollation(locale, aCollation);
-  NS_RELEASE(collationFactory);
-  return res;
-}
-
-//----------------------------------------------------------------------------
-// Interface nsICurrentCharsetListener [implementation]
-
-NS_IMETHODIMP nsCharsetMenu::SetCurrentCharset(const char16_t * aCharset)
-{
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsCharsetMenu::SetCurrentMailCharset(const char16_t * aCharset)
-{
-  nsresult res = NS_OK;
-
-  if (mMailviewMenuInitialized) {
-    res = AddCharsetToCache(NS_LossyConvertUTF16toASCII(aCharset),
-                            &mMailviewMenu, kNC_MailviewCharsetMenuRoot, 
-                            mMailviewCacheStart, mMailviewCacheSize,
-                            mMailviewMenuRDFPosition);
-    if (NS_FAILED(res)) return res;
-
-    res = WriteCacheToPrefs(&mMailviewMenu, mMailviewCacheStart, 
-                            kMailviewCachePrefKey);
-  } else {
-    res = UpdateCachePrefs(kMailviewCachePrefKey, kMailviewCacheSizePrefKey, 
-                           kMailviewStaticPrefKey, aCharset);
-  }
-  return res;
-}
-
-NS_IMETHODIMP nsCharsetMenu::SetCurrentComposerCharset(const char16_t * aCharset)
-{
-  nsresult res = NS_OK;
-
-  if (mComposerMenuInitialized) {
-
-    res = AddCharsetToCache(NS_LossyConvertUTF16toASCII(aCharset),
-                            &mComposerMenu, kNC_ComposerCharsetMenuRoot, 
-                            mComposerCacheStart, mComposerCacheSize,
-                            mComposerMenuRDFPosition);
-    if (NS_FAILED(res)) return res;
-
-    res = WriteCacheToPrefs(&mComposerMenu, mComposerCacheStart, 
-      kComposerCachePrefKey);
-  } else {
-    res = UpdateCachePrefs(kComposerCachePrefKey, kComposerCacheSizePrefKey, 
-                           kComposerStaticPrefKey, aCharset);
-  }
-  return res;
-}
-
-//----------------------------------------------------------------------------
-// Interface nsIRDFDataSource [implementation]
-
-NS_IMETHODIMP nsCharsetMenu::GetURI(char ** uri)
-{
-  if (!uri) return NS_ERROR_NULL_POINTER;
-
-  *uri = NS_strdup("rdf:charset-menu");
-  if (!(*uri)) return NS_ERROR_OUT_OF_MEMORY;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsCharsetMenu::GetSource(nsIRDFResource* property,
-                                       nsIRDFNode* target,
-                                       bool tv,
-                                       nsIRDFResource** source)
-{
-  return mInner->GetSource(property, target, tv, source);
-}
-
-NS_IMETHODIMP nsCharsetMenu::GetSources(nsIRDFResource* property,
-                                        nsIRDFNode* target,
-                                        bool tv,
-                                        nsISimpleEnumerator** sources)
-{
-  return mInner->GetSources(property, target, tv, sources);
-}
-
-NS_IMETHODIMP nsCharsetMenu::GetTarget(nsIRDFResource* source,
-                                       nsIRDFResource* property,
-                                       bool tv,
-                                       nsIRDFNode** target)
-{
-  return mInner->GetTarget(source, property, tv, target);
-}
-
-NS_IMETHODIMP nsCharsetMenu::GetTargets(nsIRDFResource* source,
-                                        nsIRDFResource* property,
-                                        bool tv,
-                                        nsISimpleEnumerator** targets)
-{
-  return mInner->GetTargets(source, property, tv, targets);
-}
-
-NS_IMETHODIMP nsCharsetMenu::Assert(nsIRDFResource* aSource,
-                                    nsIRDFResource* aProperty,
-                                    nsIRDFNode* aTarget,
-                                    bool aTruthValue)
-{
-  // TODO: filter out asserts we don't care about
-  return mInner->Assert(aSource, aProperty, aTarget, aTruthValue);
-}
-
-NS_IMETHODIMP nsCharsetMenu::Unassert(nsIRDFResource* aSource,
-                                      nsIRDFResource* aProperty,
-                                      nsIRDFNode* aTarget)
-{
-  // TODO: filter out unasserts we don't care about
-  return mInner->Unassert(aSource, aProperty, aTarget);
-}
-
-
-NS_IMETHODIMP nsCharsetMenu::Change(nsIRDFResource* aSource,
-                                    nsIRDFResource* aProperty,
-                                    nsIRDFNode* aOldTarget,
-                                    nsIRDFNode* aNewTarget)
-{
-  // TODO: filter out changes we don't care about
-  return mInner->Change(aSource, aProperty, aOldTarget, aNewTarget);
-}
-
-NS_IMETHODIMP nsCharsetMenu::Move(nsIRDFResource* aOldSource,
-                                  nsIRDFResource* aNewSource,
-                                  nsIRDFResource* aProperty,
-                                  nsIRDFNode* aTarget)
-{
-  // TODO: filter out changes we don't care about
-  return mInner->Move(aOldSource, aNewSource, aProperty, aTarget);
-}
-
-
-NS_IMETHODIMP nsCharsetMenu::HasAssertion(nsIRDFResource* source, 
-                                          nsIRDFResource* property, 
-                                          nsIRDFNode* target, bool tv, 
-                                          bool* hasAssertion)
-{
-  return mInner->HasAssertion(source, property, target, tv, hasAssertion);
-}
-
-NS_IMETHODIMP nsCharsetMenu::AddObserver(nsIRDFObserver* n)
-{
-  return mInner->AddObserver(n);
-}
-
-NS_IMETHODIMP nsCharsetMenu::RemoveObserver(nsIRDFObserver* n)
-{
-  return mInner->RemoveObserver(n);
-}
-
-NS_IMETHODIMP 
-nsCharsetMenu::HasArcIn(nsIRDFNode *aNode, nsIRDFResource *aArc, bool *result)
-{
-  return mInner->HasArcIn(aNode, aArc, result);
-}
-
-NS_IMETHODIMP 
-nsCharsetMenu::HasArcOut(nsIRDFResource *source, nsIRDFResource *aArc, bool *result)
-{
-  return mInner->HasArcOut(source, aArc, result);
-}
-
-NS_IMETHODIMP nsCharsetMenu::ArcLabelsIn(nsIRDFNode* node, 
-                                         nsISimpleEnumerator** labels)
-{
-  return mInner->ArcLabelsIn(node, labels);
-}
-
-NS_IMETHODIMP nsCharsetMenu::ArcLabelsOut(nsIRDFResource* source, 
-                                          nsISimpleEnumerator** labels)
-{
-  return mInner->ArcLabelsOut(source, labels);
-}
-
-NS_IMETHODIMP nsCharsetMenu::GetAllResources(nsISimpleEnumerator** aCursor)
-{
-  return mInner->GetAllResources(aCursor);
-}
-
-NS_IMETHODIMP nsCharsetMenu::GetAllCmds(
-                             nsIRDFResource* source,
-                             nsISimpleEnumerator/*<nsIRDFResource>*/** commands)
-{
-  NS_NOTYETIMPLEMENTED("nsCharsetMenu::GetAllCmds");
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP nsCharsetMenu::IsCommandEnabled(
-                             nsISupportsArray/*<nsIRDFResource>*/* aSources,
-                             nsIRDFResource*   aCommand,
-                             nsISupportsArray/*<nsIRDFResource>*/* aArguments,
-                             bool* aResult)
-{
-  NS_NOTYETIMPLEMENTED("nsCharsetMenu::IsCommandEnabled");
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP nsCharsetMenu::DoCommand(nsISupportsArray* aSources,
-                                       nsIRDFResource*   aCommand,
-                                       nsISupportsArray* aArguments)
-{
-  NS_NOTYETIMPLEMENTED("nsCharsetMenu::DoCommand");
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP nsCharsetMenu::BeginUpdateBatch()
-{
-  return mInner->BeginUpdateBatch();
-}
-
-NS_IMETHODIMP nsCharsetMenu::EndUpdateBatch()
-{
-  return mInner->EndUpdateBatch();
-}
deleted file mode 100644
--- a/toolkit/components/intl/nsCharsetMenu.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsCharsetMenu_h___
-#define nsCharsetMenu_h___
-
-#define NS_CHARSETMENU_CID \
-  {0x42c52b81, 0xa200, 0x11d3, { 0x9d, 0xb, 0x0, 0x50, 0x4, 0x0, 0x7, 0xb2}}
-
-#define NS_CHARSETMENU_PID "charset-menu"
-
-nsresult
-NS_NewCharsetMenu(nsISupports* aOuter, const nsIID& aIID,
-                  void** aResult);
-
-#endif /* nsCharsetMenu_h___ */
--- a/toolkit/components/moz.build
+++ b/toolkit/components/moz.build
@@ -18,17 +18,16 @@ PARALLEL_DIRS += [
     'cookie',
     'crashmonitor',
     'diskspacewatcher',
     'downloads',
     'exthelper',
     'filepicker',
     'finalizationwitness',
     'find',
-    'intl',
     'jsdownloads',
     'mediasniffer',
     'microformats',
     'osfile',
     'parentalcontrols',
     'passwordmgr',
     'perf',
     'places',
deleted file mode 100644
--- a/toolkit/content/charsetOverlay.js
+++ /dev/null
@@ -1,267 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function MultiplexHandler(aEvent)
-{
-    MultiplexHandlerEx(
-        aEvent,
-        function Browser_SelectDetector(event) {
-            BrowserCharsetReload();
-            /* window.content.location.reload() will re-download everything */
-            SelectDetector(event, null);
-        },
-        function Browser_SetForcedCharset(charset, isPredefined) {
-            BrowserSetForcedCharacterSet(charset);
-        }
-    );
-}
-
-function MailMultiplexHandler(aEvent)
-{
-    MultiplexHandlerEx(
-        aEvent,
-        function Mail_SelectDetector(event) {
-            SelectDetector(
-                event,
-                function Mail_Reload() {
-                    messenger.setDocumentCharset(msgWindow.mailCharacterSet);
-                }
-            );
-        },
-        function Mail_SetForcedCharset(charset, isPredefined) {
-            MessengerSetForcedCharacterSet(charset);
-        }
-    );
-}
-
-function ComposerMultiplexHandler(aEvent)
-{
-    MultiplexHandlerEx(
-        aEvent,
-        function Composer_SelectDetector(event) {
-            SelectDetector(
-                event,
-                function Composer_Reload() {
-                    EditorLoadUrl(GetDocumentUrl());
-                }
-            );
-        },
-        function Composer_SetForcedCharset(charset, isPredefined) {
-            if ((!isPredefined) && charset.length > 0) {
-                gCharsetMenu.SetCurrentComposerCharset(charset);
-            }
-            EditorSetDocumentCharacterSet(charset);
-        }
-    );
-}
-
-function MultiplexHandlerEx(aEvent, aSelectDetector, aSetForcedCharset)
-{
-    try {
-        var node = aEvent.target;
-        var name = node.getAttribute('name');
-
-        if (name == 'detectorGroup') {
-            aSelectDetector(aEvent);
-        } else if (name == 'charsetGroup') {
-            var charset = node.getAttribute('id');
-            charset = charset.substring('charset.'.length, charset.length)
-            aSetForcedCharset(charset, true);
-        } else if (name == 'charsetCustomize') {
-            //do nothing - please remove this else statement, once the charset prefs moves to the pref window
-        } else {
-            aSetForcedCharset(node.getAttribute('id'), false);
-        }
-    } catch(ex) {
-        alert(ex);
-    }
-}
-
-function SelectDetector(event, doReload)
-{
-    dump("Charset Detector menu item pressed: " + event.target.getAttribute('id') + "\n");
-
-    var uri =  event.target.getAttribute("id");
-    var prefvalue = uri.substring('chardet.'.length, uri.length);
-    if ("off" == prefvalue) { // "off" is special value to turn off the detectors
-        prefvalue = "";
-    }
-
-    try {
-        var pref = Components.classes["@mozilla.org/preferences-service;1"]
-                             .getService(Components.interfaces.nsIPrefBranch);
-        var str =  Components.classes["@mozilla.org/supports-string;1"]
-                             .createInstance(Components.interfaces.nsISupportsString);
-
-        str.data = prefvalue;
-        pref.setComplexValue("intl.charset.detector",
-                             Components.interfaces.nsISupportsString, str);
-        if (typeof doReload == "function") doReload();
-    }
-    catch (ex) {
-        dump("Failed to set the intl.charset.detector preference.\n");
-    }
-}
-
-var gPrevCharset = null;
-function UpdateCurrentCharset()
-{
-    // extract the charset from DOM
-    var wnd = document.commandDispatcher.focusedWindow;
-    if ((window == wnd) || (wnd == null)) wnd = window.content;
-
-    // Uncheck previous item
-    if (gPrevCharset) {
-        var pref_item = document.getElementById('charset.' + gPrevCharset);
-        if (pref_item)
-          pref_item.setAttribute('checked', 'false');
-    }
-
-    var menuitem = document.getElementById('charset.' + wnd.document.characterSet);
-    if (menuitem) {
-        menuitem.setAttribute('checked', 'true');
-    }
-}
-
-function UpdateCurrentMailCharset()
-{
-    var charset = msgWindow.mailCharacterSet;
-    var menuitem = document.getElementById('charset.' + charset);
-
-    if (menuitem) {
-        menuitem.setAttribute('checked', 'true');
-    }
-}
-
-function UpdateCharsetDetector()
-{
-    var prefvalue;
-
-    try {
-        var pref = Components.classes["@mozilla.org/preferences-service;1"]
-                             .getService(Components.interfaces.nsIPrefBranch);
-        prefvalue = pref.getComplexValue("intl.charset.detector",
-                                         Components.interfaces.nsIPrefLocalizedString).data;
-    }
-    catch (ex) {
-        prefvalue = "";
-    }
-
-    if (prefvalue == "") prefvalue = "off";
-    dump("intl.charset.detector = "+ prefvalue + "\n");
-
-    prefvalue = 'chardet.' + prefvalue;
-    var menuitem = document.getElementById(prefvalue);
-
-    if (menuitem) {
-        menuitem.setAttribute('checked', 'true');
-    }
-}
-
-function UpdateMenus(event)
-{
-    // use setTimeout workaround to delay checkmark the menu
-    // when onmenucomplete is ready then use it instead of oncreate
-    // see bug 78290 for the detail
-    UpdateCurrentCharset();
-    setTimeout(UpdateCurrentCharset, 0);
-    UpdateCharsetDetector();
-    setTimeout(UpdateCharsetDetector, 0);
-}
-
-function CreateMenu(node)
-{
-  var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
-  observerService.notifyObservers(null, "charsetmenu-selected", node);
-}
-
-function UpdateMailMenus(event)
-{
-    // use setTimeout workaround to delay checkmark the menu
-    // when onmenucomplete is ready then use it instead of oncreate
-    // see bug 78290 for the detail
-    UpdateCurrentMailCharset();
-    setTimeout(UpdateCurrentMailCharset, 0);
-    UpdateCharsetDetector();
-    setTimeout(UpdateCharsetDetector, 0);
-}
-
-var gCharsetMenu = Components.classes['@mozilla.org/rdf/datasource;1?name=charset-menu'].getService().QueryInterface(Components.interfaces.nsICurrentCharsetListener);
-var gLastBrowserCharset = null;
-
-function charsetLoadListener (event)
-{
-    var charset = window.content.document.characterSet;
-
-    if (charset.length > 0 && (charset != gLastBrowserCharset)) {
-        gCharsetMenu.SetCurrentCharset(charset);
-        gPrevCharset = gLastBrowserCharset;
-        gLastBrowserCharset = charset;
-    }
-}
-
-
-function composercharsetLoadListener (event)
-{
-    var charset = window.content.document.characterSet;
-
- 
-    if (charset.length > 0 ) {
-       gCharsetMenu.SetCurrentComposerCharset(charset);
-    }
- }
-
-function SetForcedEditorCharset(charset)
-{
-    if (charset.length > 0 ) {
-       gCharsetMenu.SetCurrentComposerCharset(charset);
-    }
-    EditorSetDocumentCharacterSet(charset);
-}
-
-
-var gLastMailCharset = null;
-
-function mailCharsetLoadListener (event)
-{
-    if (msgWindow) {
-        var charset = msgWindow.mailCharacterSet;
-        if (charset.length > 0 && (charset != gLastMailCharset)) {
-            gCharsetMenu.SetCurrentMailCharset(charset);
-            gLastMailCharset = charset;
-        }
-    }
-}
-
-function InitCharsetMenu()
-{
-    removeEventListener("load", InitCharsetMenu, true);
-
-    var wintype = document.documentElement.getAttribute('windowtype');
-    if (window && (wintype == "navigator:browser"))
-    {
-        var contentArea = window.document.getElementById("appcontent");
-        if (contentArea)
-            contentArea.addEventListener("pageshow", charsetLoadListener, true);
-    }
-    else
-    {
-        var arrayOfStrings = wintype.split(":");
-        if (window && arrayOfStrings[0] == "mail")
-        {
-            var messageContent = window.document.getElementById("messagepane");
-            if (messageContent)
-                messageContent.addEventListener("pageshow", mailCharsetLoadListener, true);
-        }
-        else
-        if (window && arrayOfStrings[0] == "composer")
-        {
-            contentArea = window.document.getElementById("appcontent");
-            if (contentArea)
-                contentArea.addEventListener("pageshow", composercharsetLoadListener, true);
-        }
-    }
-}
-
-addEventListener("load", InitCharsetMenu, true);
deleted file mode 100644
--- a/toolkit/content/charsetOverlay.xul
+++ /dev/null
@@ -1,325 +0,0 @@
-<?xml version="1.0"?> 
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-
-<!DOCTYPE  overlay SYSTEM "chrome://global/locale/charsetOverlay.dtd">
-
-<overlay id="charsetOverlay"
-    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-    <script type="application/javascript" src="chrome://global/content/charsetOverlay.js"/>
-
-    <!-- Composer Charset Menu -->
-    <menu id="composerCharsetMenu" label="&charsetMenu.label;" accesskey="&charsetMenu.accesskey;" datasources="rdf:charset-menu" ref="NC:ComposerCharsetMenuRoot" oncommand="ComposerMultiplexHandler(event)" onpopupshowing="CreateMenu('composer');UpdateMenus()" onpopupshown="CreateMenu('more-menu');">
-        <template>
-            <rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
-                <menupopup>
-                <menuseparator uri="..." />
-                </menupopup>
-            </rule>
-            <rule>
-                <menupopup>
-                <menuitem type="radio" name="charsetGroup" checked="rdf:http://home.netscape.com/NC-rdf#Checked" uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                </menupopup>
-            </rule>
-        </template>
-
-        <menupopup id="composerCharsetMenuPopup">
-        <menu label="&charsetMenuAutodet.label;" accesskey="&charsetMenuAutodet.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserAutodetMenuRoot">
-            <template>
-                <rule rdf:type="http://home.netscape.com/NC-rdf#CharsetDetector">
-                    <menupopup>
-                    <menuitem type="radio" name="detectorGroup" checked="rdf:http://home.netscape.com/NC-rdf#Checked" uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                    </menupopup>
-                </rule>
-            </template>
-            <menupopup>
-            </menupopup>
-        </menu>
-        <menu label="&charsetMenuMore.label;" accesskey="&charsetMenuMore.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMoreCharsetMenuRoot">
-            <template>
-                <rule>
-                    <menupopup>
-                    <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                    </menupopup>
-                </rule>
-            </template>
-            <menupopup>
-                <menu label="&charsetMenuMore1.label;" accesskey="&charsetMenuMore1.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore1CharsetMenuRoot">
-                    <template>
-                        <rule>
-                            <menupopup>
-                            <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                            </menupopup>
-                        </rule>
-                    </template>
-                    <menupopup>
-                    </menupopup>
-                </menu>
-                <menu label="&charsetMenuMore2.label;" accesskey="&charsetMenuMore2.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore2CharsetMenuRoot">
-                    <template>
-                        <rule>
-                            <menupopup>
-                            <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                            </menupopup>
-                        </rule>
-                    </template>
-                    <menupopup>
-                    </menupopup>
-                </menu>
-                <menu label="&charsetMenuMore3.label;" accesskey="&charsetMenuMore3.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore3CharsetMenuRoot">
-                    <template>
-                        <rule>
-                            <menupopup>
-                            <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                            </menupopup>
-                        </rule>
-                    </template>
-                    <menupopup>
-                    </menupopup>
-                </menu>
-                <menu label="&charsetMenuMore4.label;" accesskey="&charsetMenuMore4.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore4CharsetMenuRoot">
-                    <template>
-                        <rule>
-                            <menupopup>
-                            <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                            </menupopup>
-                        </rule>
-                    </template>
-                    <menupopup>
-                    </menupopup>
-                </menu>
-                <menu label="&charsetMenuMore5.label;" accesskey="&charsetMenuMore5.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore5CharsetMenuRoot">
-                    <template>
-                        <rule>
-                            <menupopup>
-                            <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                            </menupopup>
-                        </rule>
-                    </template>
-                    <menupopup>
-                    </menupopup>
-                </menu>
-                <menuseparator />
-            </menupopup>
-        </menu>
-        <menuitem name="charsetCustomize" accesskey="&charsetCustomize.accesskey;" label="&charsetCustomize.label;" oncommand="window.openDialog('chrome://global/content/customizeCharset.xul','PrefWindow', 'chrome,modal=yes,resizable=yes', 'browser')"/>
-        </menupopup>
-    </menu>
-
-    <!-- Mail View Charset Menu -->
-    <menu id="mailviewCharsetMenu" label="&charsetMenu.label;" accesskey="&charsetMenu.accesskey;" datasources="rdf:charset-menu" ref="NC:MailviewCharsetMenuRoot" oncommand="MailMultiplexHandler(event)" onpopupshowing="CreateMenu('mailview');UpdateMailMenus()" onpopupshown="CreateMenu('more-menu');">
-        <template>
-            <rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
-                <menupopup>
-                <menuseparator uri="..." />
-                </menupopup>
-            </rule>
-            <rule>
-                <menupopup>
-                <menuitem type="radio" name="charsetGroup" checked="rdf:http://home.netscape.com/NC-rdf#Checked" uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                </menupopup>
-            </rule>
-        </template>
-
-        <menupopup>
-        <menu label="&charsetMenuAutodet.label;" accesskey="&charsetMenuAutodet.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserAutodetMenuRoot">
-            <template>
-                <rule rdf:type="http://home.netscape.com/NC-rdf#CharsetDetector">
-                    <menupopup>
-                    <menuitem type="radio" name="detectorGroup" checked="rdf:http://home.netscape.com/NC-rdf#Checked" uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                    </menupopup>
-                </rule>
-            </template>
-            <menupopup>
-            </menupopup>
-        </menu>
-        <menu label="&charsetMenuMore.label;" accesskey="&charsetMenuMore.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMoreCharsetMenuRoot">
-            <template>
-                <rule>
-                    <menupopup>
-                    <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                    </menupopup>
-                </rule>
-            </template>
-            <menupopup>
-                <menu label="&charsetMenuMore1.label;"  datasources="rdf:charset-menu" ref="NC:BrowserMore1CharsetMenuRoot">
-                    <template>
-                        <rule>
-                            <menupopup>
-                            <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                            </menupopup>
-                        </rule>
-                    </template>
-                    <menupopup>
-                    </menupopup>
-                </menu>
-                <menu label="&charsetMenuMore2.label;"  datasources="rdf:charset-menu" ref="NC:BrowserMore2CharsetMenuRoot">
-                    <template>
-                        <rule>
-                            <menupopup>
-                            <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                            </menupopup>
-                        </rule>
-                    </template>
-                    <menupopup>
-                    </menupopup>
-                </menu>
-                <menu label="&charsetMenuMore3.label;"  datasources="rdf:charset-menu" ref="NC:BrowserMore3CharsetMenuRoot">
-                    <template>
-                        <rule>
-                            <menupopup>
-                            <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                            </menupopup>
-                        </rule>
-                    </template>
-                    <menupopup>
-                    </menupopup>
-                </menu>
-                <menu label="&charsetMenuMore4.label;"  datasources="rdf:charset-menu" ref="NC:BrowserMore4CharsetMenuRoot">
-                    <template>
-                        <rule>
-                            <menupopup>
-                            <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                            </menupopup>
-                        </rule>
-                    </template>
-                    <menupopup>
-                    </menupopup>
-                </menu>
-                <menu label="&charsetMenuMore5.label;"  datasources="rdf:charset-menu" ref="NC:BrowserMore5CharsetMenuRoot">
-                    <template>
-                        <rule>
-                            <menupopup>
-                            <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                            </menupopup>
-                        </rule>
-                    </template>
-                    <menupopup>
-                    </menupopup>
-                </menu>
-                <menuseparator />
-            </menupopup>
-        </menu>
-        <menuitem name="charsetCustomize" accesskey="&charsetCustomize.accesskey;" label="&charsetCustomize.label;" oncommand="window.openDialog('chrome://global/content/customizeCharset.xul','PrefWindow', 'chrome,modal=yes,resizable=yes', 'browser')"/>
-        </menupopup>
-    </menu>
-
-    <!-- Mail Edit Charset Menu -->
-    <menu id="maileditCharsetMenu" label="&charsetMenu.label;" accesskey="&charsetMenu.accesskey;" datasources="rdf:charset-menu" ref="NC:MaileditCharsetMenuRoot" oncommand="SetDocumentCharacterSet(event.target.getAttribute('id'));" onpopupshowing="CreateMenu('mailedit');InitCharsetMenuCheckMark();" onpopupshown="CreateMenu('more-menu');">
-        <template>
-            <rule>
-                <menupopup>
-                <menuitem type="radio" name="charsetGroup" checked="rdf:http://home.netscape.com/NC-rdf#Checked" uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                </menupopup>
-            </rule>
-        </template>
-
-        <menupopup>
-        <menuitem name="charsetCustomize" accesskey="&charsetCustomize.accesskey;" label="&charsetCustomize.label;" oncommand="window.openDialog('chrome://global/content/customizeCharset.xul','PrefWindow', 'chrome,modal=yes,resizable=yes', 'mailedit')"/>
-        <menuseparator />
-        </menupopup>
-    </menu>
-
-    <!-- Charset Menu -->
-    <menu id="charsetMenu" label="&charsetMenu.label;" accesskey="&charsetMenu.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserCharsetMenuRoot" oncommand="MultiplexHandler(event)" onpopupshowing="CreateMenu('browser');UpdateMenus(event)" onpopupshown="CreateMenu('more-menu');">
-        <template>
-            <rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
-                <menupopup>
-                <menuseparator uri="..." />
-                </menupopup>
-            </rule>
-            <rule>
-                <menupopup>
-                <menuitem type="radio" name="charsetGroup" checked="rdf:http://home.netscape.com/NC-rdf#Checked" uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                </menupopup>
-            </rule>
-        </template>
-
-        <menupopup>
-        <menu label="&charsetMenuAutodet.label;" accesskey="&charsetMenuAutodet.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserAutodetMenuRoot">
-            <template>
-                <rule rdf:type="http://home.netscape.com/NC-rdf#CharsetDetector">
-                    <menupopup>
-                    <menuitem type="radio" name="detectorGroup" checked="rdf:http://home.netscape.com/NC-rdf#Checked" uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                    </menupopup>
-                </rule>
-            </template>
-            <menupopup>
-            </menupopup>
-        </menu>
-        <menu label="&charsetMenuMore.label;" accesskey="&charsetMenuMore.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMoreCharsetMenuRoot">
-            <template>
-                <rule>
-                    <menupopup>
-                    <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                    </menupopup>
-                </rule>
-            </template>
-            <menupopup>
-                <menu label="&charsetMenuMore1.label;" accesskey="&charsetMenuMore1.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore1CharsetMenuRoot">
-                    <template>
-                        <rule>
-                            <menupopup>
-                            <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                            </menupopup>
-                        </rule>
-                    </template>
-                    <menupopup>
-                    </menupopup>
-                </menu>
-                <menu label="&charsetMenuMore2.label;" accesskey="&charsetMenuMore2.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore2CharsetMenuRoot">
-                    <template>
-                        <rule>
-                            <menupopup>
-                            <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                            </menupopup>
-                        </rule>
-                    </template>
-                    <menupopup>
-                    </menupopup>
-                </menu>
-                <menu label="&charsetMenuMore3.label;" accesskey="&charsetMenuMore3.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore3CharsetMenuRoot">
-                    <template>
-                        <rule>
-                            <menupopup>
-                            <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                            </menupopup>
-                        </rule>
-                    </template>
-                    <menupopup>
-                    </menupopup>
-                </menu>
-                <menu label="&charsetMenuMore4.label;" accesskey="&charsetMenuMore4.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore4CharsetMenuRoot">
-                    <template>
-                        <rule>
-                            <menupopup>
-                            <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                            </menupopup>
-                        </rule>
-                    </template>
-                    <menupopup>
-                    </menupopup>
-                </menu>
-                <menu label="&charsetMenuMore5.label;" accesskey="&charsetMenuMore5.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore5CharsetMenuRoot">
-                    <template>
-                        <rule>
-                            <menupopup>
-                            <menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-                            </menupopup>
-                        </rule>
-                    </template>
-                    <menupopup>
-                    </menupopup>
-                </menu>
-                <menuseparator />
-            </menupopup>
-        </menu>
-        <menuitem name="charsetCustomize" accesskey="&charsetCustomize.accesskey;" label="&charsetCustomize.label;" oncommand="window.openDialog('chrome://global/content/customizeCharset.xul','PrefWindow', 'chrome,modal=yes,resizable=yes', 'browser')"/>
-        </menupopup>
-    </menu>
-
-</overlay>      
deleted file mode 100644
--- a/toolkit/content/customizeCharset.js
+++ /dev/null
@@ -1,308 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-//get prefInt services
-
-var availCharsetDict     = [];
-var prefBranch           = null; //Preferences Interface
-var pref_string_title    = "";
-var pref_string_content  = "";
-var pref_string_object   = null;
-
-function Init()
-{
-  var applicationArea = "";
-
-  if ("arguments" in window && window.arguments[0])
-    applicationArea = window.arguments[0];
-
-  prefBranch = Components.classes["@mozilla.org/preferences-service;1"];
-
-  if (prefBranch) {
-    prefBranch = prefBranch.getService(Components.interfaces.nsIPrefBranch);
-
-    if (applicationArea.indexOf("mail") != -1) {
-      pref_string_title = "intl.charsetmenu.mailedit";
-    } else {
-    //default is the browser
-      pref_string_title = "intl.charsetmenu.browser.static";
-    }
-
-    pref_string_object = prefBranch.getComplexValue(pref_string_title, Components.interfaces.nsIPrefLocalizedString)
-    pref_string_content = pref_string_object.data;
-
-    AddRemoveLatin1('add');
-  }
-
-  LoadAvailableCharSets();
-  LoadActiveCharSets();
-}
-
-
-function readRDFString(aDS,aRes,aProp) 
-{
-  var n = aDS.GetTarget(aRes, aProp, true);
-  if (n)
-    return n.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
-  else 
-    return "";
-}
-
-
-function LoadAvailableCharSets()
-{
-  try {
-    var available_charsets_listbox = document.getElementById('available_charsets');
-    var rdf=Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService); 
-    var kNC_Root = rdf.GetResource("NC:DecodersRoot");
-    var kNC_name = rdf.GetResource("http://home.netscape.com/NC-rdf#Name");
-    var rdfDataSource = rdf.GetDataSource("rdf:charset-menu"); 
-    var rdfContainer =
-      Components.classes["@mozilla.org/rdf/container;1"]
-                .createInstance(Components.interfaces.nsIRDFContainer);
-
-    rdfContainer.Init(rdfDataSource, kNC_Root);
-    var availableCharsets = rdfContainer.GetElements();
-    var charset;
-
-    for (var i = 0; i < rdfContainer.GetCount(); i++) {
-      charset = availableCharsets.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
-      availCharsetDict[i] = new Array(2);
-      availCharsetDict[i][0] = readRDFString(rdfDataSource, charset, kNC_name);
-      availCharsetDict[i][1] = charset.Value;
-
-      AddListItem(document,
-                  available_charsets_listbox,
-                  availCharsetDict[i][1],
-                  availCharsetDict[i][0]);
-    }
-  }
-  catch (e) {}
-}
-
-
-function GetCharSetTitle(id)
-{
-  if (availCharsetDict) {
-    for (var j = 0; j < availCharsetDict.length; j++) {
-      if (availCharsetDict[j][1] == id) {
-        return availCharsetDict[j][0];
-      }
-    }
-  }
-  return '';
-}
-
-function AddRemoveLatin1(action)
-{
-  var arrayOfPrefs = [];
-  arrayOfPrefs = pref_string_content.split(', ');
-
-  if (arrayOfPrefs.length > 0) {
-    for (var i = 0; i < arrayOfPrefs.length; i++) {
-      if (arrayOfPrefs[i] == 'ISO-8859-1') {
-        if (action == 'remove') {
-          arrayOfPrefs[i] = arrayOfPrefs[arrayOfPrefs.length-1];
-          arrayOfPrefs.length = arrayOfPrefs.length - 1;
-        }
-
-        pref_string_content = arrayOfPrefs.join(', ');
-        return;
-      }
-    }
-
-    if (action == 'add') {
-      arrayOfPrefs[arrayOfPrefs.length] = 'ISO-8859-1';
-      pref_string_content = arrayOfPrefs.join(', ');
-    }
-  }
-}
-
-
-function LoadActiveCharSets()
-{
-  var active_charsets = document.getElementById('active_charsets');
-  var arrayOfPrefs = [];
-  var str;
-  var tit;
-
-  arrayOfPrefs = pref_string_content.split(', ');
-
-  if (arrayOfPrefs.length > 0) {
-    for (var i = 0; i < arrayOfPrefs.length; i++) {
-      str = arrayOfPrefs[i];
-      tit = GetCharSetTitle(str);
-      if (str && tit)
-        AddListItem(document, active_charsets, str, tit);
-    }
-  }
-}
-
-function enable_save()
-{
-  var save_button = document.documentElement.getButton("accept");
-  save_button.removeAttribute('disabled');
-}
-
-
-function update_buttons()
-{
-  var available_charsets = document.getElementById('available_charsets');
-  var active_charsets = document.getElementById('active_charsets');
-  var remove_button = document.getElementById('remove_button');
-  var add_button = document.getElementById('add_button');
-  var up_button = document.getElementById('up_button');
-  var down_button = document.getElementById('down_button');
-
-  var activeCharsetSelected = (active_charsets.selectedItems.length > 0);
-  remove_button.disabled = !activeCharsetSelected;
-
-  if (activeCharsetSelected) {
-    up_button.disabled = !(active_charsets.selectedItems[0].previousSibling);
-    down_button.disabled = !(active_charsets.selectedItems[0].nextSibling);
-  }
-  else {
-    up_button.disabled = true;
-    down_button.disabled = true;
-  }
-
-  add_button.disabled = (available_charsets.selectedItems.length == 0);
-}
-
-
-
-function AddAvailableCharset()
-{
-  var active_charsets = document.getElementById('active_charsets');
-  var available_charsets = document.getElementById('available_charsets');
-
-  for (var nodeIndex=0; nodeIndex < available_charsets.selectedItems.length;  nodeIndex++)
-  {
-    var selItem =  available_charsets.selectedItems[nodeIndex];
-    
-    var charsetname  = selItem.label;
-    var charsetid = selItem.id;
-    var already_active = false;
-
-    for (var item = active_charsets.firstChild; item != null; item = item.nextSibling) {
-      if (charsetid == item.id) {
-        already_active = true;
-        break;
-      }//if
-
-    }//for
-
-    if (already_active == false) {
-      AddListItem(document, active_charsets, charsetid, charsetname);
-    }//if
-
-  }//for
-
-  available_charsets.clearSelection();
-  enable_save();
-
-} //AddAvailableCharset
-
-
-
-function RemoveActiveCharset()
-{
-  var listbox = document.getElementById('active_charsets');
-  var numSelectedItems = listbox.selectedItems.length;
-
-  for (var count = 0; count < numSelectedItems; count ++) {
-    listbox.removeChild(listbox.selectedItems[0]);
-  }
-
-  listbox.clearSelection();
-
-  enable_save();
-} //RemoveActiveCharset
-
-
-
-function Save()
-{
-  // Iterate through the 'active charsets  tree to collect the charsets
-  // that the user has chosen.
-
-  var active_charsets = document.getElementById('active_charsets');
-
-  var charsetid    = "";
-  var num_charsets = 0;
-  var pref_string_content = '';
-
-  for (var item = active_charsets.firstChild; item != null; item = item.nextSibling) {
-    charsetid = item.id;
-
-    if (charsetid.length > 1) {
-      num_charsets++;
-
-      //separate >1 charsets by commas
-      if (num_charsets > 1)
-        pref_string_content = pref_string_content + ", " + charsetid;
-      else
-        pref_string_content = charsetid;
-    }
-  }
-
-  try
-  {
-    if (prefBranch) {
-      pref_string_object.data = pref_string_content;
-      prefBranch.setComplexValue(pref_string_title, Components.interfaces.nsIPrefLocalizedString, pref_string_object);
-      window.close();
-    }
-  }
-  catch(ex) {
-    confirm('exception' + ex);
-  }
-  return true;
-} //Save
-
-
-function MoveUp() {
-  var listbox = document.getElementById('active_charsets');
-  if (listbox.selectedItems.length == 1) {
-    var selected = listbox.selectedItems[0];
-    var before = selected.previousSibling
-    if (before) {
-      listbox.insertBefore(selected, before);
-      listbox.selectItem(selected);
-      listbox.ensureElementIsVisible(selected);
-    }
-  }
-
-  enable_save();
-} //MoveUp
-
-
-
-function MoveDown() {
-  var listbox = document.getElementById('active_charsets');
-  if (listbox.selectedItems.length == 1) {
-    var selected = listbox.selectedItems[0];
-    if (selected.nextSibling) {
-      if (selected.nextSibling.nextSibling)
-        listbox.insertBefore(selected, selected.nextSibling.nextSibling);
-      else
-        selected.parentNode.appendChild(selected);
-      listbox.selectItem(selected);
-    }
-  }
-
-  enable_save();
-} //MoveDown
-
-function AddListItem(doc, listbox, ID, UIstring)
-{
-  // Create a treerow for the new item
-  var item = doc.createElement('listitem');
-
-  // Copy over the attributes
-  item.setAttribute('label', UIstring);
-  item.setAttribute('id', ID);
-
-  listbox.appendChild(item);
-}
deleted file mode 100644
--- a/toolkit/content/customizeCharset.xul
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-
-<!DOCTYPE dialog SYSTEM "chrome://global/locale/customizeCharset.dtd">
-
-<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        title="&title.label;"
-        onload="Init();"
-        ondialogaccept="return Save();"
-        persist="width height">
-
-  <script type="application/javascript" src="chrome://global/content/customizeCharset.js"/>
-  <script type="application/javascript">
-  <![CDATA[
-    var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
-    observerService.notifyObservers(null, "charsetmenu-selected", "other");
-  ]]>
-  </script>
-  
-  <!-- The two-pane -->
-  <hbox flex="1">
-    <vbox flex="1">
-      <label value="&additional.label;" control="available_charsets"/>
-      <!-- Available Charsets Tree -->
-      <listbox id="available_charsets" flex="1" seltype="multiple"
-            onfocus = "document.getElementById('active_charsets').clearSelection(); this.selectItem(this.currentItem || this.getItemAtIndex(0));"
-            onselect="update_buttons();"
-            ondblclick="AddAvailableCharset();"/>
-      
-      <separator class="thin"/>
-      
-      <hbox align="center">
-        <button id="add_button" oncommand="AddAvailableCharset();"
-                label="&add.label;" icon="add"  accesskey="&add.accessKey;"/>
-      </hbox>
-    </vbox>
-    
-    <separator orient="vertical"/>
-    
-    <vbox flex="1">
-      <label value="&current.label;" control="active_charsets"/>
-      <listbox id="active_charsets" flex="1" seltype="multiple"
-            onfocus = "document.getElementById('available_charsets').clearSelection(); this.selectItem(this.currentItem || this.getItemAtIndex(0));"
-            onselect="update_buttons();"
-            ondblclick="RemoveActiveCharset();"/>
-      
-      <separator class="thin"/>
-      <hbox align="center">
-        <button id="up_button" label="&moveUp.label;" icon="go-up"
-                accesskey="&moveUp.accessKey;" oncommand="MoveUp();"/>
-        <button id="down_button" label="&moveDown.label;" icon="go-down"
-                accesskey="&moveDown.accessKey;" oncommand="MoveDown();"/>
-        <button id="remove_button" oncommand="RemoveActiveCharset();" icon="remove"
-                label="&remove.label;" accesskey="&remove.accessKey;"/>
-      </hbox>
-    </vbox> 
-  </hbox>
-</dialog>
--- a/toolkit/content/jar.mn
+++ b/toolkit/content/jar.mn
@@ -25,21 +25,17 @@ toolkit.jar:
    content/global/aboutTelemetry.xhtml
    content/global/aboutTelemetry.css          (aboutTelemetry.css)
    content/global/directionDetector.html
    content/global/plugins.html
    content/global/plugins.css
    content/global/browser-child.js            (browser-child.js)
    content/global/browser-content.js          (browser-content.js)
 *+  content/global/buildconfig.html            (buildconfig.html)
-+  content/global/charsetOverlay.js           (charsetOverlay.js)
-+  content/global/charsetOverlay.xul          (charsetOverlay.xul)
 *  content/global/contentAreaUtils.js         (contentAreaUtils.js)
-   content/global/customizeCharset.js         (customizeCharset.js)
-   content/global/customizeCharset.xul        (customizeCharset.xul)
    content/global/customizeToolbar.css        (customizeToolbar.css)
 *  content/global/customizeToolbar.js         (customizeToolbar.js)
    content/global/customizeToolbar.xul        (customizeToolbar.xul)
    content/global/devicestorage.properties    (devicestorage.properties)
    content/global/directoryLinks.json         (directoryLinks.json)
    content/global/editMenuOverlay.js          (editMenuOverlay.js)
 *+ content/global/editMenuOverlay.xul         (editMenuOverlay.xul)
    content/global/finddialog.js               (finddialog.js)
deleted file mode 100644
--- a/toolkit/locales/en-US/chrome/global/charsetOverlay.dtd
+++ /dev/null
@@ -1,23 +0,0 @@
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<!-- extracted from charsetOverlay.xul -->
-<!ENTITY charsetMenu.label             "Character Encoding">
-<!ENTITY charsetMenu.accesskey         "C">
-<!ENTITY charsetMenuAutodet.label      "Auto-Detect">
-<!ENTITY charsetMenuAutodet.accesskey  "a">
-<!ENTITY charsetMenuMore.label         "More Encodings">
-<!ENTITY charsetMenuMore.accesskey     "m">
-<!ENTITY charsetMenuMore1.label        "West European">
-<!ENTITY charsetMenuMore1.accesskey    "w">
-<!ENTITY charsetMenuMore2.label        "East European">
-<!ENTITY charsetMenuMore2.accesskey    "E">
-<!ENTITY charsetMenuMore3.label        "East Asian">
-<!ENTITY charsetMenuMore3.accesskey    "A">
-<!ENTITY charsetMenuMore4.label        "SE &amp; SW Asian">
-<!ENTITY charsetMenuMore4.accesskey    "S">
-<!ENTITY charsetMenuMore5.label        "Middle Eastern">
-<!ENTITY charsetMenuMore5.accesskey    "M">
-<!ENTITY charsetCustomize.label        "Customize List…">
-<!ENTITY charsetCustomize.accesskey    "c">
deleted file mode 100644
--- a/toolkit/locales/en-US/chrome/global/customizeCharset.dtd
+++ /dev/null
@@ -1,16 +0,0 @@
-<!-- -*- Mode: HTML -*- -->
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<!ENTITY title.label        "Customize Character Encoding">
-<!ENTITY current.label      "Active Character Encodings:">
-<!ENTITY remove.label       "Remove">
-<!ENTITY remove.accessKey   "R">
-<!ENTITY additional.label   "Available Character Encodings:">
-<!ENTITY add.label          "Add">
-<!ENTITY add.accessKey      "A">
-<!ENTITY moveUp.label       "Move Up">
-<!ENTITY moveUp.accessKey   "U">
-<!ENTITY moveDown.label     "Move Down">
-<!ENTITY moveDown.accessKey "D">
--- a/toolkit/locales/en-US/chrome/global/intl.properties
+++ b/toolkit/locales/en-US/chrome/global/intl.properties
@@ -35,29 +35,23 @@ intl.accept_languages=en-US, en
 # LOCALIZATION NOTE (font.language.group):
 # This preference controls the initial setting of the language drop-down menu
 # in the Content > Fonts & Colors > Advanced preference panel.
 #
 # Set it to the value of one of the menuitems in the "selectLangs" menulist in
 # http://mxr.mozilla.org/mozilla/source/browser/components/preferences/fonts.xul
 font.language.group=x-western
 
-# LOCALIZATION NOTE (intl.charset.detector, intl.charsetmenu.browser.static, intl.charsetmenu.mailedit):
-# For the list of canonical charset values, refer to:
-# http://mxr.mozilla.org/mozilla-central/source/intl/locale/src/charsetalias.properties
-#
-# If you are modifying the charset preferences for your locale, be sure to use
-# the values from that list, not the keys. Note that these values are
-# case-sensitive and must be reproduced exactly as listed.
-#
-# Note also that the list of charsets in 'intl.charsetmenu.browser.static'
-# must always include "UTF-8".
+# LOCALIZATION NOTE (intl.charset.detector):
+# This preference controls the initial setting for the character encoding
+# detector. Valid values are ja_parallel_state_machine for Japanese, ruprob
+# for Russian and ukprob for Ukrainian and the empty string to turn detection
+# off. The value must be empty for locales other than Japanese, Russian and
+# Ukrainian.
 intl.charset.detector=
-intl.charsetmenu.browser.static=ISO-8859-1, UTF-8
-intl.charsetmenu.mailedit=ISO-8859-1, ISO-8859-15, ISO-8859-6, armscii-8, ISO-8859-13, ISO-8859-14, ISO-8859-2, GB2312, GB18030, Big5, KOI8-R, windows-1251, KOI8-U, ISO-8859-7, ISO-8859-8-I, windows-1255, ISO-2022-JP, EUC-KR, ISO-8859-10, ISO-8859-3, TIS-620, ISO-8859-9, UTF-8, VISCII
 
 # LOCALIZATION NOTE (pluralRule): Pick the appropriate plural rule for your
 # language. This will determine how many plural forms of a word you will need
 # to provide and in what order.
 # See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
 pluralRule=1
 
 # LOCALIZATION NOTE (intl.menuitems.alwaysappendaccesskeys, intl.menuitems.insertseparatorbeforeaccesskeys):
--- a/toolkit/locales/jar.mn
+++ b/toolkit/locales/jar.mn
@@ -15,25 +15,23 @@
   locale/@AB_CD@/global/aboutTelemetry.dtd              (%chrome/global/aboutTelemetry.dtd)
   locale/@AB_CD@/global/aboutTelemetry.properties       (%chrome/global/aboutTelemetry.properties)
   locale/@AB_CD@/global/actions.dtd                     (%chrome/global/actions.dtd)
   locale/@AB_CD@/global/appPicker.dtd                   (%chrome/global/appPicker.dtd)
   locale/@AB_CD@/global/brand.dtd                       (generic/chrome/global/brand.dtd)
   locale/@AB_CD@/global/browser.properties              (%chrome/global/browser.properties)
   locale/@AB_CD@/global/charsetMenu.dtd                 (%chrome/global/charsetMenu.dtd)
   locale/@AB_CD@/global/charsetMenu.properties          (%chrome/global/charsetMenu.properties)
-  locale/@AB_CD@/global/charsetOverlay.dtd              (%chrome/global/charsetOverlay.dtd)
   locale/@AB_CD@/global/commonDialog.dtd                (%chrome/global/commonDialog.dtd)
   locale/@AB_CD@/global/commonDialogs.properties        (%chrome/global/commonDialogs.properties)
   locale/@AB_CD@/global/config.dtd                      (%chrome/global/config.dtd)
   locale/@AB_CD@/global/config.properties               (%chrome/global/config.properties)
   locale/@AB_CD@/global/console.dtd                     (%chrome/global/console.dtd)
   locale/@AB_CD@/global/console.properties              (%chrome/global/console.properties)
   locale/@AB_CD@/global/contentAreaCommands.properties  (%chrome/global/contentAreaCommands.properties)
-  locale/@AB_CD@/global/customizeCharset.dtd            (%chrome/global/customizeCharset.dtd)
   locale/@AB_CD@/global/customizeToolbar.dtd            (%chrome/global/customizeToolbar.dtd)
   locale/@AB_CD@/global/customizeToolbar.properties     (%chrome/global/customizeToolbar.properties)
   locale/@AB_CD@/global/datetimepicker.dtd              (%chrome/global/datetimepicker.dtd)
   locale/@AB_CD@/global/dateFormat.properties           (%chrome/global/dateFormat.properties)
   locale/@AB_CD@/global/devtools/debugger.properties    (%chrome/global/devtools/debugger.properties)
   locale/@AB_CD@/global/devtools/styleinspector.properties (%chrome/global/devtools/styleinspector.properties)
   locale/@AB_CD@/global/dialogOverlay.dtd               (%chrome/global/dialogOverlay.dtd)
   locale/@AB_CD@/global/editMenuOverlay.dtd             (%chrome/global/editMenuOverlay.dtd)