Bug 1208376 - Disable v2 data upload in Firefox 42+. r=gfritzsche, a=sledru
authorAlessio Placitelli <alessio.placitelli@gmail.com>
Fri, 25 Sep 2015 06:02:00 +0200
changeset 297863 e7b899c144c9cac4ddc6c574c270db75e811394c
parent 297862 7970459fa07d07e7dac5bfdb138f2ca53db00ed5
child 297864 9d1337291612178ddbbdcb82b272fe7414fbbda8
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche, sledru
bugs1208376
milestone43.0a2
Bug 1208376 - Disable v2 data upload in Firefox 42+. r=gfritzsche, a=sledru
services/datareporting/datareporting-prefs.js
services/datareporting/policy.jsm
--- a/services/datareporting/datareporting-prefs.js
+++ b/services/datareporting/datareporting-prefs.js
@@ -1,12 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 pref("datareporting.policy.dataSubmissionEnabled", true);
+pref("datareporting.policy.dataSubmissionEnabled.v2", true);
 pref("datareporting.policy.firstRunTime", "0");
 pref("datareporting.policy.dataSubmissionPolicyNotifiedTime", "0");
 pref("datareporting.policy.dataSubmissionPolicyAcceptedVersion", 0);
 pref("datareporting.policy.dataSubmissionPolicyBypassNotification", false);
 pref("datareporting.policy.currentPolicyVersion", 2);
 pref("datareporting.policy.minimumPolicyVersion", 1);
 pref("datareporting.policy.minimumPolicyVersion.channel-beta", 2);
--- a/services/datareporting/policy.jsm
+++ b/services/datareporting/policy.jsm
@@ -373,16 +373,26 @@ this.DataReportingPolicy.prototype = Obj
     // Default is true because we are opt-out.
     return this._prefs.get("dataSubmissionEnabled", true);
   },
 
   set dataSubmissionEnabled(value) {
     this._prefs.set("dataSubmissionEnabled", !!value);
   },
 
+  /**
+   * Whether submission of data is allowed for v2.
+   *
+   * This is used to gently turn off data submission for FHR v2 in Firefox 42+.
+   */
+  get dataSubmissionEnabledV2() {
+    // Default is true because we are opt-out.
+    return this._prefs.get("dataSubmissionEnabled.v2", true);
+  },
+
   get currentPolicyVersion() {
     return this._prefs.get("currentPolicyVersion", DATAREPORTING_POLICY_VERSION);
   },
 
   /**
    * The minimum policy version which for dataSubmissionPolicyAccepted to
    * to be valid.
    */
@@ -643,17 +653,17 @@ this.DataReportingPolicy.prototype = Obj
    *
    * Typically this function is called automatically by the background polling.
    * But, it can safely be called manually as needed.
    */
   checkStateAndTrigger: function checkStateAndTrigger() {
     // If the master data submission kill switch is toggled, we have nothing
     // to do. We don't notify about data policies because this would have
     // no effect.
-    if (!this.dataSubmissionEnabled) {
+    if (!this.dataSubmissionEnabled || !this.dataSubmissionEnabledV2) {
       this._log.debug("Data submission is disabled. Doing nothing.");
       return;
     }
 
     let now = this.now();
     let nowT = now.getTime();
     let nextSubmissionDate = this.nextDataSubmissionDate;