Backed out 3 changesets (bug 1417473) for failing browser_HybridContentTelemetry.js. r=backout on a CLOSED TREE
authorCsoregi Natalia <ncsoregi@mozilla.com>
Fri, 05 Jan 2018 13:45:25 +0200
changeset 449722 e89a072ca221a8f44a38a65ebc6298191f5aeede
parent 449721 4186b4a812fc4ef0cc126be45dcd8b3530465f80
child 449723 b1b7f193fae797aef0aa4a854ac963e245319904
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1417473
milestone59.0a1
backs out27db7bf978be7e6c6a6ba3bd2822904b57134341
a365a5a59ad1a121bf5ba4423efc64d5dce44f40
443747e39abe9c7f7dae06603daa57f5c0706d1b
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
Backed out 3 changesets (bug 1417473) for failing browser_HybridContentTelemetry.js. r=backout on a CLOSED TREE Backed out changeset 27db7bf978be (bug 1417473) Backed out changeset a365a5a59ad1 (bug 1417473) Backed out changeset 443747e39abe (bug 1417473)
browser/app/profile/firefox.js
browser/base/content/browser.js
browser/components/nsBrowserGlue.js
toolkit/components/telemetry/TelemetryUtils.jsm
toolkit/components/telemetry/docs/collection/hybrid-content.rst
toolkit/components/telemetry/docs/collection/index.rst
toolkit/components/telemetry/hybrid-content/HybridContentTelemetry-lib.js
toolkit/components/telemetry/hybrid-content/HybridContentTelemetry.jsm
toolkit/components/telemetry/hybrid-content/content-HybridContentTelemetry.js
toolkit/components/telemetry/hybrid-content/jar.mn
toolkit/components/telemetry/hybrid-content/moz.build
toolkit/components/telemetry/moz.build
toolkit/components/telemetry/tests/browser/browser.ini
toolkit/components/telemetry/tests/browser/browser_HybridContentTelemetry.js
toolkit/components/telemetry/tests/browser/hybrid_content.html
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1518,18 +1518,16 @@ pref("toolkit.telemetry.shutdownPingSend
 // Enables sending a duplicate of the first shutdown ping from the first session.
 pref("toolkit.telemetry.firstShutdownPing.enabled", true);
 // Enables sending the 'new-profile' ping on new profiles.
 pref("toolkit.telemetry.newProfilePing.enabled", true);
 // Enables sending 'update' pings on Firefox updates.
 pref("toolkit.telemetry.updatePing.enabled", true);
 // Enables sending 'bhr' pings when the browser hangs.
 pref("toolkit.telemetry.bhrPing.enabled", true);
-// Enables using Hybrid Content Telemetry from Mozilla privileged pages.
-pref("toolkit.telemetry.hybridContent.enabled", true);
 
 // Telemetry experiments settings.
 pref("experiments.enabled", true);
 pref("experiments.manifest.fetchIntervalSeconds", 86400);
 pref("experiments.manifest.uri", "https://telemetry-experiment.cdn.mozilla.net/manifest/v1/firefox/%VERSION%/%CHANNEL%");
 // Whether experiments are supported by the current application profile.
 pref("experiments.supported", true);
 
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1258,17 +1258,16 @@ var gBrowserInit = {
     TrackingProtection.init();
     CaptivePortalWatcher.init();
     ZoomUI.init(window);
 
     let mm = window.getGroupMessageManager("browsers");
     mm.loadFrameScript("chrome://browser/content/tab-content.js", true);
     mm.loadFrameScript("chrome://browser/content/content.js", true);
     mm.loadFrameScript("chrome://browser/content/content-UITour.js", true);
-    mm.loadFrameScript("chrome://global/content/content-HybridContentTelemetry.js", true);
     mm.loadFrameScript("chrome://global/content/manifestMessages.js", true);
 
     window.messageManager.addMessageListener("Browser:LoadURI", RedirectLoad);
 
     if (!gMultiProcessBrowser) {
       // There is a Content:Click message manually sent from content.
       Services.els.addSystemEventListener(gBrowser, "click", contentAreaClick, true);
     }
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -34,17 +34,16 @@ XPCOMUtils.defineLazyModuleGetters(this,
   ContextualIdentityService: "resource://gre/modules/ContextualIdentityService.jsm",
   DateTimePickerHelper: "resource://gre/modules/DateTimePickerHelper.jsm",
   DirectoryLinksProvider: "resource:///modules/DirectoryLinksProvider.jsm",
   ExtensionsUI: "resource:///modules/ExtensionsUI.jsm",
   Feeds: "resource:///modules/Feeds.jsm",
   FileUtils: "resource://gre/modules/FileUtils.jsm",
   FileSource: "resource://gre/modules/L10nRegistry.jsm",
   FormValidationHandler: "resource:///modules/FormValidationHandler.jsm",
-  HybridContentTelemetry: "resource://gre/modules/HybridContentTelemetry.jsm",
   Integration: "resource://gre/modules/Integration.jsm",
   L10nRegistry: "resource://gre/modules/L10nRegistry.jsm",
   LanguagePrompt: "resource://gre/modules/LanguagePrompt.jsm",
   LightweightThemeManager: "resource://gre/modules/LightweightThemeManager.jsm",
   LoginHelper: "resource://gre/modules/LoginHelper.jsm",
   LoginManagerParent: "resource://gre/modules/LoginManagerParent.jsm",
   NetUtil: "resource://gre/modules/NetUtil.jsm",
   NewTabUtils: "resource://gre/modules/NewTabUtils.jsm",
@@ -3068,15 +3067,8 @@ this.NSGetFactory = XPCOMUtils.generateN
 
 // Listen for UITour messages.
 // Do it here instead of the UITour module itself so that the UITour module is lazy loaded
 // when the first message is received.
 var globalMM = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);
 globalMM.addMessageListener("UITour:onPageEvent", function(aMessage) {
   UITour.onPageEvent(aMessage, aMessage.data);
 });
-
-// Listen for HybridContentTelemetry messages.
-// Do it here instead of HybridContentTelemetry.init() so that
-// the module can be lazily loaded on the first message.
-globalMM.addMessageListener("HybridContentTelemetry:onTelemetryMessage", aMessage => {
-  HybridContentTelemetry.onTelemetryMessage(aMessage, aMessage.data);
-});
--- a/toolkit/components/telemetry/TelemetryUtils.jsm
+++ b/toolkit/components/telemetry/TelemetryUtils.jsm
@@ -27,17 +27,16 @@ const IS_CONTENT_PROCESS = (function() {
 this.TelemetryUtils = {
   Preferences: Object.freeze({
     // General Preferences
     ArchiveEnabled: "toolkit.telemetry.archive.enabled",
     CachedClientId: "toolkit.telemetry.cachedClientID",
     FirstRun: "toolkit.telemetry.reportingpolicy.firstRun",
     FirstShutdownPingEnabled: "toolkit.telemetry.firstShutdownPing.enabled",
     HealthPingEnabled: "toolkit.telemetry.healthping.enabled",
-    HybridContentEnabled: "toolkit.telemetry.hybridContent.enabled",
     OverrideOfficialCheck: "toolkit.telemetry.send.overrideOfficialCheck",
     OverridePreRelease: "toolkit.telemetry.testing.overridePreRelease",
     Server: "toolkit.telemetry.server",
     ShutdownPingSender: "toolkit.telemetry.shutdownPingSender.enabled",
     ShutdownPingSenderFirstSession: "toolkit.telemetry.shutdownPingSender.enabledFirstSession",
     TelemetryEnabled: "toolkit.telemetry.enabled",
     Unified: "toolkit.telemetry.unified",
     UpdatePing: "toolkit.telemetry.updatePing.enabled",
deleted file mode 100644
--- a/toolkit/components/telemetry/docs/collection/hybrid-content.rst
+++ /dev/null
@@ -1,274 +0,0 @@
-========================
-Hybrid Content Telemetry
-========================
-
-Hybrid content is web content that is loaded as part of Firefox, appears as part of
-Firefox to the user and is primarily intended to be used in Firefox. This can be
-either a page that ships with Firefox or that can be loaded dynamically from our hosted
-services. Hybrid content telemetry allows Mozilla pages to check whether data
-collection is enabled and to submit Telemetry data.
-
-.. important::
-
-    Every new data collection in Firefox (including hybrid content) needs a `data collection review <https://wiki.mozilla.org/Firefox/Data_Collection#Requesting_Approval>`_ from a data collection peer. Just set the feedback? flag for one of the data peers. They try to reply within a business day.
-
-The recorded data will be sent to Mozilla servers by Firefox, if the collection is enabled, with the :doc:`main-ping <../data/main-ping>`.
-
-Adding content data collection
-==============================
-Telemetry can be sent from web content by:
-
-1. granting the web content's host privileges in the Firefox codebase;
-2. including the ``HybridContentTelemetry-lib.js`` file in the page;
-3. registering the probes after the library is loaded;
-4. using the API to send Telemetry.
-
-Granting the privileges
------------------------
-For security/privacy reasons `Mozilla.ContentTelemetry` will only work on a list of allowed secure origins. The list of allowed origins can be found in `browser/app/permissions <https://dxr.mozilla.org/mozilla-central/source/browser/app/permissions>`_ . A host needs to be given the ``hc_telemetry`` permission in order to be whitelisted.
-
-Example:
-
-.. code-block:: csv
-
-  origin  hc_telemetry  1 https://discovery.addons.mozilla.org
-
-Adding an entry to the ``permissions`` file requires riding the trains. If "go-faster" content requires
-granting permissions to a Mozilla page, it can do so by using the `permission manager <https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIPermissionManager>`_
-
-.. code-block:: js
-
-  function addonInit() {
-    // The following code must be called before attempting to load a page that uses
-    // hybrid content telemetry on https://example.mozilla.org.
-    let hostURI = Services.io.newURI("https://example.mozilla.org");
-    Services.perms.add(hostURI, "hc_telemetry", Services.perms.ALLOW_ACTION);
-  }
-
-  function addonCleanup() {
-    // The permission must be removed if no longer needed (e.g. the add-on is shut down).
-    let hostURI = Services.io.newURI("https://example.mozilla.org");
-    Services.perms.remove(hostURI, "hc_telemetry");
-  }
-
-.. important::
-
-    Granted permissions do not disappear when a "go-faster" add-on is uninstalled but are cleared when the browser is closed. If permissions need to be cleaned without closing the browser, it must be done manually. Moreover, permissions are keyed by origin: ``http://mozilla.com`` and ``https://mozilla.com`` are different things.
-
-Including the library
----------------------
-To use hybrid content telemetry the relative content JS library needs to be included in the page. We don't have a CDN hosted version that can be readily included in the page. For this reason, each consumer will need to fetch the latest version of the library from `here <https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/telemetry/hybrid-content/HybridContentTelemetry-lib.js>`_ and add it to the page repository. Then this file can be deployed along with the page.
-
-Example:
-
-.. code-block:: html
-
-  <!DOCTYPE html>
-  <html>
-    <head>
-      <!-- Other head stuff -->
-      <script type="application/javascript" src="HybridContentTelemetry-lib.js"></script>
-    </head>
-    <body> <!-- Other body stuff --> </body>
-  </html>
-
-Registering the probes
-----------------------
-Probe registration can happen at any time after the library is loaded in the page, but registering early enough ensures that the definition is available once a recording attempt is made.
-
-Example:
-
-.. code-block:: html
-
-  <!DOCTYPE html>
-  <html>
-    <head>
-      <!-- Other head stuff -->
-      <script type="application/javascript">
-        window.onload = function() {
-          if (!Mozilla || !Mozilla.ContentTelemetry) {
-            // .. uh-oh, was library loaded? Report the error.
-            return;
-          }
-          // Register the probe.
-          Mozilla.ContentTelemetry.registerEvents("page.interaction", {
-            "click": {
-              methods: ["click"],
-              objects: ["red_button", "blue_button"],
-            }
-          });
-        };
-      </script>
-    </head>
-    <body> <!-- Other body stuff --> </body>
-  </html>
-
-Recording the data
-------------------
-Data recording can happen at any time after a probe has been registered. The data will be recorded and sent by Firefox if permitted by the Telemetry :doc:`preferences <../internals/preferences>`.
-
-Example:
-
-.. code-block:: html
-
-  <!DOCTYPE html>
-  <html>
-    <head>
-      <!-- Other head stuff -->
-      <script type="application/javascript">
-        function triggerEvent() {
-          if (!Mozilla || !Mozilla.ContentTelemetry) {
-            // .. uh-oh, was library loaded? Report the error.
-            return;
-          }
-          Mozilla.ContentTelemetry.recordEvent("page.interaction", "click", "red_button");
-        };
-      </script>
-    </head>
-    <body>
-      <!-- Other body stuff -->
-      <div id="content">
-        <button id='event-recording' onclick="triggerEvent();">
-          Trigger Recording
-        </button>
-      </div>
-    </body>
-  </html>
-
-Checking if upload is enabled
------------------------------
-Mozilla pages can check if data upload is enabled, as reported by Telemetry :doc:`preferences <../internals/preferences>`. This is useful for pages which are not using Telemetry to collect data, but
-need to comply to our data policy for the collection.
-
-Example:
-
-.. code-block:: html
-
-  <!DOCTYPE html>
-  <html>
-    <head>
-      <!-- Other head stuff -->
-      <script type="application/javascript">
-        function recordData() {
-          if (!Mozilla || !Mozilla.ContentTelemetry) {
-            // .. uh-oh, was library loaded? Report the error.
-            return;
-          }
-
-          if (!Mozilla.ContentTelemetry.canUpload()) {
-            // User has opted-out of Telemetry. No collection must take place.
-            return;
-          }
-
-          // ... perform the collection without Telemetry below this point.
-        };
-      </script>
-    </head>
-    <body>
-      <!-- Other body stuff -->
-      <div id="content">
-        <button id='event-recording' onclick="recordData();">
-          Trigger Recording
-        </button>
-      </div>
-    </body>
-  </html>
-
-The API
-=======
-The hybrid content API is available to the web content through the inclusion of the `HybridContentTelemetry-lib.js <https://dxr.mozilla.org/mozilla-central/source/toolkit/components/telemetry/hybrid-content/HybridContentTelemetry-lib.js>`_ library.
-
-The initial implementation of the API allows the registration and the recording of events.
-
-JS API
-------
-Authorized content can use the following functions:
-
-.. code-block:: js
-
-  Mozilla.ContentTelemetry.canUpload();
-  Mozilla.ContentTelemetry.registerEvents(category, eventData);
-  Mozilla.ContentTelemetry.recordEvent(category, method, object, value, extra);
-
-These functions will not throw. If an unsupported operation is performed (e.g. recording an unknown event) an error will be logged to the browser console.
-
-.. note::
-
-    Data collected using this API will always respect the user Telemetry preferences: if a user has chosen to not send Telemetry data to Mozilla servers, Telemetry from hybrid content pages will not be sent either.
-    Like other Telemetry data, it will still be recorded locally and available through ``about:telemetry``.
-
-``Mozilla.ContentTelemetry.canUpload()``
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. code-block:: js
-
-  Mozilla.ContentTelemetry.canUpload();
-
-This function returns true if the browser is allowed to send collected data to Mozilla servers (i.e. ``datareporting.healthreport.uploadEnabled`` is ``true``), false otherwise. See :doc:`preferences <../internals/preferences>`.
-
-.. note::
-
-    The page should use this function to check if it is allowed to collect data. This is only needed in case the Telemetry system is not be being used for collection. If Telemetry is used, then this is taken care of internally by the Telemetry API. The page should not cache the returned value: users can opt in or out from the Data Collection at any time and so the returned value may change.
-
-Example:
-
-.. code-block:: js
-
-  if (Mozilla.ContentTelemetry.canUpload()) {
-    // ... perform the data collection here using another measurement system.
-  }
-
-``Mozilla.ContentTelemetry.registerEvents()``
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. code-block:: js
-
-  Mozilla.ContentTelemetry.registerEvents(category, eventData);
-
-Register new dynamic events from the content. This accepts the same parameters and is subject to the same limitation as ``Services.telemetry.registerEvents()``. See the `events` documentation for the definitive reference.
-
-.. note::
-
-    Make sure to call this before recording events, as soon as the library is loaded (e.g. `window load event <https://developer.mozilla.org/en-US/docs/Web/Events/load>`_). This will make sure that the definition will be ready when recording.
-
-The data recorded into events registered with this function will end up in the ``dynamic`` process section of the main ping.
-
-Example:
-
-.. code-block:: js
-
-  Mozilla.ContentTelemetry.registerEvents("page.interaction", {
-    "click": {
-      methods: ["click"],
-      objects: ["red_button", "blue_button"],
-    }
-  });
-  // Now events can be recorded.
-  Mozilla.ContentTelemetry.recordEvent("page.interaction", "click", "red_button");
-
-``Mozilla.ContentTelemetry.recordEvent()``
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. code-block:: js
-
-  Mozilla.ContentTelemetry.recordEvent(category, method, object, value, extra);
-
-Record a registered event. This accepts the same parameters and is subject to the same limitation as ``Services.telemetry.recordEvent()``. See the `events` documentation for the definitive reference.
-
-Example:
-
-.. code-block:: js
-
-  Mozilla.ContentTelemetry.recordEvent("ui", "click", "reload-btn");
-  // event: [543345, "ui", "click", "reload-btn"]
-  Mozilla.ContentTelemetry.recordEvent("ui", "search", "search-bar", "google");
-  // event: [89438, "ui", "search", "search-bar", "google"]
-  Mozilla.ContentTelemetry.recordEvent("ui", "completion", "search-bar", "yahoo",
-                                       {"querylen": "7", "results": "23"});
-  // event: [982134, "ui", "completion", "search-bar", "yahoo",
-  //           {"qerylen": "7", "results": "23"}]
-
-Version History
-===============
-
-- Firefox 59: Initial hybrid content telemetry support (`bug 1417473 <https://bugzilla.mozilla.org/show_bug.cgi?id=1417473>`_).
--- a/toolkit/components/telemetry/docs/collection/index.rst
+++ b/toolkit/components/telemetry/docs/collection/index.rst
@@ -18,30 +18,28 @@ The current data collection possibilitie
 * :doc:`events` can record richer data on individual occurrences of specific actions
 * ``TelemetryLog`` allows collecting ordered event entries up to a limit of 1000 entries (note: this does not have supporting analysis tools)
 * :doc:`measuring elapsed time <measuring-time>`
 * :doc:`custom pings <custom-pings>`
 * :doc:`stack capture <stack-capture>` allow recording application call stacks
 * :doc:`Use counters <use-counters>` measure the usage of web platform features
 * :doc:`Experiment annotations <experiments>`
 * :doc:`Remote content uptake <uptake>`
-* :doc:`hybrid content telemety <hybrid-content>` allows recording telemetry from semi-privileged hosted content
 
 .. toctree::
    :maxdepth: 2
    :titlesonly:
    :hidden:
    :glob:
 
    scalars
    histograms
    events
    measuring-time
    custom-pings
    stack-capture
    experiments
    uptake
-   hybrid-content
    *
 
 Browser Usage Telemetry
 ~~~~~~~~~~~~~~~~~~~~~~~
 For more information, see :ref:`browserusagetelemetry`.
deleted file mode 100644
--- a/toolkit/components/telemetry/hybrid-content/HybridContentTelemetry-lib.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/* 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/. */
-
-if (typeof Mozilla == "undefined") {
-  var Mozilla = {};
-}
-
-(function($) {
-  "use strict";
-
-  var _canUpload = false;
-
-  if (typeof Mozilla.ContentTelemetry == "undefined") {
-    /**
-     * Library that exposes an event-based Web API for communicating with the
-     * desktop browser chrome. It can be used for recording Telemetry data from
-     * authorized web content pages.
-     *
-     * <p>For security/privacy reasons `Mozilla.ContentTelemetry` will only work
-     * on a list of allowed secure origins. The list of allowed origins can be
-     * found in
-     * {@link https://dxr.mozilla.org/mozilla-central/source/browser/app/permissions|
-     * browser/app/permissions}.</p>
-     *
-     * @since 59
-     * @namespace
-     */
-    Mozilla.ContentTelemetry = {};
-  }
-
-  function _sendMessageToChrome(name, data) {
-    var event = new CustomEvent("mozTelemetry", {
-      bubbles: true,
-      detail: {
-        name,
-        data: data || {}
-      }
-    });
-
-    document.dispatchEvent(event);
-  }
-
-  /**
-   * This internal function is used to register the policy handler. This is
-   * needed by pages that do not want to use Telemetry but still need to
-   * respect user Privacy choices.
-   */
-  function _registerInternalPolicyHandler() {
-    // Register the handler that will update the policy boolean.
-    function policyChangeHandler(updatedPref) {
-      if (!("detail" in updatedPref) ||
-          !("canUpload" in updatedPref.detail) ||
-          typeof updatedPref.detail.canUpload != "boolean") {
-        return;
-      }
-      _canUpload = updatedPref.detail.canUpload;
-    }
-    document.addEventListener("mozTelemetryPolicyChange", policyChangeHandler);
-
-    // Make sure the chrome is initialized.
-    _sendMessageToChrome("init");
-  }
-
-  Mozilla.ContentTelemetry.canUpload = function() {
-    return _canUpload;
-  };
-
-  Mozilla.ContentTelemetry.registerEvents = function(category, eventData) {
-    _sendMessageToChrome("registerEvents", { category, eventData });
-  };
-
-  Mozilla.ContentTelemetry.recordEvent = function(category, method, object, value, extra) {
-    _sendMessageToChrome("recordEvent", { category, method, object, value, extra });
-  };
-
-  // Register the policy handler so that |canUpload| is always up to date.
-  _registerInternalPolicyHandler();
-})();
-
-// Make this library Require-able.
-/* eslint-env commonjs */
-if (typeof module !== "undefined" && module.exports) {
-  module.exports = Mozilla.ContentTelemetry;
-}
deleted file mode 100644
--- a/toolkit/components/telemetry/hybrid-content/HybridContentTelemetry.jsm
+++ /dev/null
@@ -1,124 +0,0 @@
-/* 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";
-
-this.EXPORTED_SYMBOLS = ["HybridContentTelemetry"];
-
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import("resource://gre/modules/Log.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/TelemetryUtils.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-let HybridContentTelemetry = {
-  _logger: null,
-  _observerInstalled: false,
-
-  get _log() {
-    if (!this._logger) {
-      this._logger =
-        Log.repository.getLoggerWithMessagePrefix("Toolkit.Telemetry",
-                                                  "HybridContentTelemetry::");
-    }
-
-    return this._logger;
-  },
-
-  /**
-   * Lazily initialized observer for the Telemetry upload preference. This is
-   * only ever executed if a page uses hybrid content telemetry and has enough
-   * privileges to run it.
-   */
-  _lazyObserverInit() {
-    if (this._observerInstalled) {
-      // We only want to install the observers once, if needed.
-      return;
-    }
-    this._log.trace("_lazyObserverInit - installing the pref observers.");
-    XPCOMUtils.defineLazyPreferenceGetter(this, "_uploadEnabled",
-                                          TelemetryUtils.Preferences.FhrUploadEnabled,
-                                          false, /* aDefaultValue */
-                                          () => this._broadcastPolicyUpdate());
-    this._observerInstalled = true;
-  },
-
-  /**
-   * This is the handler for the async "HybridContentTelemetry:onTelemetryMessage"
-   * message. This function is getting called by the listener in nsBrowserGlue.js.
-   */
-  onTelemetryMessage(aMessage, aData) {
-    if (!this._hybridContentEnabled) {
-      this._log.trace("onTelemetryMessage - hybrid content telemetry is disabled.");
-      return;
-    }
-
-    this._log.trace("onTelemetryMessage - Message received, dispatching API call.");
-    if (!aData ||
-        !("data" in aData) ||
-        !("name" in aData) ||
-        typeof aData.name != "string" ||
-        typeof aData.data != "object") {
-      this._log.error("onTelemetryMessage - received a malformed message.");
-      return;
-    }
-    this._dispatchAPICall(aData.name, aData.data, aMessage);
-  },
-
-  /**
-   * Broadcast the upload policy state to the pages using hybrid
-   * content telemetry.
-   */
-  _broadcastPolicyUpdate() {
-    this._log.trace(`_broadcastPolicyUpdate - New value is ${this._uploadEnabled}.`);
-    Services.mm.broadcastAsyncMessage("HybridContentTelemetry:PolicyChanged",
-                                      {canUpload: this._uploadEnabled});
-  },
-
-  /**
-   * Dispatches the calls to the Telemetry service.
-   * @param {String} aEndpoint The name of the api endpoint to call.
-   * @param {Object} aData An object containing the data to pass to the API.
-   * @param {Object} aOriginalMessage The message object coming from the listener.
-   */
-  _dispatchAPICall(aEndpoint, aData, aOriginalMessage) {
-    this._log.info(`_dispatchAPICall - processing "${aEndpoint}".`);
-
-    // We don't really care too much about validating the passed parameters.
-    // Telemetry will take care of that for us so there is little gain from
-    // duplicating that logic here. Just make sure we don't throw and report
-    // any error.
-    try {
-      switch (aEndpoint) {
-        case "init":
-            this._lazyObserverInit();
-            this._broadcastPolicyUpdate();
-            break;
-        case "registerEvents":
-            Services.telemetry.registerEvents(aData.category, aData.eventData);
-          break;
-        case "recordEvent":
-            // Don't pass "undefined" for the optional |value| and |extra|:
-            // the Telemetry API expects them to be "null" if something is being
-            // passed.
-            let check = (data, key) => (key in data && typeof data[key] != "undefined");
-            Services.telemetry.recordEvent(aData.category,
-                                           aData.method,
-                                           aData.object,
-                                           check(aData, "value") ? aData.value : null,
-                                           check(aData, "extra") ? aData.extra : null);
-          break;
-        default:
-          this._log.error(`_dispatchAPICall - unknown "${aEndpoint}"" API call.`);
-      }
-    } catch (e) {
-      this._log.error(`_dispatchAPICall - error executing "${aEndpoint}".`, e);
-    }
-  },
-};
-
-XPCOMUtils.defineLazyPreferenceGetter(HybridContentTelemetry, "_hybridContentEnabled",
-                                      TelemetryUtils.Preferences.HybridContentEnabled,
-                                      false /* aDefaultValue */);
deleted file mode 100644
--- a/toolkit/components/telemetry/hybrid-content/content-HybridContentTelemetry.js
+++ /dev/null
@@ -1,171 +0,0 @@
-/* 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/. */
-
-/* eslint-env mozilla/frame-script */
-
-"use strict";
-
-var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import("resource://gre/modules/Log.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/TelemetryUtils.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-const TelemetryPrefs = TelemetryUtils.Preferences;
-
-// The permission to be granted to pages that want to use HCT.
-const HCT_PERMISSION = "hc_telemetry";
-// The message that chrome uses to communicate back to content, when the
-// upload policy changes.
-const HCT_POLICY_CHANGE_MSG = "HybridContentTelemetry:PolicyChanged";
-
-var HybridContentTelemetryListener = {
-  _logger: null,
-  _hasListener: false,
-
-  get _log() {
-    if (!this._logger) {
-      this._logger =
-        Log.repository.getLoggerWithMessagePrefix("Toolkit.Telemetry",
-                                                  "HybridContentTelemetryListener::");
-    }
-
-    return this._logger;
-  },
-
-  /**
-   * Verifies that the hybrid content telemetry request comes
-   * from a trusted origin.
-   * @oaram {nsIDomEvent} event Optional object containing the data for the event coming from
-   *                      the content. The "detail" section of this event holds the
-   *                      hybrid content specific payload. It looks like:
-   *                      {name: "apiEndpoint", data: { ... endpoint specific data ... }}
-   * @return {Boolean} true if we are on a trusted page, false otherwise.
-   */
-  isTrustedOrigin(aEvent) {
-    // Make sure that events only come from the toplevel frame. We need to check the
-    // event's target as |content| always represents the current top level window in
-    // the frame (or null). This means that a check like |content.top != content| will
-    // always be false. See nsIMessageManager.idl for more info.
-    if (aEvent &&
-        (!("ownerGlobal" in aEvent.target) ||
-          aEvent.target.ownerGlobal != content)) {
-      return false;
-    }
-
-    const principal =
-      aEvent ? aEvent.target.ownerGlobal.document.nodePrincipal : content.document.nodePrincipal;
-    if (principal.isSystemPrincipal) {
-      return true;
-    }
-
-    const allowedSchemes = ["https", "about"];
-    if (!allowedSchemes.includes(principal.URI.scheme)) {
-      return false;
-    }
-
-    // If this is not a system principal, it needs to have the
-    // HCT_PERMISSION to use this API.
-    let permission =
-      Services.perms.testPermissionFromPrincipal(principal, HCT_PERMISSION);
-    if (permission == Services.perms.ALLOW_ACTION) {
-      return true;
-    }
-
-    return false;
-  },
-
-  /**
-   * Handles incoming events from the content library.
-   * This verifies that:
-   *
-   * - the hybrid content telemetry is on;
-   * - the page is trusted and allowed to use it;
-   * - the CustomEvent coming from the "content" has the expected format and
-   *   is for a known API end-point.
-   *
-   * If the page is allowed to use the API and the event validates, the call
-   * is passed on to Telemetry.
-   *
-   * @param {nsIDomEvent} event An object containing the data for the event coming from
-   *                      the content. The "detail" section of this event holds the
-   *                      hybrid content specific payload. It looks like:
-   *                      {name: "apiEndpoint", data: { ... endpoint specific data ... }}
-   */
-  handleEvent(event) {
-    if (!this._hybridContentEnabled) {
-      this._log.trace("handleEvent - hybrid content telemetry is disabled.");
-      return;
-    }
-
-    if (!this.isTrustedOrigin(event)) {
-      this._log.warn("handleEvent - accessing telemetry from an untrusted origin.");
-      return;
-    }
-
-    if (!event ||
-        !("detail" in event) ||
-        !("name" in event.detail) ||
-        !("data" in event.detail) ||
-        typeof event.detail.name != "string" ||
-        typeof event.detail.data != "object") {
-      this._log.error("handleEvent - received a malformed message.");
-      return;
-    }
-
-    // We add the message listener here to guarantee it only gets added
-    // for trusted origins.
-    // Note that the name of the message must match the name of the one
-    // in HybridContentTelemetry.jsm.
-    if (!this._hasListener) {
-      addMessageListener(HCT_POLICY_CHANGE_MSG, this);
-      this._hasListener = true;
-    }
-
-    // Note that the name of the async message must match the name of
-    // the message in the related listener in nsBrowserGlue.js.
-    sendAsyncMessage("HybridContentTelemetry:onTelemetryMessage", {
-      name: event.detail.name,
-      data: event.detail.data,
-    });
-  },
-
-  /**
-   * Handles the HCT_POLICY_CHANGE_MSG message coming from chrome and
-   * passes it back to the content.
-   * @param {Object} aMessage The incoming message. See nsIMessageListener docs.
-   */
-  receiveMessage(aMessage) {
-    if (!this.isTrustedOrigin()) {
-      this._log.warn("receiveMessage - accessing telemetry from an untrusted origin.");
-      return;
-    }
-
-    if (aMessage.name != HCT_POLICY_CHANGE_MSG ||
-        !("data" in aMessage) ||
-        !("canUpload" in aMessage.data) ||
-        typeof aMessage.data.canUpload != "boolean") {
-      this._log.warn("receiveMessage - received an unexpected message.");
-      return;
-    }
-
-    // Finally send the message down to the page.
-    content.document.dispatchEvent(
-      new content.document.defaultView.CustomEvent("mozTelemetryPolicyChange", {
-        bubbles: true,
-        detail: {canUpload: aMessage.data.canUpload}
-      })
-    );
-  },
-};
-
-XPCOMUtils.defineLazyPreferenceGetter(HybridContentTelemetryListener, "_hybridContentEnabled",
-                                      TelemetryUtils.Preferences.HybridContentEnabled,
-                                      false /* aDefaultValue */);
-
-// The following function installs the handler for "mozTelemetry"
-// events in the chrome. Please note that the name of the message (i.e.
-// "mozTelemetry") needs to match the one in HybridContentTelemetry-lib.js.
-addEventListener("mozTelemetry", HybridContentTelemetryListener, false, true);
deleted file mode 100644
--- a/toolkit/components/telemetry/hybrid-content/jar.mn
+++ /dev/null
@@ -1,6 +0,0 @@
-# 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/.
-
-toolkit.jar:
-       content/global/content-HybridContentTelemetry.js
deleted file mode 100644
--- a/toolkit/components/telemetry/hybrid-content/moz.build
+++ /dev/null
@@ -1,9 +0,0 @@
-# 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/.
-
-EXTRA_JS_MODULES += [
-    'HybridContentTelemetry.jsm',
-]
-
-JAR_MANIFESTS += ['jar.mn']
--- a/toolkit/components/telemetry/moz.build
+++ b/toolkit/components/telemetry/moz.build
@@ -6,17 +6,16 @@
 
 HAS_MISC_RULE = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 DIRS = [
-    'hybrid-content',
     'pingsender',
 ]
 
 DEFINES['MOZ_APP_VERSION'] = '"%s"' % CONFIG['MOZ_APP_VERSION']
 
 LOCAL_INCLUDES += [
     '/xpcom/build',
     '/xpcom/threads',
--- a/toolkit/components/telemetry/tests/browser/browser.ini
+++ b/toolkit/components/telemetry/tests/browser/browser.ini
@@ -1,12 +1,8 @@
 # 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/.
 
 [browser_TelemetryGC.js]
 [browser_UpdatePingSuccess.js]
 [browser_DynamicScalars.js]
 skip-if = !e10s # e10s specific test for definition broadcasting across processes.
-[browser_HybridContentTelemetry.js]
-support-files =
-  ../../hybrid-content/HybridContentTelemetry-lib.js
-  hybrid_content.html
deleted file mode 100644
--- a/toolkit/components/telemetry/tests/browser/browser_HybridContentTelemetry.js
+++ /dev/null
@@ -1,362 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/
-*/
-
-"use strict";
-
-const { ContentTaskUtils } = Cu.import("resource://testing-common/ContentTaskUtils.jsm", {});
-const { TelemetryUtils } = Cu.import("resource://gre/modules/TelemetryUtils.jsm", {});
-const { ObjectUtils } = Cu.import("resource://gre/modules/ObjectUtils.jsm", {});
-
-const HC_PERMISSION = "hc_telemetry";
-
-async function waitForProcessesEvents(aProcesses,
-                                      aAdditionalCondition = data => true) {
-  await ContentTaskUtils.waitForCondition(() => {
-    const events =
-      Services.telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN);
-    return aProcesses.every(p => Object.keys(events).includes(p))
-           && aAdditionalCondition(events);
-  });
-}
-
-/**
- * Wait for a specific event to appear in the given process data.
- * @param {String} aProcess the name of the process we expect the event to appear.
- * @param {Array} aEventData the event data to look for.
- * @return {Promise} Resolved when the event is found or rejected if the search
- *         times out.
- */
-async function waitForEvent(aProcess, aEventData) {
-  await waitForProcessesEvents([aProcess], events => {
-    let contentEvents = events.content.map(e => e.slice(1));
-    if (contentEvents.length == 0) {
-      return false;
-    }
-
-    return contentEvents.find(e => ObjectUtils.deepEqual(e, aEventData));
-  });
-}
-
-/**
- * Remove the trailing null/undefined from an event definition.
- * This is useful for comparing the sample events (that might
- * contain null/undefined) to the data from the snapshot (which might
- * filter them).
- */
-function removeTrailingInvalidEntry(aEvent) {
-  while (aEvent[aEvent.length - 1] === undefined ||
-         aEvent[aEvent.length - 1] === null) {
-    aEvent.pop();
-  }
-  return aEvent;
-}
-
-add_task(async function test_setup() {
-  // Make sure the newly spawned content processes will have extended Telemetry and
-  // hybrid content telemetry enabled.
-  await SpecialPowers.pushPrefEnv({
-    set: [
-      [TelemetryUtils.Preferences.OverridePreRelease, true],
-      [TelemetryUtils.Preferences.HybridContentEnabled, true],
-      [TelemetryUtils.Preferences.LogLevel, "Trace"]
-    ]
-  });
-  // And take care of the already initialized one as well.
-  let canRecordExtended = Services.telemetry.canRecordExtended;
-  Services.telemetry.canRecordExtended = true;
-  registerCleanupFunction(() => Services.telemetry.canRecordExtended = canRecordExtended);
-});
-
-add_task(async function test_untrusted_http_origin() {
-  Services.telemetry.clearEvents();
-
-  // Install a custom handler that intercepts hybrid content telemetry messages
-  // and makes the test fail. We don't expect any message from non secure contexts.
-  const messageName = "HybridContentTelemetry:onTelemetryMessage";
-  let makeTestFail = () => ok(false, `Received an unexpected ${messageName}.`);
-  Services.mm.addMessageListener(messageName, makeTestFail);
-
-  // Try to use the API on a non-secure host.
-  const testHost = "http://example.org";
-  let testHttpUri = Services.io.newURI(testHost);
-  Services.perms.add(testHttpUri, HC_PERMISSION, Services.perms.ALLOW_ACTION);
-  let url = getRootDirectory(gTestPath) + "hybrid_content.html";
-  url = url.replace("chrome://mochitests/content", testHost);
-  let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
-
-  // Try to use the API. Also record a content event from outside HCT: we'll
-  // use this event to know when we can stop waiting for the hybrid content data.
-  const TEST_CONTENT_EVENT = ["telemetry.test", "content_only", "object1"];
-  Services.telemetry.setEventRecordingEnabled("telemetry.test", true);
-  await ContentTask.spawn(newTab.linkedBrowser, [TEST_CONTENT_EVENT],
-                          ([testContentEvent]) => {
-    // Call the hybrid content telemetry API.
-    let contentWin = Components.utils.waiveXrays(content);
-    contentWin.testRegisterEvents(testContentEvent[0], JSON.stringify({}));
-    // Record from the usual telemetry API a "canary" event.
-    Services.telemetry.recordEvent(...testContentEvent);
-  });
-
-  await waitForEvent("content", TEST_CONTENT_EVENT);
-
-  // This is needed otherwise the test will fail due to missing test passes.
-  ok(true, "The untrusted HTTP page was not able to use the API.");
-
-  // Finally clean up the listener.
-  await BrowserTestUtils.removeTab(newTab);
-  Services.perms.remove(testHttpUri, HC_PERMISSION);
-  Services.mm.removeMessageListener(messageName, makeTestFail);
-  Services.telemetry.setEventRecordingEnabled("telemetry.test", false);
-});
-
-add_task(async function test_secure_non_whitelisted_origin() {
-  Services.telemetry.clearEvents();
-
-  // Install a custom handler that intercepts hybrid content telemetry messages
-  // and makes the test fail. We don't expect any message from non whitelisted pages.
-  const messageName = "HybridContentTelemetry:onTelemetryMessage";
-  let makeTestFail = () => ok(false, `Received an unexpected ${messageName}.`);
-  Services.mm.addMessageListener(messageName, makeTestFail);
-
-  // Try to use the API on a secure host but don't give the page enough privileges.
-  const testHost = "https://example.org";
-  let url = getRootDirectory(gTestPath) + "hybrid_content.html";
-  url = url.replace("chrome://mochitests/content", testHost);
-  let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
-
-  // Try to use the API. Also record a content event from outside HCT: we'll
-  // use this event to know when we can stop waiting for the hybrid content data.
-  const TEST_CONTENT_EVENT = ["telemetry.test", "content_only", "object1"];
-  Services.telemetry.setEventRecordingEnabled("telemetry.test", true);
-  await ContentTask.spawn(newTab.linkedBrowser, [TEST_CONTENT_EVENT],
-                          ([testContentEvent]) => {
-    // Call the hybrid content telemetry API.
-    let contentWin = Components.utils.waiveXrays(content);
-    contentWin.testRegisterEvents(testContentEvent[0], JSON.stringify({}));
-    // Record from the usual telemetry API a "canary" event.
-    Services.telemetry.recordEvent(...testContentEvent);
-  });
-
-  await waitForEvent("content", TEST_CONTENT_EVENT);
-
-  // This is needed otherwise the test will fail due to missing test passes.
-  ok(true, "The HTTPS page without permission was not able to use the API.");
-
-  // Finally clean up the listener.
-  await BrowserTestUtils.removeTab(newTab);
-  Services.mm.removeMessageListener(messageName, makeTestFail);
-  Services.telemetry.setEventRecordingEnabled("telemetry.test", false);
-});
-
-add_task(async function test_trusted_disabled_hybrid_telemetry() {
-  Services.telemetry.clearEvents();
-
-  // This test requires hybrid content telemetry to be disabled.
-  await SpecialPowers.pushPrefEnv({
-    set: [[TelemetryUtils.Preferences.HybridContentEnabled, false]]
-  });
-
-  // Install a custom handler that intercepts hybrid content telemetry messages
-  // and makes the test fail. We don't expect any message when the API is disabled.
-  const messageName = "HybridContentTelemetry:onTelemetryMessage";
-  let makeTestFail = () => ok(false, `Received an unexpected ${messageName}.`);
-  Services.mm.addMessageListener(messageName, makeTestFail);
-
-  // Try to use the API on a secure host.
-  const testHost = "https://example.org";
-  let testHttpsUri = Services.io.newURI(testHost);
-  Services.perms.add(testHttpsUri, HC_PERMISSION, Services.perms.ALLOW_ACTION);
-  let url = getRootDirectory(gTestPath) + "hybrid_content.html";
-  url = url.replace("chrome://mochitests/content", testHost);
-  let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
-
-  // Try to use the API. Also record a content event from outside HCT: we'll
-  // use this event to know when we can stop waiting for the hybrid content data.
-  const TEST_CONTENT_EVENT = ["telemetry.test", "content_only", "object1"];
-  Services.telemetry.setEventRecordingEnabled("telemetry.test", true);
-  await ContentTask.spawn(newTab.linkedBrowser, [TEST_CONTENT_EVENT],
-                          ([testContentEvent]) => {
-    // Call the hybrid content telemetry API.
-    let contentWin = Components.utils.waiveXrays(content);
-    contentWin.testRegisterEvents(testContentEvent[0], JSON.stringify({}));
-    // Record from the usual telemetry API a "canary" event.
-    Services.telemetry.recordEvent(...testContentEvent);
-  });
-
-  await waitForEvent("content", TEST_CONTENT_EVENT);
-
-  // This is needed otherwise the test will fail due to missing test passes.
-  ok(true, "There were no unintended hybrid content API usages.");
-
-  // Finally clean up the listener.
-  await SpecialPowers.popPrefEnv();
-  await BrowserTestUtils.removeTab(newTab);
-  Services.perms.remove(testHttpsUri, HC_PERMISSION);
-  Services.mm.removeMessageListener(messageName, makeTestFail);
-  Services.telemetry.setEventRecordingEnabled("telemetry.test", false);
-});
-
-add_task(async function test_hybrid_content_with_iframe() {
-  Services.telemetry.clearEvents();
-
-  // Open a trusted page that can use in the HCT in a new tab.
-  const testOuterPageHost = "https://example.com";
-  let testHttpsUri = Services.io.newURI(testOuterPageHost);
-  Services.perms.add(testHttpsUri, HC_PERMISSION, Services.perms.ALLOW_ACTION);
-  let url = getRootDirectory(gTestPath) + "hybrid_content.html";
-  let outerUrl = url.replace("chrome://mochitests/content", testOuterPageHost);
-  let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, outerUrl);
-
-  // Install a custom handler that intercepts hybrid content telemetry messages
-  // and makes the test fail. This needs to be done after the tab is opened.
-  const messageName = "HybridContentTelemetry:onTelemetryMessage";
-  let makeTestFail = () => ok(false, `Received an unexpected ${messageName}.`);
-  Services.mm.addMessageListener(messageName, makeTestFail);
-
-  // Enable recording the canary event.
-  const TEST_CONTENT_EVENT = ["telemetry.test", "content_only", "object1"];
-  Services.telemetry.setEventRecordingEnabled("telemetry.test", true);
-
-  // Add an iframe to the test page. The URI in the iframe should not be able
-  // to use HCT to the the missing privileges.
-  const testHost = "https://example.org";
-  let iframeUrl = url.replace("chrome://mochitests/content", testHost);
-  await ContentTask.spawn(newTab.linkedBrowser,
-                          [iframeUrl, TEST_CONTENT_EVENT],
-                          async function([iframeUrl, testContentEvent]) {
-    let doc = content.document;
-    let iframe = doc.createElement("iframe");
-    let promiseIframeLoaded = ContentTaskUtils.waitForEvent(iframe, "load", false);
-    iframe.src = iframeUrl;
-    doc.body.insertBefore(iframe, doc.body.firstChild);
-    await promiseIframeLoaded;
-
-    // Call the hybrid content telemetry API.
-    let contentWin = Components.utils.waiveXrays(iframe.contentWindow);
-    contentWin.testRegisterEvents(testContentEvent[0], JSON.stringify({}));
-
-    // Record from the usual telemetry API a "canary" event.
-    Services.telemetry.recordEvent(...testContentEvent);
-  });
-
-  await waitForEvent("content", TEST_CONTENT_EVENT);
-
-  // This is needed otherwise the test will fail due to missing test passes.
-  ok(true, "There were no unintended hybrid content API usages from the iframe.");
-
-  // Cleanup permissions and remove the tab.
-  await BrowserTestUtils.removeTab(newTab);
-  Services.mm.removeMessageListener(messageName, makeTestFail);
-  Services.perms.remove(testHttpsUri, HC_PERMISSION);
-  Services.telemetry.setEventRecordingEnabled("telemetry.test", false);
-});
-
-add_task(async function test_hybrid_content_recording() {
-  const testHost = "https://example.org";
-  const TEST_EVENT_CATEGORY = "telemetry.test.hct";
-  const RECORDED_TEST_EVENTS = [
-    [TEST_EVENT_CATEGORY, "test1", "object1"],
-    [TEST_EVENT_CATEGORY, "test2", "object1", null, {"key1": "foo", "key2": "bar"}],
-    [TEST_EVENT_CATEGORY, "test2", "object1", "some value"],
-    [TEST_EVENT_CATEGORY, "test1", "object1", null, null],
-    [TEST_EVENT_CATEGORY, "test1", "object1", "", null],
-  ];
-  const NON_RECORDED_TEST_EVENTS = [
-    [TEST_EVENT_CATEGORY, "unknown", "unknown"],
-  ];
-
-  Services.telemetry.clearEvents();
-
-  // Give the test host enough privileges to use the API and open the test page.
-  let testHttpsUri = Services.io.newURI(testHost);
-  Services.perms.add(testHttpsUri, HC_PERMISSION, Services.perms.ALLOW_ACTION);
-  let url = getRootDirectory(gTestPath) + "hybrid_content.html";
-  url = url.replace("chrome://mochitests/content", testHost);
-  let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
-
-  // Register some events and record them in Telemetry.
-  await ContentTask.spawn(newTab.linkedBrowser,
-                          [TEST_EVENT_CATEGORY, RECORDED_TEST_EVENTS, NON_RECORDED_TEST_EVENTS],
-                          ([eventCategory, recordedTestEvents, nonRecordedTestEvents]) => {
-    let contentWin = Components.utils.waiveXrays(content);
-
-    // If we tried to call contentWin.Mozilla.ContentTelemetry.* functions
-    // and pass non-string parameters, |waiveXrays| would complain and not
-    // let us access them. To work around this, we generate test functions
-    // in the test HTML file and unwrap the passed JSON blob there.
-    contentWin.testRegisterEvents(eventCategory, JSON.stringify({
-      // Event with only required fields.
-      "test1": {
-        methods: ["test1"],
-        objects: ["object1"],
-      },
-      // Event with extra_keys.
-      "test2": {
-        methods: ["test2", "test2b"],
-        objects: ["object1"],
-        extra_keys: ["key1", "key2"],
-      },
-    }));
-
-    // Record some valid events.
-    recordedTestEvents.forEach(e => contentWin.testRecordEvents(JSON.stringify(e)));
-
-    // Test recording an unknown event. The Telemetry API itself is supposed to throw,
-    // but we catch that in hybrid content telemetry and log an error message.
-    nonRecordedTestEvents.forEach(e => contentWin.testRecordEvents(JSON.stringify(e)));
-  });
-
-  // Wait for the data to be in the snapshot, then get the Telemetry data.
-  await waitForProcessesEvents(["dynamic"]);
-  let snapshot =
-      Services.telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN);
-
-  // Check that the dynamically register events made it to the snapshot.
-  ok("dynamic" in snapshot,
-     "The snapshot must contain the 'dynamic' process section");
-  let dynamicEvents = snapshot.dynamic.map(e => e.slice(1));
-  is(dynamicEvents.length, RECORDED_TEST_EVENTS.length, "Should match expected event count.");
-  for (let i = 0; i < RECORDED_TEST_EVENTS.length; ++i) {
-    SimpleTest.isDeeply(dynamicEvents[i],
-                        removeTrailingInvalidEntry(RECORDED_TEST_EVENTS[i]),
-                        "Should have recorded the expected event.");
-  }
-
-  // Cleanup permissions and remove the tab.
-  await BrowserTestUtils.removeTab(newTab);
-  Services.perms.remove(testHttpsUri, HC_PERMISSION);
-});
-
-add_task(async function test_can_upload() {
-  const testHost = "https://example.org";
-
-  await SpecialPowers.pushPrefEnv({set: [[TelemetryUtils.Preferences.FhrUploadEnabled, false]]});
-
-  // Give the test host enough privileges to use the API and open the test page.
-  let testHttpsUri = Services.io.newURI(testHost);
-  Services.perms.add(testHttpsUri, HC_PERMISSION, Services.perms.ALLOW_ACTION);
-  let url = getRootDirectory(gTestPath) + "hybrid_content.html";
-  url = url.replace("chrome://mochitests/content", testHost);
-  let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
-
-  // Check that CanUpload reports the correct value.
-  await ContentTask.spawn(newTab.linkedBrowser, {}, () => {
-    let contentWin = Components.utils.waiveXrays(content);
-    // We don't need to pass any parameter, we can safely call Mozilla.ContentTelemetry.
-    let canUpload = contentWin.Mozilla.ContentTelemetry.canUpload();
-    ok(!canUpload, "CanUpload must report 'false' if the preference has that value.");
-  });
-
-  // Flip the pref and check again.
-  await SpecialPowers.pushPrefEnv({set: [[TelemetryUtils.Preferences.FhrUploadEnabled, true]]});
-  await ContentTask.spawn(newTab.linkedBrowser, {}, () => {
-    let contentWin = Components.utils.waiveXrays(content);
-    let canUpload = contentWin.Mozilla.ContentTelemetry.canUpload();
-    ok(canUpload, "CanUpload must report 'true' if the preference has that value.");
-  });
-
-  // Cleanup permissions and remove the tab.
-  await BrowserTestUtils.removeTab(newTab);
-  Services.perms.remove(testHttpsUri, HC_PERMISSION);
-});
deleted file mode 100644
--- a/toolkit/components/telemetry/tests/browser/hybrid_content.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <meta charset="utf-8" />
-    <title>Hybrid content telemetry test</title>
-    <script type="application/javascript" src="HybridContentTelemetry-lib.js">
-    </script>
-    <script type="application/javascript">
-      /**
-       * The following functions are simply wrapping API calls
-       * to make sure we don't have waiveXRays complaining about
-       * "same-origin" problems in tests.
-       */
-      function testRegisterEvents(category, dataAsString) {
-        // eslint-disable-next-line no-undef
-        Mozilla.ContentTelemetry.registerEvents(category, JSON.parse(dataAsString));
-      }
-
-      function testRecordEvents(paramsAsString) {
-        // eslint-disable-next-line no-undef
-        Mozilla.ContentTelemetry.recordEvent(...JSON.parse(paramsAsString));
-      }
-    </script>
-  </head>
-  <body>
-    <h1>Hybrid Content Telemetry tests</h1>
-    <p>Because Firefox is...</p>
-    <p>Never gonna let you down</p>
-    <p>Never gonna give you up</p>
-  </body>
-</html>