Bug 1597697 - Stop sending AS heartbeat ping to Tiles data pipeline. r=thecount
authorNan Jiang <njiang028@gmail.com>
Wed, 20 Nov 2019 21:30:43 +0000
changeset 503102 402ff4eea0ed53b862662acfd001487653a2c1c9
parent 503101 a43202115869ca910305cdd4c718c99b0392239c
child 503103 57a8fe3e7ef7d244294c31413f512db6d2c7765a
push id101117
push usernajiang@mozilla.com
push dateWed, 20 Nov 2019 22:10:57 +0000
treeherderautoland@402ff4eea0ed [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersthecount
bugs1597697
milestone72.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 1597697 - Stop sending AS heartbeat ping to Tiles data pipeline. r=thecount This turns off the telemetry to Tiles in m-c. Activity Stream related telemetry to Tiles will be handled separately. Differential Revision: https://phabricator.services.mozilla.com/D53875
browser/app/profile/firefox.js
browser/components/BrowserGlue.jsm
browser/components/tests/unit/test_browserGlue_pingcentre.js
browser/components/tests/unit/xpcshell.ini
testing/profiles/perf/user.js
testing/profiles/reftest/user.js
testing/profiles/unittest-required/user.js
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1549,18 +1549,16 @@ pref("toolkit.telemetry.bhrPing.enabled"
   pref("toolkit.telemetry.ecosystemtelemetry.enabled", true);
 #else
   pref("toolkit.telemetry.ecosystemtelemetry.enabled", false);
 #endif
 
 // Ping Centre Telemetry settings.
 pref("browser.ping-centre.telemetry", true);
 pref("browser.ping-centre.log", false);
-pref("browser.ping-centre.staging.endpoint", "https://onyx_tiles.stage.mozaws.net/v3/links/ping-centre");
-pref("browser.ping-centre.production.endpoint", "https://tiles.services.mozilla.com/v3/links/ping-centre");
 
 // Enable GMP support in the addon manager.
 pref("media.gmp-provider.enabled", true);
 
 // Enable blocking access to storage from tracking resources by default.
 pref("network.cookie.cookieBehavior", 4 /* BEHAVIOR_REJECT_TRACKER */);
 #ifdef EARLY_BETA_OR_EARLIER
   // Enable fingerprinting blocking by default only in nightly and early beta.
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -497,22 +497,16 @@ let LEGACY_ACTORS = {
   win.stop();
 
   let { TelemetryTimestamps } = ChromeUtils.import(
     "resource://gre/modules/TelemetryTimestamps.jsm"
   );
   TelemetryTimestamps.add("blankWindowShown");
 })();
 
-XPCOMUtils.defineLazyServiceGetters(this, {
-  aboutNewTabService: [
-    "@mozilla.org/browser/aboutnewtab-service;1",
-    "nsIAboutNewTabService",
-  ],
-});
 XPCOMUtils.defineLazyGetter(
   this,
   "WeaveService",
   () => Cc["@mozilla.org/weave/service;1"].getService().wrappedJSObject
 );
 
 // lazy module getters
 
@@ -543,17 +537,16 @@ XPCOMUtils.defineLazyModuleGetters(this,
   NewTabUtils: "resource://gre/modules/NewTabUtils.jsm",
   Normandy: "resource://normandy/Normandy.jsm",
   ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
   OS: "resource://gre/modules/osfile.jsm",
   PageActions: "resource:///modules/PageActions.jsm",
   PageThumbs: "resource://gre/modules/PageThumbs.jsm",
   PdfJs: "resource://pdf.js/PdfJs.jsm",
   PermissionUI: "resource:///modules/PermissionUI.jsm",
-  PingCentre: "resource:///modules/PingCentre.jsm",
   PlacesBackups: "resource://gre/modules/PlacesBackups.jsm",
   PlacesUtils: "resource://gre/modules/PlacesUtils.jsm",
   PluralForm: "resource://gre/modules/PluralForm.jsm",
   PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
   ProcessHangMonitor: "resource:///modules/ProcessHangMonitor.jsm",
   PublicSuffixList: "resource://gre/modules/netwerk-dns/PublicSuffixList.jsm",
   RemoteSettings: "resource://services-settings/remote-settings.js",
   RemoteSecuritySettings:
@@ -820,75 +813,16 @@ BrowserGlue.prototype = {
       delay += win.gBrowser.tabs.length;
     }
     delay = delay <= MAX_DELAY ? delay : MAX_DELAY;
 
     const { Weave } = ChromeUtils.import("resource://services-sync/main.js");
     Weave.Service.scheduler.delayedAutoConnect(delay);
   },
 
-  /**
-   * Lazily initialize PingCentre
-   */
-  get pingCentre() {
-    const MAIN_TOPIC_ID = "main";
-    Object.defineProperty(this, "pingCentre", {
-      value: new PingCentre({ topic: MAIN_TOPIC_ID }),
-    });
-    return this.pingCentre;
-  },
-
-  _sendMainPingCentrePing() {
-    let newTabSetting;
-    let homePageSetting;
-
-    // Check whether or not about:home and about:newtab have been overridden at this point.
-    // Different settings are encoded as follows:
-    //   * Value 0: default
-    //   * Value 1: about:blank
-    //   * Value 2: web extension
-    //   * Value 3: other custom URL(s)
-    // Settings for about:newtab and about:home are combined in a bitwise manner.
-
-    // Note that a user could use about:blank and web extension at the same time
-    // to overwrite the about:newtab, but the web extension takes priority, so the
-    // ordering matters in the following check.
-    if (
-      Services.prefs.getBoolPref("browser.newtabpage.enabled") &&
-      !aboutNewTabService.overridden
-    ) {
-      newTabSetting = 0;
-    } else if (aboutNewTabService.newTabURL.startsWith("moz-extension://")) {
-      newTabSetting = 2;
-    } else if (!Services.prefs.getBoolPref("browser.newtabpage.enabled")) {
-      newTabSetting = 1;
-    } else {
-      newTabSetting = 3;
-    }
-
-    const homePageURL = HomePage.get();
-    if (homePageURL === "about:home") {
-      homePageSetting = 0;
-    } else if (homePageURL === "about:blank") {
-      homePageSetting = 1;
-    } else if (homePageURL.startsWith("moz-extension://")) {
-      homePageSetting = 2;
-    } else {
-      homePageSetting = 3;
-    }
-
-    const payload = {
-      event: "AS_ENABLED",
-      value: newTabSetting | (homePageSetting << 2),
-    };
-    const ACTIVITY_STREAM_ID = "activity-stream";
-    const options = { filter: ACTIVITY_STREAM_ID };
-    this.pingCentre.sendPing(payload, options);
-  },
-
   // nsIObserver implementation
   observe: async function BG_observe(subject, topic, data) {
     switch (topic) {
       case "notifications-open-settings":
         this._openPreferences("privacy-permissions");
         break;
       case "final-ui-startup":
         this._beforeUIStartup();
@@ -1075,17 +1009,16 @@ BrowserGlue.prototype = {
         // leaving initialization to the extension.
         // parent only: configure default prefs, set up pref observers, register
         // pdf content handler, and initializes parent side message manager
         // shim for privileged api access.
         PdfJs.init();
         break;
       case "shield-init-complete":
         this._shieldInitComplete = true;
-        this._sendMainPingCentrePing();
         break;
     }
   },
 
   // initialization (called on application startup)
   _init: function BG__init() {
     let os = Services.obs;
     os.addObserver(this, "notifications-open-settings");
@@ -1959,21 +1892,16 @@ BrowserGlue.prototype = {
     for (let mod of Object.values(initializedModules)) {
       if (mod.uninit) {
         mod.uninit();
       }
     }
 
     BrowserUsageTelemetry.uninit();
     SearchTelemetry.uninit();
-    // Only uninit PingCentre if the getter has initialized it
-    if (Object.prototype.hasOwnProperty.call(this, "pingCentre")) {
-      this.pingCentre.uninit();
-    }
-
     PageThumbs.uninit();
     NewTabUtils.uninit();
     AboutPrivateBrowsingHandler.uninit();
     AboutProtectionsHandler.uninit();
 
     Normandy.uninit();
     RFPHelper.uninit();
   },
deleted file mode 100644
--- a/browser/components/tests/unit/test_browserGlue_pingcentre.js
+++ /dev/null
@@ -1,28 +0,0 @@
-const { PingCentre } = ChromeUtils.import("resource:///modules/PingCentre.jsm");
-
-const TOPIC_SHIELD_INIT_COMPLETE = "shield-init-complete";
-const SEND_PING_MOCK = sinon.stub(PingCentre.prototype, "sendPing");
-
-let gBrowserGlue = Cc["@mozilla.org/browser/browserglue;1"].getService(
-  Ci.nsIObserver
-);
-
-add_task(async function() {
-  // Simulate ping centre sendPing() trigger.
-  gBrowserGlue.observe(null, TOPIC_SHIELD_INIT_COMPLETE, null);
-
-  const SEND_PING_CALL_ARGS = {
-    event: "AS_ENABLED",
-    value: 0,
-  };
-  const SEND_PING_FILTER = { filter: "activity-stream" };
-
-  Assert.ok(
-    SEND_PING_MOCK.called,
-    "gBrowserGlue.pingCentre.sendPing() is called"
-  );
-  Assert.ok(
-    SEND_PING_MOCK.calledWithExactly(SEND_PING_CALL_ARGS, SEND_PING_FILTER),
-    "sendPing() is called with the correct param"
-  );
-});
--- a/browser/components/tests/unit/xpcshell.ini
+++ b/browser/components/tests/unit/xpcshell.ini
@@ -4,9 +4,8 @@ firefox-appdir = browser
 skip-if = toolkit == 'android'
 support-files =
   distribution.ini
   data/engine-de-DE.xml
 
 [test_distribution.js]
 [test_distribution_cachedexistence.js]
 [test_browserGlue_migration_social_cleanup.js]
-[test_browserGlue_pingcentre.js]
--- a/testing/profiles/perf/user.js
+++ b/testing/profiles/perf/user.js
@@ -11,18 +11,16 @@ user_pref("browser.contentHandlers.types
 user_pref("browser.contentHandlers.types.1.uri", "http://127.0.0.1/rss?url=%s");
 user_pref("browser.contentHandlers.types.2.uri", "http://127.0.0.1/rss?url=%s");
 user_pref("browser.contentHandlers.types.3.uri", "http://127.0.0.1/rss?url=%s");
 user_pref("browser.contentHandlers.types.4.uri", "http://127.0.0.1/rss?url=%s");
 user_pref("browser.contentHandlers.types.5.uri", "http://127.0.0.1/rss?url=%s");
 user_pref("browser.link.open_newwindow", 2);
 user_pref("browser.newtabpage.activity-stream.default.sites", "");
 user_pref("browser.newtabpage.activity-stream.telemetry", false);
-user_pref("browser.ping-centre.production.endpoint", "https://127.0.0.1/pingcentre/dummy/");
-user_pref("browser.ping-centre.staging.endpoint", "https://127.0.0.1/pingcentre/dummy/");
 user_pref("browser.reader.detectedFirstArticle", true);
 user_pref("browser.safebrowsing.blockedURIs.enabled", false);
 user_pref("browser.safebrowsing.downloads.enabled", false);
 user_pref("browser.safebrowsing.downloads.remote.url", "http://127.0.0.1/safebrowsing-dummy/downloads");
 user_pref("browser.safebrowsing.malware.enabled", false);
 user_pref("browser.safebrowsing.passwords.enabled", false);
 user_pref("browser.safebrowsing.phishing.enabled", false);
 user_pref("browser.safebrowsing.provider.google.gethashURL", "http://127.0.0.1/safebrowsing-dummy/gethash");
--- a/testing/profiles/reftest/user.js
+++ b/testing/profiles/reftest/user.js
@@ -1,17 +1,14 @@
 // Preference file for the reftest harness.
 /* globals user_pref */
 // Make sure Shield doesn't hit the network.
 user_pref("app.normandy.api_url", "https://localhost/selfsupport-dummy/");
 user_pref("app.update.staging.enabled", false);
 user_pref("app.update.url.android", "");
-user_pref("browser.ping-centre.production.endpoint", "https://localhost");
-// Make sure Ping Centre doesn't hit the network.
-user_pref("browser.ping-centre.staging.endpoint", "https://localhost");
 user_pref("browser.safebrowsing.blockedURIs.enabled", false);
 user_pref("browser.safebrowsing.downloads.enabled", false);
 user_pref("browser.safebrowsing.downloads.remote.url", "http://127.0.0.1/safebrowsing-dummy/gethash");
 user_pref("browser.safebrowsing.malware.enabled", false);
 user_pref("browser.safebrowsing.passwords.enabled", false);
 // Likewise for safebrowsing.
 user_pref("browser.safebrowsing.phishing.enabled", false);
 user_pref("browser.safebrowsing.provider.google.gethashURL", "http://127.0.0.1/safebrowsing-dummyg/gethash");
--- a/testing/profiles/unittest-required/user.js
+++ b/testing/profiles/unittest-required/user.js
@@ -28,19 +28,16 @@ user_pref("browser.contentHandlers.types
 user_pref("browser.contentHandlers.types.3.uri", "http://test1.example.org/rss?url=%s");
 user_pref("browser.contentHandlers.types.4.uri", "http://test1.example.org/rss?url=%s");
 user_pref("browser.contentHandlers.types.5.uri", "http://test1.example.org/rss?url=%s");
 // Indicate that the download panel has been shown once so that whichever
 // download test runs first doesn't show the popup inconsistently.
 user_pref("browser.download.panel.shown", true);
 user_pref("browser.newtabpage.activity-stream.default.sites", "");
 user_pref("browser.newtabpage.activity-stream.telemetry", false);
-// Make sure PingCentre doesn't hit the network.
-user_pref("browser.ping-centre.production.endpoint", "");
-user_pref("browser.ping-centre.staging.endpoint", "");
 // Point the url-classifier to the local testing server for fast failures
 user_pref("browser.safebrowsing.downloads.remote.url", "http://{server}/safebrowsing-dummy/update");
 user_pref("browser.safebrowsing.provider.google.gethashURL", "http://{server}/safebrowsing-dummy/gethash");
 user_pref("browser.safebrowsing.provider.google.updateURL", "http://{server}/safebrowsing-dummy/update");
 user_pref("browser.safebrowsing.provider.google4.gethashURL", "http://{server}/safebrowsing4-dummy/gethash");
 user_pref("browser.safebrowsing.provider.google4.updateURL", "http://{server}/safebrowsing4-dummy/update");
 user_pref("browser.safebrowsing.provider.mozilla.gethashURL", "http://{server}/safebrowsing-dummy/gethash");
 user_pref("browser.safebrowsing.provider.mozilla.updateURL", "http://{server}/safebrowsing-dummy/update");