Backed out changeset e7f7cc81c103 (bug 943262) for breaking Android S4 tests
authorWes Kocher <wkocher@mozilla.com>
Fri, 14 Mar 2014 13:47:43 -0700
changeset 191808 2569cd05832a3368df78a1540a0de3d6f325cd0e
parent 191807 d385989f455b360122bab5bafc3e2a56cace1b3c
child 191809 d234b1080a13b2103983666139170c9a31810251
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs943262
milestone30.0a1
backs oute7f7cc81c10333623a345b77450b7b98824fdfbc
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset e7f7cc81c103 (bug 943262) for breaking Android S4 tests
mobile/android/app/mobile.js
mobile/android/chrome/content/browser.js
mobile/android/locales/en-US/chrome/browser.properties
mobile/android/locales/jar.mn
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -229,16 +229,17 @@ pref("accessibility.typeaheadfind.timeou
 pref("accessibility.typeaheadfind.flashBar", 1);
 pref("accessibility.typeaheadfind.linksonly", false);
 pref("accessibility.typeaheadfind.casesensitive", 0);
 pref("accessibility.browsewithcaret_shortcut.enabled", false);
 
 // Whether the character encoding menu is under the main Firefox button. This
 // preference is a string so that localizers can alter it.
 pref("browser.menu.showCharacterEncoding", "chrome://browser/locale/browser.properties");
+pref("intl.charsetmenu.browser.static", "chrome://browser/locale/browser.properties");
 
 // pointer to the default engine name
 pref("browser.search.defaultenginename", "chrome://browser/locale/region.properties");
 // SSL error page behaviour
 pref("browser.ssl_override_behavior", 2);
 pref("browser.xul.error_pages.expert_bad_cert", false);
 
 // disable logging for the search service by default
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -77,19 +77,16 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://shumway/ShumwayUtils.jsm");
 #endif
 
 #ifdef MOZ_ANDROID_SYNTHAPKS
 XPCOMUtils.defineLazyModuleGetter(this, "WebappManager",
                                   "resource://gre/modules/WebappManager.jsm");
 #endif
 
-XPCOMUtils.defineLazyModuleGetter(this, "CharsetMenu",
-                                  "resource://gre/modules/CharsetMenu.jsm");
-
 // Lazily-loaded browser scripts:
 [
   ["SelectHelper", "chrome://browser/content/SelectHelper.js"],
   ["InputWidgetHelper", "chrome://browser/content/InputWidgetHelper.js"],
   ["AboutReader", "chrome://browser/content/aboutReader.js"],
   ["MasterPassword", "chrome://browser/content/MasterPassword.js"],
   ["PluginHelper", "chrome://browser/content/PluginHelper.js"],
   ["OfflineApps", "chrome://browser/content/OfflineApps.js"],
@@ -251,17 +248,18 @@ function shouldShowProgress(url) {
 }
 
 /**
  * Cache of commonly used string bundles.
  */
 var Strings = {};
 [
   ["brand",      "chrome://branding/locale/brand.properties"],
-  ["browser",    "chrome://browser/locale/browser.properties"]
+  ["browser",    "chrome://browser/locale/browser.properties"],
+  ["charset",    "chrome://global/locale/charsetTitles.properties"]
 ].forEach(function (aStringBundle) {
   let [name, bundle] = aStringBundle;
   XPCOMUtils.defineLazyGetter(Strings, name, function() {
     return Services.strings.createBundle(bundle);
   });
 });
 
 const kFormHelperModeDisabled = 0;
@@ -6395,41 +6393,50 @@ var CharacterEncoding = {
 
     sendMessageToJava({
       type: "CharEncoding:State",
       visible: showCharEncoding
     });
   },
 
   getEncoding: function getEncoding() {
-    function infoToCharset(info) {
-      return { code: info.value, title: info.label };
+    function normalizeCharsetCode(charsetCode) {
+      return charsetCode.trim().toLowerCase();
+    }
+
+    function getTitle(charsetCode) {
+      let charsetTitle = charsetCode;
+      try {
+        charsetTitle = Strings.charset.GetStringFromName(charsetCode + ".title");
+      } catch (e) {
+        dump("error: title not found for " + charsetCode);
+      }
+      return charsetTitle;
     }
 
     if (!this._charsets.length) {
-      let data = CharsetMenu.getData();
-
-      // In the desktop UI, the pinned charsets are shown above the rest.
-      let pinnedCharsets = data.pinnedCharsets.map(infoToCharset);
-      let otherCharsets = data.otherCharsets.map(infoToCharset)
-
-      this._charsets = pinnedCharsets.concat(otherCharsets);
-    }
-
-    // Look for the index of the selected charset. Default to -1 if the
-    // doc charset isn't found in the list of available charsets.
-    let docCharset = BrowserApp.selectedBrowser.contentDocument.characterSet;
-    let selected = -1;
+      let charsets = Services.prefs.getComplexValue("intl.charsetmenu.browser.static", Ci.nsIPrefLocalizedString).data;
+      this._charsets = charsets.split(",").map(function (charset) {
+        return {
+          code: normalizeCharsetCode(charset),
+          title: getTitle(charset)
+        };
+      });
+    }
+
+    // if document charset is not in charset options, add it
+    let docCharset = normalizeCharsetCode(BrowserApp.selectedBrowser.contentDocument.characterSet);
+    let selected = 0;
     let charsetCount = this._charsets.length;
-
-    for (let i = 0; i < charsetCount; i++) {
-      if (this._charsets[i].code === docCharset) {
-        selected = i;
-        break;
-      }
+    for (; selected < charsetCount && this._charsets[selected].code != docCharset; selected++);
+    if (selected == charsetCount) {
+      this._charsets.push({
+        code: docCharset,
+        title: getTitle(docCharset)
+      });
     }
 
     sendMessageToJava({
       type: "CharEncoding:Data",
       charsets: this._charsets,
       selected: selected
     });
   },
--- a/mobile/android/locales/en-US/chrome/browser.properties
+++ b/mobile/android/locales/en-US/chrome/browser.properties
@@ -147,16 +147,20 @@ password.dontSave=Don't save
 # LOCALIZATION NOTE (browser.menu.showCharacterEncoding): Set to the string
 # "true" (spelled and capitalized exactly that way) to show the "Character
 # Encoding" menu in the site menu. Any other value will hide it. Without this
 # setting, the "Character Encoding" menu must be enabled via Preferences.
 # This is not a string to translate. If users frequently use the "Character Encoding"
 # menu, set this to "true". Otherwise, you can leave it as "false".
 browser.menu.showCharacterEncoding=false
 
+# LOCALIZATION NOTE (intl.charsetmenu.browser.static): Set to a series of comma separated
+# values for charsets that the user can select from in the Character Encoding menu.
+intl.charsetmenu.browser.static=iso-8859-1,utf-8,big5,iso-2022-jp,shift_jis,euc-jp
+
 # Text Selection
 selectionHelper.textCopied=Text copied to clipboard
 
 # Casting
 casting.prompt=Cast to Device
 
 # Context menu
 contextmenu.openInNewTab=Open Link in New Tab
--- a/mobile/android/locales/jar.mn
+++ b/mobile/android/locales/jar.mn
@@ -81,16 +81,17 @@ relativesrcdir toolkit/locales:
 % override chrome://global/locale/crashes.dtd chrome://browser/locale/overrides/crashreporter/crashes.dtd
 % override chrome://global/locale/crashes.properties chrome://browser/locale/overrides/crashreporter/crashes.properties
 % override chrome://global/locale/mozilla.dtd chrome://browser/locale/overrides/global/mozilla.dtd
 % override chrome://global/locale/aboutTelemetry.dtd chrome://browser/locale/overrides/global/aboutTelemetry.dtd
 % override chrome://global/locale/aboutTelemetry.properties chrome://browser/locale/overrides/global/aboutTelemetry.properties
 
 # overrides for dom l10n, also for en-US
 relativesrcdir dom/locales:
+  locale/@AB_CD@/browser/overrides/charsetTitles.properties    (%chrome/charsetTitles.properties)
   locale/@AB_CD@/browser/overrides/global.dtd                  (%chrome/global.dtd)
   locale/@AB_CD@/browser/overrides/AccessFu.properties         (%chrome/accessibility/AccessFu.properties)
   locale/@AB_CD@/browser/overrides/dom/dom.properties          (%chrome/dom/dom.properties)
 #about:plugins
   locale/@AB_CD@/browser/overrides/plugins.properties          (%chrome/plugins.properties)
 
 % override chrome://global/locale/charsetTitles.properties chrome://browser/locale/overrides/charsetTitles.properties
 % override chrome://global/locale/global.dtd chrome://browser/locale/overrides/global.dtd