зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1489315 - Move ExtensionTelemetry into its own JSM module. r=mixedpuppy
This patch moves the ExtensionTelemetry helpers (added into ExtensionUtils.jsm by Bug 1483002) into a new ExtensionTelemetry.jsm and makes the ExtensionTelemetry a lazy getter on every one of the JSM and API modules that are going to use it, so that we don't have to load these helpers until they are actually used and we can reduce their impact on the base content memory usage. Differential Revision: https://phabricator.services.mozilla.com/D5266 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
dae6ac4ec4
Коммит
bc6ccc75fd
|
@ -6,6 +6,8 @@ ChromeUtils.defineModuleGetter(this, "CustomizableUI",
|
|||
"resource:///modules/CustomizableUI.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "clearTimeout",
|
||||
"resource://gre/modules/Timer.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "ExtensionTelemetry",
|
||||
"resource://gre/modules/ExtensionTelemetry.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "setTimeout",
|
||||
"resource://gre/modules/Timer.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "ViewPopup",
|
||||
|
@ -14,7 +16,6 @@ ChromeUtils.defineModuleGetter(this, "ViewPopup",
|
|||
var {
|
||||
DefaultWeakMap,
|
||||
ExtensionError,
|
||||
ExtensionTelemetry,
|
||||
} = ExtensionUtils;
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/ExtensionParent.jsm");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "ExtensionTelemetry",
|
||||
"resource://gre/modules/ExtensionTelemetry.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "PageActions",
|
||||
"resource:///modules/PageActions.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "PanelPopup",
|
||||
|
@ -16,7 +18,6 @@ var {
|
|||
|
||||
var {
|
||||
DefaultWeakMap,
|
||||
ExtensionTelemetry,
|
||||
} = ExtensionUtils;
|
||||
|
||||
// WeakMap[Extension -> PageAction]
|
||||
|
|
|
@ -45,6 +45,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
ExtensionPermissions: "resource://gre/modules/ExtensionPermissions.jsm",
|
||||
ExtensionStorage: "resource://gre/modules/ExtensionStorage.jsm",
|
||||
ExtensionStorageIDB: "resource://gre/modules/ExtensionStorageIDB.jsm",
|
||||
ExtensionTelemetry: "resource://gre/modules/ExtensionTelemetry.jsm",
|
||||
ExtensionTestCommon: "resource://testing-common/ExtensionTestCommon.jsm",
|
||||
FileSource: "resource://gre/modules/L10nRegistry.jsm",
|
||||
L10nRegistry: "resource://gre/modules/L10nRegistry.jsm",
|
||||
|
@ -98,7 +99,6 @@ var {
|
|||
const {
|
||||
getUniqueId,
|
||||
promiseTimeout,
|
||||
ExtensionTelemetry,
|
||||
} = ExtensionUtils;
|
||||
|
||||
const {
|
||||
|
|
|
@ -13,6 +13,7 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
ExtensionTelemetry: "resource://gre/modules/ExtensionTelemetry.jsm",
|
||||
LanguageDetector: "resource:///modules/translation/LanguageDetector.jsm",
|
||||
MessageChannel: "resource://gre/modules/MessageChannel.jsm",
|
||||
Schemas: "resource://gre/modules/Schemas.jsm",
|
||||
|
@ -41,7 +42,6 @@ XPCOMUtils.defineLazyGlobalGetters(this, ["crypto", "TextEncoder"]);
|
|||
const {
|
||||
DefaultMap,
|
||||
DefaultWeakMap,
|
||||
ExtensionTelemetry,
|
||||
getInnerWindowID,
|
||||
getWinUtils,
|
||||
promiseDocumentIdle,
|
||||
|
|
|
@ -8,11 +8,11 @@ this.EXPORTED_SYMBOLS = ["ExtensionStorageIDB"];
|
|||
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/IndexedDB.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/ExtensionUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
ContextualIdentityService: "resource://gre/modules/ContextualIdentityService.jsm",
|
||||
ExtensionStorage: "resource://gre/modules/ExtensionStorage.jsm",
|
||||
getTrimmedString: "resource://gre/modules/ExtensionTelemetry.jsm",
|
||||
Services: "resource://gre/modules/Services.jsm",
|
||||
OS: "resource://gre/modules/osfile.jsm",
|
||||
});
|
||||
|
@ -24,10 +24,6 @@ XPCOMUtils.defineLazyGetter(this, "WEBEXT_STORAGE_USER_CONTEXT_ID", () => {
|
|||
"userContextIdInternal.webextStorageLocal").userContextId;
|
||||
});
|
||||
|
||||
var {
|
||||
getTrimmedString,
|
||||
} = ExtensionUtils;
|
||||
|
||||
const IDB_NAME = "webExtensions-storage-local";
|
||||
const IDB_DATA_STORENAME = "storage-local-data";
|
||||
const IDB_VERSION = 1;
|
||||
|
|
|
@ -0,0 +1,180 @@
|
|||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* 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";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["ExtensionTelemetry", "getTrimmedString"];
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "Services",
|
||||
"resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "TelemetryStopwatch",
|
||||
"resource://gre/modules/TelemetryStopwatch.jsm");
|
||||
|
||||
// Map of the base histogram ids for the metrics recorded for the extensions.
|
||||
const histograms = {
|
||||
"extensionStartup": "WEBEXT_EXTENSION_STARTUP_MS",
|
||||
"backgroundPageLoad": "WEBEXT_BACKGROUND_PAGE_LOAD_MS",
|
||||
"browserActionPopupOpen": "WEBEXT_BROWSERACTION_POPUP_OPEN_MS",
|
||||
"browserActionPreloadResult": "WEBEXT_BROWSERACTION_POPUP_PRELOAD_RESULT_COUNT",
|
||||
"contentScriptInjection": "WEBEXT_CONTENT_SCRIPT_INJECTION_MS",
|
||||
"pageActionPopupOpen": "WEBEXT_PAGEACTION_POPUP_OPEN_MS",
|
||||
"storageLocalGetJSON": "WEBEXT_STORAGE_LOCAL_GET_MS",
|
||||
"storageLocalSetJSON": "WEBEXT_STORAGE_LOCAL_SET_MS",
|
||||
"storageLocalGetIDB": "WEBEXT_STORAGE_LOCAL_IDB_GET_MS",
|
||||
"storageLocalSetIDB": "WEBEXT_STORAGE_LOCAL_IDB_SET_MS",
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a trimmed version of the given string if it is longer than 80 chars (used in telemetry
|
||||
* when a string may be longer than allowed).
|
||||
*
|
||||
* @param {string} str
|
||||
* The original string content.
|
||||
*
|
||||
* @returns {string}
|
||||
* The trimmed version of the string when longer than 80 chars, or the given string
|
||||
* unmodified otherwise.
|
||||
*/
|
||||
function getTrimmedString(str) {
|
||||
if (str.length <= 80) {
|
||||
return str;
|
||||
}
|
||||
|
||||
const length = str.length;
|
||||
|
||||
// Trim the string to prevent a flood of warnings messages logged internally by recordEvent,
|
||||
// the trimmed version is going to be composed by the first 40 chars and the last 37 and 3 dots
|
||||
// that joins the two parts, to visually indicate that the string has been trimmed.
|
||||
return `${str.slice(0, 40)}...${str.slice(length - 37, length)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a internal helper object which contains a collection of helpers used to make it easier
|
||||
* to collect extension telemetry (in both the general histogram and in the one keyed by addon id).
|
||||
*
|
||||
* This helper object is not exported from ExtensionUtils, it is used by the ExtensionTelemetry
|
||||
* Proxy which is exported and used by the callers to record telemetry data for one of the
|
||||
* supported metrics.
|
||||
*/
|
||||
class ExtensionTelemetryMetric {
|
||||
constructor(metric) {
|
||||
this.metric = metric;
|
||||
}
|
||||
|
||||
// Stopwatch methods.
|
||||
stopwatchStart(extension, obj = extension) {
|
||||
this._wrappedStopwatchMethod("start", this.metric, extension, obj);
|
||||
}
|
||||
|
||||
stopwatchFinish(extension, obj = extension) {
|
||||
this._wrappedStopwatchMethod("finish", this.metric, extension, obj);
|
||||
}
|
||||
|
||||
stopwatchCancel(extension, obj = extension) {
|
||||
this._wrappedStopwatchMethod("cancel", this.metric, extension, obj);
|
||||
}
|
||||
|
||||
// Histogram counters methods.
|
||||
histogramAdd(opts) {
|
||||
this._histogramAdd(this.metric, opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps a call to a TelemetryStopwatch method for a given metric and extension.
|
||||
*
|
||||
* @param {string} method
|
||||
* The stopwatch method to call ("start", "finish" or "cancel").
|
||||
* @param {string} metric
|
||||
* The stopwatch metric to record (used to retrieve the base histogram id from the _histogram object).
|
||||
* @param {Extension | BrowserExtensionContent} extension
|
||||
* The extension to record the telemetry for.
|
||||
* @param {any | undefined} [obj = extension]
|
||||
* An optional telemetry stopwatch object (which defaults to the extension parameter when missing).
|
||||
*/
|
||||
_wrappedStopwatchMethod(method, metric, extension, obj = extension) {
|
||||
if (!extension) {
|
||||
throw new Error(`Mandatory extension parameter is undefined`);
|
||||
}
|
||||
|
||||
const baseId = histograms[metric];
|
||||
if (!baseId) {
|
||||
throw new Error(`Unknown metric ${metric}`);
|
||||
}
|
||||
|
||||
// Record metric in the general histogram.
|
||||
TelemetryStopwatch[method](baseId, obj);
|
||||
|
||||
// Record metric in the histogram keyed by addon id.
|
||||
let extensionId = getTrimmedString(extension.id);
|
||||
TelemetryStopwatch[`${method}Keyed`](`${baseId}_BY_ADDONID`, extensionId, obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Record a telemetry category and/or value for a given metric.
|
||||
*
|
||||
* @param {string} metric
|
||||
* The metric to record (used to retrieve the base histogram id from the _histogram object).
|
||||
* @param {Object} options
|
||||
* @param {Extension | BrowserExtensionContent} options.extension
|
||||
* The extension to record the telemetry for.
|
||||
* @param {string | undefined} [options.category]
|
||||
* An optional histogram category.
|
||||
* @param {number | undefined} [options.value]
|
||||
* An optional value to record.
|
||||
*/
|
||||
_histogramAdd(metric, {category, extension, value}) {
|
||||
if (!extension) {
|
||||
throw new Error(`Mandatory extension parameter is undefined`);
|
||||
}
|
||||
|
||||
const baseId = histograms[metric];
|
||||
if (!baseId) {
|
||||
throw new Error(`Unknown metric ${metric}`);
|
||||
}
|
||||
|
||||
const histogram = Services.telemetry.getHistogramById(baseId);
|
||||
if (typeof category === "string") {
|
||||
histogram.add(category, value);
|
||||
} else {
|
||||
histogram.add(value);
|
||||
}
|
||||
|
||||
const keyedHistogram = Services.telemetry.getKeyedHistogramById(`${baseId}_BY_ADDONID`);
|
||||
const extensionId = getTrimmedString(extension.id);
|
||||
|
||||
if (typeof category === "string") {
|
||||
keyedHistogram.add(extensionId, category, value);
|
||||
} else {
|
||||
keyedHistogram.add(extensionId, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cache of the ExtensionTelemetryMetric instances that has been lazily created by the
|
||||
// Extension Telemetry Proxy.
|
||||
const metricsCache = new Map();
|
||||
|
||||
/**
|
||||
* This proxy object provides the telemetry helpers for the currently supported metrics (the ones listed in
|
||||
* ExtensionTelemetryHelpers._histograms), the telemetry helpers for a particular metric are lazily created
|
||||
* when the related property is being accessed on this object for the first time, e.g.:
|
||||
*
|
||||
* ExtensionTelemetry.extensionStartup.stopwatchStart(extension);
|
||||
* ExtensionTelemetry.browserActionPreloadResult.histogramAdd({category: "Shown", extension});
|
||||
*/
|
||||
var ExtensionTelemetry = new Proxy(metricsCache, {
|
||||
get(target, prop, receiver) {
|
||||
if (!(prop in histograms)) {
|
||||
throw new Error(`Unknown metric ${prop}`);
|
||||
}
|
||||
|
||||
// Lazily create and cache the metric result object.
|
||||
if (!target.has(prop)) {
|
||||
target.set(prop, new ExtensionTelemetryMetric(prop));
|
||||
}
|
||||
|
||||
return target.get(prop);
|
||||
},
|
||||
});
|
|
@ -12,8 +12,6 @@ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
|||
|
||||
ChromeUtils.defineModuleGetter(this, "setTimeout",
|
||||
"resource://gre/modules/Timer.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "TelemetryStopwatch",
|
||||
"resource://gre/modules/TelemetryStopwatch.jsm");
|
||||
|
||||
// xpcshell doesn't handle idle callbacks well.
|
||||
XPCOMUtils.defineLazyGetter(this, "idleTimeout",
|
||||
|
@ -269,165 +267,12 @@ const chromeModifierKeyMap = {
|
|||
"Shift": "shift",
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a trimmed version of the given string if it is longer than 80 chars (used in telemetry
|
||||
* when a string may be longer than allowed).
|
||||
*
|
||||
* @param {string} str
|
||||
* The original string content.
|
||||
*
|
||||
* @returns {string}
|
||||
* The trimmed version of the string when longer than 80 chars, or the given string
|
||||
* unmodified otherwise.
|
||||
*/
|
||||
function getTrimmedString(str) {
|
||||
if (str.length <= 80) {
|
||||
return str;
|
||||
}
|
||||
|
||||
const length = str.length;
|
||||
|
||||
// Trim the string to prevent a flood of warnings messages logged internally by recordEvent,
|
||||
// the trimmed version is going to be composed by the first 40 chars and the last 37 and 3 dots
|
||||
// that joins the two parts, to visually indicate that the string has been trimmed.
|
||||
return `${str.slice(0, 40)}...${str.slice(length - 37, length)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a internal helper object which contains a collection of helpers used to make it easier
|
||||
* to collect extension telemetry (in both the general histogram and in the one keyed by addon id).
|
||||
*
|
||||
* This helper object is not exported from ExtensionUtils, it is used by the ExtensionTelemetry
|
||||
* Proxy which is exported and used by the callers to record telemetry data for one of the
|
||||
* supported metrics.
|
||||
*/
|
||||
const ExtensionTelemetryHelpers = {
|
||||
// Allow callers to refer to the existing metrics by accessing it as properties of the
|
||||
// ExtensionTelemetry.metrics (e.g. ExtensionTelemetry.metrics.extensionStartup).
|
||||
|
||||
// Cache of the metrics helper lazily created by the ExtensionTelemetry Proxy.
|
||||
_metricsMap: new Map(),
|
||||
|
||||
// Map of the base histogram ids for the metrics recorded for the extensions.
|
||||
_histograms: {
|
||||
"extensionStartup": "WEBEXT_EXTENSION_STARTUP_MS",
|
||||
"backgroundPageLoad": "WEBEXT_BACKGROUND_PAGE_LOAD_MS",
|
||||
"browserActionPopupOpen": "WEBEXT_BROWSERACTION_POPUP_OPEN_MS",
|
||||
"browserActionPreloadResult": "WEBEXT_BROWSERACTION_POPUP_PRELOAD_RESULT_COUNT",
|
||||
"contentScriptInjection": "WEBEXT_CONTENT_SCRIPT_INJECTION_MS",
|
||||
"pageActionPopupOpen": "WEBEXT_PAGEACTION_POPUP_OPEN_MS",
|
||||
"storageLocalGetJSON": "WEBEXT_STORAGE_LOCAL_GET_MS",
|
||||
"storageLocalSetJSON": "WEBEXT_STORAGE_LOCAL_SET_MS",
|
||||
"storageLocalGetIDB": "WEBEXT_STORAGE_LOCAL_IDB_GET_MS",
|
||||
"storageLocalSetIDB": "WEBEXT_STORAGE_LOCAL_IDB_SET_MS",
|
||||
},
|
||||
// Wraps a call to a TelemetryStopwatch method.
|
||||
/**
|
||||
* Wraps a call to a TelemetryStopwatch method for a given metric and extension.
|
||||
*
|
||||
* @param {string} method
|
||||
* The stopwatch method to call ("start", "finish" or "cancel").
|
||||
* @param {string} metric
|
||||
* The stopwatch metric to record (used to retrieve the base histogram id from the _histogram object).
|
||||
* @param {Extension | BrowserExtensionContent} extension
|
||||
* The extension to record the telemetry for.
|
||||
* @param {any | undefined} [obj = extension]
|
||||
* An optional telemetry stopwatch object (which defaults to the extension parameter when missing).
|
||||
*/
|
||||
_wrappedStopwatchMethod(method, metric, extension, obj = extension) {
|
||||
if (!extension) {
|
||||
throw new Error(`Mandatory extension parameter is undefined`);
|
||||
}
|
||||
|
||||
const baseId = this._histograms[metric];
|
||||
if (!baseId) {
|
||||
throw new Error(`Unknown metric ${metric}`);
|
||||
}
|
||||
|
||||
// Record metric in the general histogram.
|
||||
TelemetryStopwatch[method](baseId, obj);
|
||||
|
||||
// Record metric in the histogram keyed by addon id.
|
||||
let extensionId = getTrimmedString(extension.id);
|
||||
TelemetryStopwatch[`${method}Keyed`](`${baseId}_BY_ADDONID`, extensionId, obj);
|
||||
},
|
||||
/**
|
||||
* Record a telemetry category and/or value for a given metric.
|
||||
*
|
||||
* @param {string} metric
|
||||
* The metric to record (used to retrieve the base histogram id from the _histogram object).
|
||||
* @param {Object} options
|
||||
* @param {Extension | BrowserExtensionContent} options.extension
|
||||
* The extension to record the telemetry for.
|
||||
* @param {string | undefined} [options.category]
|
||||
* An optional histogram category.
|
||||
* @param {number | undefined} [options.value]
|
||||
* An optional value to record.
|
||||
*/
|
||||
_histogramAdd(metric, {category, extension, value}) {
|
||||
if (!extension) {
|
||||
throw new Error(`Mandatory extension parameter is undefined`);
|
||||
}
|
||||
|
||||
const baseId = this._histograms[metric];
|
||||
if (!baseId) {
|
||||
throw new Error(`Unknown metric ${metric}`);
|
||||
}
|
||||
|
||||
const histogram = Services.telemetry.getHistogramById(baseId);
|
||||
if (typeof category === "string") {
|
||||
histogram.add(category, value);
|
||||
} else {
|
||||
histogram.add(value);
|
||||
}
|
||||
|
||||
const keyedHistogram = Services.telemetry.getKeyedHistogramById(`${baseId}_BY_ADDONID`);
|
||||
const extensionId = getTrimmedString(extension.id);
|
||||
|
||||
if (typeof category === "string") {
|
||||
keyedHistogram.add(extensionId, category, value);
|
||||
} else {
|
||||
keyedHistogram.add(extensionId, value);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* This proxy object provides the telemetry helpers for the currently supported metrics (the ones listed in
|
||||
* ExtensionTelemetryHelpers._histograms), the telemetry helpers for a particular metric are lazily created
|
||||
* when the related property is being accessed on this object for the first time, e.g.:
|
||||
*
|
||||
* ExtensionTelemetry.extensionStartup.stopwatchStart(extension);
|
||||
* ExtensionTelemetry.browserActionPreloadResult.histogramAdd({category: "Shown", extension});
|
||||
*/
|
||||
const ExtensionTelemetry = new Proxy(ExtensionTelemetryHelpers, {
|
||||
get(target, prop, receiver) {
|
||||
if (!(prop in target._histograms)) {
|
||||
throw new Error(`Unknown metric ${prop}`);
|
||||
}
|
||||
|
||||
// Lazily create and cache the metric result object.
|
||||
if (!target._metricsMap.has(prop)) {
|
||||
target._metricsMap.set(prop, {
|
||||
// Stopwatch histogram helpers.
|
||||
stopwatchStart: target._wrappedStopwatchMethod.bind(target, "start", prop),
|
||||
stopwatchFinish: target._wrappedStopwatchMethod.bind(target, "finish", prop),
|
||||
stopwatchCancel: target._wrappedStopwatchMethod.bind(target, "cancel", prop),
|
||||
// Result histogram helpers.
|
||||
histogramAdd: target._histogramAdd.bind(target, prop),
|
||||
});
|
||||
}
|
||||
|
||||
return target._metricsMap.get(prop);
|
||||
},
|
||||
});
|
||||
|
||||
var ExtensionUtils = {
|
||||
chromeModifierKeyMap,
|
||||
flushJarCache,
|
||||
getInnerWindowID,
|
||||
getMessageManager,
|
||||
getTrimmedString,
|
||||
getUniqueId,
|
||||
filterStack,
|
||||
getWinUtils,
|
||||
|
@ -440,6 +285,5 @@ var ExtensionUtils = {
|
|||
DefaultMap,
|
||||
DefaultWeakMap,
|
||||
ExtensionError,
|
||||
ExtensionTelemetry,
|
||||
LimitedSet,
|
||||
};
|
||||
|
|
|
@ -4,13 +4,11 @@ ChromeUtils.defineModuleGetter(this, "ExtensionStorage",
|
|||
"resource://gre/modules/ExtensionStorage.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "ExtensionStorageIDB",
|
||||
"resource://gre/modules/ExtensionStorageIDB.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "ExtensionTelemetry",
|
||||
"resource://gre/modules/ExtensionTelemetry.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "Services",
|
||||
"resource://gre/modules/Services.jsm");
|
||||
|
||||
var {
|
||||
ExtensionTelemetry,
|
||||
} = ExtensionUtils;
|
||||
|
||||
// Wrap a storage operation in a TelemetryStopWatch.
|
||||
async function measureOp(telemetryMetric, extension, fn) {
|
||||
const stopwatchKey = {};
|
||||
|
|
|
@ -22,6 +22,7 @@ EXTRA_JS_MODULES += [
|
|||
'ExtensionStorage.jsm',
|
||||
'ExtensionStorageIDB.jsm',
|
||||
'ExtensionStorageSync.jsm',
|
||||
'ExtensionTelemetry.jsm',
|
||||
'ExtensionUtils.jsm',
|
||||
'FindContent.jsm',
|
||||
'LegacyExtensionsUtils.jsm',
|
||||
|
|
|
@ -6,10 +6,9 @@ var {
|
|||
promiseExtensionViewLoaded,
|
||||
} = ExtensionParent;
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/ExtensionUtils.jsm");
|
||||
var {
|
||||
ExtensionTelemetry,
|
||||
} = ExtensionUtils;
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "ExtensionTelemetry",
|
||||
"resource://gre/modules/ExtensionTelemetry.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "DELAYED_STARTUP",
|
||||
"extensions.webextensions.background-delayed-startup");
|
||||
|
|
|
@ -15,6 +15,7 @@ const STARTUP_MODULES = [
|
|||
// this.
|
||||
"resource://gre/modules/ExtensionPermissions.jsm",
|
||||
"resource://gre/modules/ExtensionUtils.jsm",
|
||||
"resource://gre/modules/ExtensionTelemetry.jsm",
|
||||
];
|
||||
|
||||
if (!Services.prefs.getBoolPref("extensions.webextensions.remote")) {
|
||||
|
|
|
@ -10,13 +10,16 @@ AddonTestUtils.createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42"
|
|||
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/ExtensionStorage.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/ExtensionUtils.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/TelemetryController.jsm");
|
||||
|
||||
const {
|
||||
ExtensionStorageIDB,
|
||||
} = ChromeUtils.import("resource://gre/modules/ExtensionStorageIDB.jsm", {});
|
||||
|
||||
const {
|
||||
getTrimmedString,
|
||||
} = ChromeUtils.import("resource://gre/modules/ExtensionTelemetry.jsm", {});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
OS: "resource://gre/modules/osfile.jsm",
|
||||
});
|
||||
|
@ -252,7 +255,7 @@ add_task(async function test_extensionId_trimmed_in_telemetry_event() {
|
|||
|
||||
await extension.awaitMessage("storage-local-data-migrated");
|
||||
|
||||
const expectedTrimmedExtensionId = ExtensionUtils.getTrimmedString(EXTENSION_ID);
|
||||
const expectedTrimmedExtensionId = getTrimmedString(EXTENSION_ID);
|
||||
|
||||
equal(expectedTrimmedExtensionId.length, 80, "The trimmed version of the extensionId should be 80 chars long");
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче