Wallpaper fix - Bug 895473 - [Mac and Linux] Custom distribution settings for yahoo de and es distributions are not being set. r=mconnor, a=lsblakk
authorRobert Strong <robert.bugzilla@gmail.com>
Fri, 19 Jul 2013 14:19:53 -0700
changeset 147948 51b93baa190bd40c054c5ef973055677b5cc3070
parent 147947 32a993ffe7d81a8ebf7171bc6aa8ba8b3cf7cc9b
child 147949 71c6881a2803c4076dad3e8db5d9aca9b0af5d2e
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconnor, lsblakk
bugs895473
milestone24.0a2
Wallpaper fix - Bug 895473 - [Mac and Linux] Custom distribution settings for yahoo de and es distributions are not being set. r=mconnor, a=lsblakk
browser/base/content/aboutDialog.js
browser/components/distribution.js
--- a/browser/base/content/aboutDialog.js
+++ b/browser/base/content/aboutDialog.js
@@ -11,30 +11,32 @@ function init(aEvent)
 {
   if (aEvent.target != document)
     return;
 
   try {
     var distroId = Services.prefs.getCharPref("distribution.id");
     if (distroId) {
       var distroVersion = Services.prefs.getCharPref("distribution.version");
-      var distroAbout = Services.prefs.getComplexValue("distribution.about",
-        Components.interfaces.nsISupportsString);
-
-      var distroField = document.getElementById("distribution");
-      distroField.value = distroAbout;
-      distroField.style.display = "block";
 
       var distroIdField = document.getElementById("distributionId");
       distroIdField.value = distroId + " - " + distroVersion;
       distroIdField.style.display = "block";
+
+      // This must be set last because it might not exist due to bug 895473.
+      var distroAbout = Services.prefs.getComplexValue("distribution.about",
+        Components.interfaces.nsISupportsString);
+      var distroField = document.getElementById("distribution");
+      distroField.value = distroAbout;
+      distroField.style.display = "block";
     }
   }
   catch (e) {
     // Pref is unset
+    Components.utils.reportError(e);
   }
 
   // Include the build ID and display warning if this is an "a#" (nightly or aurora) build
   let version = Services.appinfo.version;
   if (/a\d+$/.test(version)) {
     let buildID = Services.appinfo.appBuildID;
     let buildDate = buildID.slice(0,4) + "-" + buildID.slice(4,6) + "-" + buildID.slice(6,8);
     document.getElementById("version").textContent += " (" + buildDate + ")";
--- a/browser/components/distribution.js
+++ b/browser/components/distribution.js
@@ -260,23 +260,28 @@ DistributionCustomizer.prototype = {
     // separate because they are "special" (read: required)
 
     defaults.setCharPref("distribution.id", this._ini.getString("Global", "id"));
     defaults.setCharPref("distribution.version",
                          this._ini.getString("Global", "version"));
 
     let partnerAbout = Cc["@mozilla.org/supports-string;1"].
       createInstance(Ci.nsISupportsString);
-    if (globalPrefs["about." + this._locale]) {
-      partnerAbout.data = this._ini.getString("Global", "about." + this._locale);
-    } else {
-      partnerAbout.data = this._ini.getString("Global", "about");
+    try {
+      if (globalPrefs["about." + this._locale]) {
+        partnerAbout.data = this._ini.getString("Global", "about." + this._locale);
+      } else {
+        partnerAbout.data = this._ini.getString("Global", "about");
+      }
+      defaults.setComplexValue("distribution.about",
+                               Ci.nsISupportsString, partnerAbout);
+    } catch (e) {
+      /* ignore bad prefs due to bug 895473 and move on */
+      Cu.reportError(e);
     }
-    defaults.setComplexValue("distribution.about",
-                             Ci.nsISupportsString, partnerAbout);
 
     if (sections["Preferences"]) {
       for (let key in enumerate(this._ini.getKeys("Preferences"))) {
         try {
           let value = eval(this._ini.getString("Preferences", key));
           switch (typeof value) {
           case "boolean":
             defaults.setBoolPref(key, value);