Bug 1205833 - Don't log an error if we did not store any datareporting policy notify date yet. r=dexter
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Fri, 18 Sep 2015 13:17:16 +0700
changeset 295859 d21e7e92f11affeab4ef0fcb1de870c5886199f3
parent 295858 7be913efcdfb1471ad21c5333951262f366fdaf2
child 295860 ca7e2bde5018579720ab54bb85f739c33eb3417b
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdexter
bugs1205833
milestone43.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 1205833 - Don't log an error if we did not store any datareporting policy notify date yet. r=dexter
toolkit/components/telemetry/TelemetryReportingPolicy.jsm
--- a/toolkit/components/telemetry/TelemetryReportingPolicy.jsm
+++ b/toolkit/components/telemetry/TelemetryReportingPolicy.jsm
@@ -179,26 +179,27 @@ var TelemetryReportingPolicyImpl = {
     return this._logger;
   },
 
   /**
    * Get the date the policy was notified.
    * @return {Object} A date object or null on errors.
    */
   get dataSubmissionPolicyNotifiedDate() {
-    if (!Preferences.has(PREF_ACCEPTED_POLICY_DATE)) {
+    let prefString = Preferences.get(PREF_ACCEPTED_POLICY_DATE, "0");
+    let valueInteger = parseInt(prefString, 10);
+
+    // Bail out if we didn't store any value yet.
+    if (valueInteger == 0) {
       this._log.info("get dataSubmissionPolicyNotifiedDate - No date stored yet.");
       return null;
     }
 
-    let prefString = Preferences.get(PREF_ACCEPTED_POLICY_DATE, 0);
-    let valueInteger = parseInt(prefString, 10);
-
-    // If nothing or an invalid value is saved in the prefs, bail out.
-    if (Number.isNaN(valueInteger) || valueInteger == 0) {
+    // If an invalid value is saved in the prefs, bail out too.
+    if (Number.isNaN(valueInteger)) {
       this._log.error("get dataSubmissionPolicyNotifiedDate - Invalid date stored.");
       return null;
     }
 
     // Make sure the notification date is newer then the oldest allowed date.
     let date = new Date(valueInteger);
     if (date.getFullYear() < OLDEST_ALLOWED_ACCEPTANCE_YEAR) {
       this._log.error("get dataSubmissionPolicyNotifiedDate - The stored date is too old.");