author Jeff Walden <>
Tue, 19 Nov 2019 04:55:39 +0000
changeset 502538 b5c5ba07d3dbd0d07b66fa42a103f4df2c27d3a2
parent 497549 15f007ec4cacb3114aaa3dd76ed8c1d72e20cde9
permissions -rw-r--r--
Bug 1596544 - intl_ValidateAndCanonicalizeUnicodeExtensionType should ignore the second |option| argument until it's needed to report an error. r=anba Differential Revision:

/* 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 */

"use strict";

// FxA Telemetry support. For hysterical raisins, the actual implementation
// is inside "sync". We should move the core implementation somewhere that's
// sanely shared (eg, services-common?), but let's wait and see where we end up
// first...

// We use this observers module because we leverage its support for richer
// "subject" data.
const { Observers } = ChromeUtils.import(

class FxAccountsTelemetry {
  recordEvent(object, method, value, extra = undefined) {
    // We need to ensure the telemetry module is loaded.
    // Now it will be listening for the notifications...
    Observers.notify("fxa:telemetry:event", { object, method, value, extra });

  // A flow ID can be anything that's "probably" unique, so for now use a UUID.
  generateFlowID() {
    return Cc[";1"]
      .slice(1, -1);

  // Sanitize the ID of a device into something suitable for including in the
  // ping. Returns null if no transformation is possible.
  sanitizeDeviceId(deviceId) {
    // We only know how to hash it for sync users, which kinda sucks.
    let xps =
      this._weaveXPCOM ||
    if (!xps.enabled) {
      return null;
    try {
      return xps.Weave.Service.identity.hashedDeviceID(deviceId);
    } catch {
      // sadly this can happen in various scenarios, so don't complain.
    return null;

var EXPORTED_SYMBOLS = ["FxAccountsTelemetry"];