Bug 807848 - use 'toolkit.telemetry.prompted' pref as Int - stage 1, cope with the pref being Bool or Int and save it as Bool for transitional period. r+a=standard8
authoraceman <acelists@atlas.sk>
Fri, 15 Feb 2013 12:12:03 +0000
changeset 13632 66f7060807f04653b2aea4226de0c12252def41b
parent 13631 dcc1993f148f5ae761ae3ef570fcfb45bc9a7656
child 13633 705a2b7c7e19b624234b99f399631daefbbaa0ab
child 13635 56815d9f5a312606a3c99d56f0d8e7c5b64f6bc6
child 13636 5967074c61d48e9857a35ef8b4bd9d4cc39a202f
child 13643 bf562632a41d5d74b9353921211dfca70c077677
child 13646 271d083a032be49c5abf11f720a254edf9c821a9
push id39
push userbugzilla@standard8.plus.com
push dateFri, 15 Feb 2013 12:21:25 +0000
bugs807848
Bug 807848 - use 'toolkit.telemetry.prompted' pref as Int - stage 1, cope with the pref being Bool or Int and save it as Bool for transitional period. r+a=standard8
mail/base/content/specialTabs.js
--- a/mail/base/content/specialTabs.js
+++ b/mail/base/content/specialTabs.js
@@ -738,19 +738,34 @@ var specialTabs = {
 
   /**
    * Looks at the existing prefs and determines if we should suggest the user
    * enables telemetry or not.
    *
    * This is controlled by the pref toolkit.telemetry.prompted
    */
   shouldShowTelemetryNotification: function(prefs) {
-    // toolkit has decided that the pref should have no default value
+    // For a transitional period (expected end in mid-2013) we allow the pref
+    // kTelemetryPrompted to be bool or int and reset it to bool.
+    // See bug 807848 for more details.
     try {
-      if (prefs.getBoolPref(kTelemetryPrompted) || prefs.getBoolPref(kTelemetryEnabled))
+      if (prefs.getIntPref(kTelemetryPrompted) > 0) {
+        prefs.clearUserPref(kTelemetryPrompted);
+        prefs.setBoolPref(kTelemetryPrompted, true);
+        return false;
+      }
+    } catch (e) {
+      try {
+        if (prefs.getBoolPref(kTelemetryPrompted))
+          return false;
+      } catch (e) { }
+    }
+    try {
+      // toolkit has decided that the pref should have no default value
+      if (prefs.getBoolPref(kTelemetryEnabled))
         return false;
     } catch (e) { }
     return true;
   },
 
   showTelemetryNotification: function(prefs) {
     var notifyBox = document.getElementById("mail-notification-box");