Bug 745501 - Make sure simple string prefs get sent to Java properly. r=mfinkle
authorKartikaya Gupta <kgupta@mozilla.com>
Sun, 15 Apr 2012 09:34:14 -0400
changeset 95029 1ce567bc7915a3350f6626094a33a9bde5820fe4
parent 95009 6f44748aa046c4528005765fa0cc532523982018
child 95030 7e798c7b83801a273dfa18c44307f966ab1adc3b
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs745501
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 745501 - Make sure simple string prefs get sent to Java properly. r=mfinkle
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -760,22 +760,28 @@ var BrowserApp = {
               break;
             case Ci.nsIPrefBranch.PREF_INT:
               pref.type = "int";
               pref.value = Services.prefs.getIntPref(prefName);
               break;
             case Ci.nsIPrefBranch.PREF_STRING:
             default:
               pref.type = "string";
-              pref.value = Services.prefs.getComplexValue(prefName, Ci.nsIPrefLocalizedString).data;
+              try {
+                // Try in case it's a localized string (will throw an exception if not)
+                pref.value = Services.prefs.getComplexValue(prefName, Ci.nsIPrefLocalizedString).data;
+              } catch (e) {
+                pref.value = Services.prefs.getCharPref(prefName);
+              }
               break;
           }
         } catch (e) {
-            // preference does not exist; do not send it
-            continue;
+          dump("Error reading pref [" + prefName + "]: " + e);
+          // preference does not exist; do not send it
+          continue;
         }
 
         // some preferences use integers or strings instead of booleans for
         // indicating enabled/disabled. since the java ui uses the type to
         // determine which ui elements to show, we need to normalize these
         // preferences to be actual booleans.
         switch (prefName) {
           case "network.cookie.cookieBehavior":