Bug 829881 - Remove references to replaced Telemetry notification bar; r=tchevalier, a=akeybl
authorGregory Szorc <gps@mozilla.com>
Tue, 15 Jan 2013 12:38:01 -0800
changeset 127242 77ac5f84e113519b51089d14cdc329582a761dc4
parent 127241 dd0378c2d1b70348ac7a898dc536cc50220d9058
child 127243 b08ac3e59f6346661f1b48c81c16c97cd8242786
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstchevalier, akeybl
bugs829881
milestone20.0a2
Bug 829881 - Remove references to replaced Telemetry notification bar; r=tchevalier, a=akeybl
browser/base/content/browser-data-submission-info-bar.js
browser/components/nsBrowserGlue.js
browser/components/preferences/advanced.js
browser/components/preferences/advanced.xul
browser/components/preferences/in-content/advanced.js
browser/components/preferences/in-content/advanced.xul
services/datareporting/DataReportingService.js
services/datareporting/modules-testing/mocks.jsm
services/datareporting/policy.jsm
services/datareporting/tests/xpcshell/test_policy.js
toolkit/content/aboutTelemetry.js
toolkit/content/jar.mn
--- a/browser/base/content/browser-data-submission-info-bar.js
+++ b/browser/base/content/browser-data-submission-info-bar.js
@@ -19,26 +19,16 @@ function DataNotificationInfoBar() {
 DataNotificationInfoBar.prototype = {
   _OBSERVERS: [
     "datareporting:notify-data-policy:request",
     "datareporting:notify-data-policy:close",
   ],
 
   _DATA_REPORTING_NOTIFICATION: "data-reporting",
 
-#ifdef MOZ_TELEMETRY_REPORTING
-#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
-  _PREF_TELEMETRY_DISPLAYED: "toolkit.telemetry.notifiedOptOut",
-#else
-  _PREF_TELEMETRY_DISPLAYED: "toolkit.telemetry.prompted",
-#endif
-
-  _TELEMETRY_DISPLAY_REV: 2,
-#endif
-
   init: function() {
     window.addEventListener("unload", function onUnload() {
       window.removeEventListener("unload", onUnload, false);
 
       for (let o of this._OBSERVERS) {
         Services.obs.removeObserver(this, o);
       }
     }.bind(this), false);
@@ -126,22 +116,16 @@ DataNotificationInfoBar.prototype = {
           Services.obs.notifyObservers(null, "datareporting:notify-data-policy:close", null);
         }
       }.bind(this)
     );
 
     // Keep open until user closes it.
     notification.persistence = -1;
 
-    // This likely isn't needed in a world where Telemetry and FHR share a
-    // notification and data reporting policy. It is preserved until traces
-    // of this pref are wiped from the code base.
-    Services.prefs.setIntPref(this._PREF_TELEMETRY_DISPLAYED,
-                              this._TELEMETRY_DISPLAY_REV);
-
     // Tell the notification request we have displayed the notification.
     request.onUserNotifyComplete();
   },
 
   _clearPolicyNotification: function () {
     let notification = this._getDataReportingNotification();
     if (notification) {
       notification.close();
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -1,9 +1,8 @@
-#filter substitution
 # -*- indent-tabs-mode: nil -*-
 # 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/.
 
 const Ci = Components.interfaces;
 const Cc = Components.classes;
 const Cr = Components.results;
--- a/browser/components/preferences/advanced.js
+++ b/browser/components/preferences/advanced.js
@@ -1,9 +1,8 @@
-#filter substitution
 # -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 # 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/.
 
 // Load DownloadUtils module for convertByteUnits
 Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
 Components.utils.import("resource://gre/modules/ctypes.jsm");
@@ -187,54 +186,27 @@ var gAdvancedPane = {
       var cr = Components.classes["@mozilla.org/toolkit/crash-reporter;1"].
                getService(Components.interfaces.nsICrashReporter);
       cr.submitReports = checkbox.checked;
     } catch (e) { }
   },
 
 
   /**
-   * When telemetry is opt-out, verify if the user explicitly rejected the
-   * telemetry prompt, and if so reflect his choice in the current preference
-   * value. This doesn't cover the case where the user refused telemetry in the
-   * prompt but later enabled it in preferences in builds before the fix for
-   * bug 737600.
+   * The preference/checkbox is configured in XUL.
    *
    * In all cases, set up the Learn More link sanely
    */
   initTelemetry: function ()
   {
-#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
-    const PREF_TELEMETRY_ENABLED = "toolkit.telemetry.enabledPreRelease";
-    let enabled = Services.prefs.getBoolPref(PREF_TELEMETRY_ENABLED);
-    let rejected = false;
-    try {
-      rejected = Services.prefs.getBoolPref("toolkit.telemetry.rejected");
-    } catch (e) {}
-    if (enabled && rejected) {
-      Services.prefs.setBoolPref(PREF_TELEMETRY_ENABLED, false);
-    }
-#endif
 #ifdef MOZ_TELEMETRY_REPORTING
     this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
 #endif
   },
 
-  /**
-   * When the user toggles telemetry, update the rejected value as well, so we
-   * know he expressed a choice, and don't re-prompt inadvertently.
-   */
-  telemetryEnabledChanged: function (event)
-  {
-    let rejected = document.getElementById("toolkit.telemetry.rejected");
-    rejected.value = !event.target.value;
-    let displayed = document.getElementById("toolkit.telemetry.prompted");
-    displayed.value = @MOZ_TELEMETRY_DISPLAY_REV@;
-  },
-
 #ifdef MOZ_SERVICES_HEALTHREPORT
   /**
    * Initialize the health report service reference and checkbox.
    */
   initSubmitHealthReport: function () {
     this._setupLearnMoreLink("datareporting.healthreport.infoURL", "FHRLearnMore");
 
     let policy = Components.classes["@mozilla.org/datareporting/service;1"]
--- a/browser/components/preferences/advanced.xul
+++ b/browser/components/preferences/advanced.xul
@@ -54,27 +54,16 @@
 
 #ifdef MOZ_TELEMETRY_REPORTING
       <preference id="toolkit.telemetry.enabled"
 #ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
                   name="toolkit.telemetry.enabledPreRelease"
 #else
                   name="toolkit.telemetry.enabled"
 #endif
-                  onchange="gAdvancedPane.telemetryEnabledChanged(event);"
-                  type="bool"/>
-      <preference id="toolkit.telemetry.prompted"
-#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
-                  name="toolkit.telemetry.notifiedOptOut"
-#else
-                  name="toolkit.telemetry.prompted"
-#endif
-                  type="int"/>
-      <preference id="toolkit.telemetry.rejected"
-                  name="toolkit.telemetry.rejected"
                   type="bool"/>
 #endif
 
       <!-- Network tab -->
       <preference id="browser.cache.disk.capacity"     name="browser.cache.disk.capacity"     type="int"/>
       <preference id="browser.offline-apps.notify"     name="browser.offline-apps.notify"     type="bool"/>
 
       <preference id="browser.cache.disk.smart_size.enabled"
--- a/browser/components/preferences/in-content/advanced.js
+++ b/browser/components/preferences/in-content/advanced.js
@@ -1,9 +1,8 @@
-#filter substitution
 /* 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/. */
 
 // Load DownloadUtils module for convertByteUnits
 Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
 
 var gAdvancedPane = {
@@ -176,55 +175,27 @@ var gAdvancedPane = {
     try {
       var cr = Components.classes["@mozilla.org/toolkit/crash-reporter;1"].
                getService(Components.interfaces.nsICrashReporter);
       cr.submitReports = checkbox.checked;
     } catch (e) { }
   },
 
   /**
-   * When telemetry is opt-out, verify if the user explicitly rejected the
-   * telemetry prompt, and if so reflect his choice in the current preference
-   * value. This doesn't cover the case where the user refused telemetry in the
-   * prompt but later enabled it in preferences in builds before the fix for
-   * bug 737600.
+   * The preference/checkbox is configured in XUL.
    *
    * In all cases, set up the Learn More link sanely.
    */
   initTelemetry: function ()
   {
-#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
-    const PREF_TELEMETRY_ENABLED = "toolkit.telemetry.enabledPreRelease";
-    let enabled = Services.prefs.getBoolPref(PREF_TELEMETRY_ENABLED);
-    let rejected = false;
-    try {
-      rejected = Services.prefs.getBoolPref("toolkit.telemetry.rejected");
-    } catch (e) {}
-    if (enabled && rejected) {
-      Services.prefs.setBoolPref(PREF_TELEMETRY_ENABLED, false);
-    }
-#endif
 #ifdef MOZ_TELEMETRY_REPORTING
     this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
 #endif
   },
 
-
-  /**
-   * When the user toggles telemetry, update the rejected value as well, so we
-   * know he expressed a choice, and don't re-prompt inadvertently.
-   */
-  telemetryEnabledChanged: function (event)
-  {
-    let rejected = document.getElementById("toolkit.telemetry.rejected");
-    rejected.value = !event.target.value;
-    let displayed = document.getElementById("toolkit.telemetry.prompted");
-    displayed.value = @MOZ_TELEMETRY_DISPLAY_REV@;
-  },
-
 #ifdef MOZ_SERVICES_HEALTHREPORT
   /**
    * Initialize the health report service reference and checkbox.
    */
   initSubmitHealthReport: function () {
     this._setupLearnMoreLink("datareporting.healthreport.infoURL", "FHRLearnMore");
 
     let policy = Components.classes["@mozilla.org/datareporting/service;1"]
--- a/browser/components/preferences/in-content/advanced.xul
+++ b/browser/components/preferences/in-content/advanced.xul
@@ -54,27 +54,16 @@
 
 #ifdef MOZ_TELEMETRY_REPORTING
   <preference id="toolkit.telemetry.enabled"
 #ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
               name="toolkit.telemetry.enabledPreRelease"
 #else
               name="toolkit.telemetry.enabled"
 #endif
-              onchange="gAdvancedPane.telemetryEnabledChanged(event);"
-              type="bool"/>
-  <preference id="toolkit.telemetry.prompted"
-#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
-              name="toolkit.telemetry.notifiedOptOut"
-#else
-              name="toolkit.telemetry.prompted"
-#endif
-              type="int"/>
-  <preference id="toolkit.telemetry.rejected"
-              name="toolkit.telemetry.rejected"
               type="bool"/>
 #endif
 
   <!-- Network tab -->
   <preference id="browser.cache.disk.capacity"
               name="browser.cache.disk.capacity"
               type="int"/>
   <preference id="browser.offline-apps.notify"
--- a/toolkit/content/aboutTelemetry.js
+++ b/toolkit/content/aboutTelemetry.js
@@ -1,9 +1,8 @@
-#filter substitution
 /* 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/. */
 
 'use strict';
 
 const Ci = Components.interfaces;
 const Cc = Components.classes;
@@ -19,23 +18,19 @@ const brandBundle = Services.strings.cre
 const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].
   getService(Ci.nsITelemetryPing);
 
 // Maximum height of a histogram bar (in em)
 const MAX_BAR_HEIGHT = 18;
 const PREF_TELEMETRY_SERVER_OWNER = "toolkit.telemetry.server_owner";
 #ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
 const PREF_TELEMETRY_ENABLED = "toolkit.telemetry.enabledPreRelease";
-const PREF_TELEMETRY_DISPLAYED = "toolkit.telemetry.notifiedOptOut";
 #else
 const PREF_TELEMETRY_ENABLED = "toolkit.telemetry.enabled";
-const PREF_TELEMETRY_DISPLAYED = "toolkit.telemetry.prompted";
 #endif
-const PREF_TELEMETRY_REJECTED  = "toolkit.telemetry.rejected";
-const TELEMETRY_DISPLAY_REV = @MOZ_TELEMETRY_DISPLAY_REV@;
 const PREF_DEBUG_SLOW_SQL = "toolkit.telemetry.debugSlowSql";
 const PREF_SYMBOL_SERVER_URI = "profiler.symbolicationUrl";
 const DEFAULT_SYMBOL_SERVER_URI = "http://symbolapi.mozilla.org";
 
 // Cached value of document's RTL mode
 let documentRTLMode = "";
 
 /**
@@ -79,20 +74,16 @@ let observer = {
   disableTelemetry: bundle.GetStringFromName("disableTelemetry"),
 
   /**
    * Observer is called whenever Telemetry is enabled or disabled
    */
   observe: function observe(aSubject, aTopic, aData) {
     if (aData == PREF_TELEMETRY_ENABLED) {
       this.updatePrefStatus();
-      Services.prefs.setBoolPref(PREF_TELEMETRY_REJECTED,
-                                 !getPref(PREF_TELEMETRY_ENABLED, false));
-      Services.prefs.setIntPref(PREF_TELEMETRY_DISPLAYED,
-                                TELEMETRY_DISPLAY_REV);
     }
   },
 
   /**
    * Updates the button & text at the top of the page to reflect Telemetry state.
    */
   updatePrefStatus: function updatePrefStatus() {
     // Notify user whether Telemetry is enabled
--- a/toolkit/content/jar.mn
+++ b/toolkit/content/jar.mn
@@ -11,17 +11,17 @@ toolkit.jar:
    content/global/textbox.css                 (textbox.css)
    content/global/menulist.css                (menulist.css)
    content/global/about.xhtml                 (about.xhtml)
    content/global/aboutAbout.xhtml            (aboutAbout.xhtml)
    content/global/aboutRights.xhtml           (aboutRights.xhtml)
    content/global/aboutRights-unbranded.xhtml (aboutRights-unbranded.xhtml)
 *  content/global/aboutSupport.js
 *  content/global/aboutSupport.xhtml
-*  content/global/aboutTelemetry.js
+   content/global/aboutTelemetry.js
 *  content/global/aboutTelemetry.xhtml
    content/global/aboutTelemetry.css          (aboutTelemetry.css)
    content/global/directionDetector.html
    content/global/plugins.html
    content/global/plugins.css
 *+  content/global/buildconfig.html            (buildconfig.html)
 +  content/global/charsetOverlay.js           (charsetOverlay.js)
 +  content/global/charsetOverlay.xul          (charsetOverlay.xul)