Bug 1191461 - Don't report an error if the dataSubmissionPolicyNotifiedTime pref was not set yet. r=margaret, a=sledru
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Tue, 18 Aug 2015 14:15:47 +0200
changeset 288920 9fcd5d5d641b88839489886e6b2eaed1de174476
parent 288919 3d9e06a2aa154b1dc2d91af9bb82ff131ff39b30
child 288921 d98f8e8309ec573c6e34e0db98d4010be96e6cea
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret, sledru
bugs1191461
milestone42.0a2
Bug 1191461 - Don't report an error if the dataSubmissionPolicyNotifiedTime pref was not set yet. r=margaret, a=sledru
toolkit/components/telemetry/TelemetryReportingPolicy.jsm
--- a/toolkit/components/telemetry/TelemetryReportingPolicy.jsm
+++ b/toolkit/components/telemetry/TelemetryReportingPolicy.jsm
@@ -179,16 +179,21 @@ let 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)) {
+      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) {
       this._log.error("get dataSubmissionPolicyNotifiedDate - Invalid date stored.");
       return null;
     }