Backed out 5 changesets (bug 1920562) for causing xpc assertion failures. CLOSED TREE
Backed out changeset 8f085ab589a8 (bug 1920562) Backed out changeset 4405387ae770 (bug 1920562) Backed out changeset a68fd13a33ae (bug 1920562) Backed out changeset cd3672fc08ed (bug 1920562) Backed out changeset 62ab18879eea (bug 1920562)
This commit is contained in:
@@ -31,6 +31,10 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||||||
let gSearchBannerShownThisSession;
|
let gSearchBannerShownThisSession;
|
||||||
|
|
||||||
export class AboutPrivateBrowsingParent extends JSWindowActorParent {
|
export class AboutPrivateBrowsingParent extends JSWindowActorParent {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("aboutprivatebrowsing", true);
|
||||||
|
}
|
||||||
// Used by tests
|
// Used by tests
|
||||||
static setShownThisSession(shown) {
|
static setShownThisSession(shown) {
|
||||||
gSearchBannerShownThisSession = shown;
|
gSearchBannerShownThisSession = shown;
|
||||||
|
|||||||
@@ -1453,6 +1453,7 @@ pref("app.support.baseURL", "https://support.mozilla.org/1/firefox/%VERSION%/%OS
|
|||||||
// base url for web-based feedback pages
|
// base url for web-based feedback pages
|
||||||
pref("app.feedback.baseURL", "https://ideas.mozilla.org/");
|
pref("app.feedback.baseURL", "https://ideas.mozilla.org/");
|
||||||
|
|
||||||
|
pref("security.certerrors.recordEventTelemetry", true);
|
||||||
pref("security.certerrors.permanentOverride", true);
|
pref("security.certerrors.permanentOverride", true);
|
||||||
pref("security.certerrors.mitm.priming.enabled", true);
|
pref("security.certerrors.mitm.priming.enabled", true);
|
||||||
pref("security.certerrors.mitm.priming.endpoint", "https://mitmdetection.services.mozilla.com/");
|
pref("security.certerrors.mitm.priming.endpoint", "https://mitmdetection.services.mozilla.com/");
|
||||||
@@ -1999,6 +2000,8 @@ pref("browser.ml.chat.shortcuts.custom", true);
|
|||||||
pref("browser.ml.chat.shortcuts.longPress", 60000);
|
pref("browser.ml.chat.shortcuts.longPress", 60000);
|
||||||
pref("browser.ml.chat.sidebar", true);
|
pref("browser.ml.chat.sidebar", true);
|
||||||
|
|
||||||
|
pref("security.protectionspopup.recordEventTelemetry", true);
|
||||||
|
|
||||||
// Block insecure active content on https pages
|
// Block insecure active content on https pages
|
||||||
pref("security.mixed_content.block_active_content", true);
|
pref("security.mixed_content.block_active_content", true);
|
||||||
|
|
||||||
|
|||||||
@@ -936,6 +936,7 @@ var gBrowserInit = {
|
|||||||
"resource:///modules/DownloadsMacFinderProgress.sys.mjs"
|
"resource:///modules/DownloadsMacFinderProgress.sys.mjs"
|
||||||
).DownloadsMacFinderProgress.register();
|
).DownloadsMacFinderProgress.register();
|
||||||
}
|
}
|
||||||
|
Services.telemetry.setEventRecordingEnabled("downloads", true);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.error(ex);
|
console.error(ex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -806,6 +806,8 @@ function updateFxaToolbarMenu(enable, isInitialUpdate = false) {
|
|||||||
|
|
||||||
fxaPanelEl.addEventListener("ViewShowing", gSync.updateSendToDeviceTitle);
|
fxaPanelEl.addEventListener("ViewShowing", gSync.updateSendToDeviceTitle);
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("fxa_app_menu", true);
|
||||||
|
|
||||||
if (enable && syncEnabled) {
|
if (enable && syncEnabled) {
|
||||||
mainWindowEl.setAttribute("fxatoolbarmenu", "visible");
|
mainWindowEl.setAttribute("fxatoolbarmenu", "visible");
|
||||||
|
|
||||||
@@ -815,6 +817,8 @@ function updateFxaToolbarMenu(enable, isInitialUpdate = false) {
|
|||||||
if (!isInitialUpdate) {
|
if (!isInitialUpdate) {
|
||||||
gSync.maybeUpdateUIState();
|
gSync.maybeUpdateUIState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("fxa_avatar_menu", true);
|
||||||
} else {
|
} else {
|
||||||
mainWindowEl.removeAttribute("fxatoolbarmenu");
|
mainWindowEl.removeAttribute("fxatoolbarmenu");
|
||||||
}
|
}
|
||||||
@@ -7603,6 +7607,7 @@ var FirefoxViewHandler = {
|
|||||||
let viewCount = Services.prefs.getIntPref(PREF_NAME, 0);
|
let viewCount = Services.prefs.getIntPref(PREF_NAME, 0);
|
||||||
|
|
||||||
// Record telemetry
|
// Record telemetry
|
||||||
|
Services.telemetry.setEventRecordingEnabled("firefoxview_next", true);
|
||||||
Glean.firefoxviewNext.tabSelectedToolbarbutton.record();
|
Glean.firefoxviewNext.tabSelectedToolbarbutton.record();
|
||||||
|
|
||||||
if (viewCount < MAX_VIEW_COUNT) {
|
if (viewCount < MAX_VIEW_COUNT) {
|
||||||
|
|||||||
@@ -6,8 +6,11 @@
|
|||||||
const ISSUED_BY_CCA_SITE = "https://issued-by-cca.example.com";
|
const ISSUED_BY_CCA_SITE = "https://issued-by-cca.example.com";
|
||||||
const UNKNOWN_ISSUER_SITE = "https://untrusted.example.com";
|
const UNKNOWN_ISSUER_SITE = "https://untrusted.example.com";
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("security.ui.certerror", true);
|
||||||
|
|
||||||
registerCleanupFunction(async () => {
|
registerCleanupFunction(async () => {
|
||||||
await resetTelemetry();
|
await resetTelemetry();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("security.ui.certerror", false);
|
||||||
});
|
});
|
||||||
|
|
||||||
async function resetTelemetry() {
|
async function resetTelemetry() {
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ add_task(async function checkTelemetryClickEvents() {
|
|||||||
return !events || !events.length;
|
return !events || !events.length;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Now enable recording our telemetry. Even if this is disabled, content
|
||||||
|
// processes will send event telemetry to the parent, thus we needed to ensure
|
||||||
|
// we waited and cleared first. Sigh.
|
||||||
|
Services.telemetry.setEventRecordingEnabled("security.ui.certerror", true);
|
||||||
|
|
||||||
for (let useFrame of [false, true]) {
|
for (let useFrame of [false, true]) {
|
||||||
let recordedObjects = [
|
let recordedObjects = [
|
||||||
"advanced_button",
|
"advanced_button",
|
||||||
@@ -148,4 +153,12 @@ add_task(async function checkTelemetryClickEvents() {
|
|||||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let enableCertErrorUITelemetry = Services.prefs.getBoolPref(
|
||||||
|
"security.certerrors.recordEventTelemetry"
|
||||||
|
);
|
||||||
|
Services.telemetry.setEventRecordingEnabled(
|
||||||
|
"security.ui.certerror",
|
||||||
|
enableCertErrorUITelemetry
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ async function resetTelemetry() {
|
|||||||
).content;
|
).content;
|
||||||
return !events || !events.length;
|
return !events || !events.length;
|
||||||
});
|
});
|
||||||
|
Services.telemetry.setEventRecordingEnabled("security.ui.tlserror", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkTelemetry(errorString, nssError) {
|
async function checkTelemetry(errorString, nssError) {
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ async function verifyError(url, fallbackWarning, testName) {
|
|||||||
).content;
|
).content;
|
||||||
return !events || !events.length;
|
return !events || !events.length;
|
||||||
});
|
});
|
||||||
|
Services.telemetry.setEventRecordingEnabled("security.doh.neterror", true);
|
||||||
|
|
||||||
let browser;
|
let browser;
|
||||||
let pageLoaded;
|
let pageLoaded;
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ add_task(async function TRROnlyExceptionButtonTelemetry() {
|
|||||||
).content;
|
).content;
|
||||||
return !events || !events.length;
|
return !events || !events.length;
|
||||||
});
|
});
|
||||||
|
Services.telemetry.setEventRecordingEnabled("security.doh.neterror", true);
|
||||||
|
|
||||||
let browser = await loadErrorPage();
|
let browser = await loadErrorPage();
|
||||||
|
|
||||||
|
|||||||
@@ -1346,6 +1346,10 @@ nsDefaultCommandLineHandler.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (notificationData?.privilegedName) {
|
if (notificationData?.privilegedName) {
|
||||||
|
Services.telemetry.setEventRecordingEnabled(
|
||||||
|
"browser.launched_to_handle",
|
||||||
|
true
|
||||||
|
);
|
||||||
Glean.browserLaunchedToHandle.systemNotification.record({
|
Glean.browserLaunchedToHandle.systemNotification.record({
|
||||||
name: notificationData.privilegedName,
|
name: notificationData.privilegedName,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1361,6 +1361,10 @@ BrowserGlue.prototype = {
|
|||||||
// If we don't start with last profile, the user
|
// If we don't start with last profile, the user
|
||||||
// likely sees the profile selector on launch.
|
// likely sees the profile selector on launch.
|
||||||
if (Services.prefs.getBoolPref(launchOnLoginPref)) {
|
if (Services.prefs.getBoolPref(launchOnLoginPref)) {
|
||||||
|
Services.telemetry.setEventRecordingEnabled(
|
||||||
|
"launch_on_login",
|
||||||
|
true
|
||||||
|
);
|
||||||
Glean.launchOnLogin.lastProfileDisableStartup.record();
|
Glean.launchOnLogin.lastProfileDisableStartup.record();
|
||||||
}
|
}
|
||||||
Services.prefs.setBoolPref(launchOnLoginPref, false);
|
Services.prefs.setBoolPref(launchOnLoginPref, false);
|
||||||
@@ -1946,6 +1950,13 @@ BrowserGlue.prototype = {
|
|||||||
|
|
||||||
lazy.NewTabUtils.init();
|
lazy.NewTabUtils.init();
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled(
|
||||||
|
"security.ui.protections",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("security.doh.neterror", true);
|
||||||
|
|
||||||
lazy.PageActions.init();
|
lazy.PageActions.init();
|
||||||
|
|
||||||
lazy.DoHController.init();
|
lazy.DoHController.init();
|
||||||
@@ -2088,6 +2099,13 @@ BrowserGlue.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_recordContentBlockingTelemetry() {
|
_recordContentBlockingTelemetry() {
|
||||||
|
Services.telemetry.setEventRecordingEnabled(
|
||||||
|
"security.ui.protectionspopup",
|
||||||
|
Services.prefs.getBoolPref(
|
||||||
|
"security.protectionspopup.recordEventTelemetry"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
let tpEnabled = Services.prefs.getBoolPref(
|
let tpEnabled = Services.prefs.getBoolPref(
|
||||||
"privacy.trackingprotection.enabled"
|
"privacy.trackingprotection.enabled"
|
||||||
);
|
);
|
||||||
@@ -2598,6 +2616,24 @@ BrowserGlue.prototype = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "enableCertErrorUITelemetry",
|
||||||
|
task: () => {
|
||||||
|
let enableCertErrorUITelemetry = Services.prefs.getBoolPref(
|
||||||
|
"security.certerrors.recordEventTelemetry",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
Services.telemetry.setEventRecordingEnabled(
|
||||||
|
"security.ui.certerror",
|
||||||
|
enableCertErrorUITelemetry
|
||||||
|
);
|
||||||
|
Services.telemetry.setEventRecordingEnabled(
|
||||||
|
"security.ui.tlserror",
|
||||||
|
enableCertErrorUITelemetry
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
// Load the Login Manager data from disk off the main thread, some time
|
// Load the Login Manager data from disk off the main thread, some time
|
||||||
// after startup. If the data is required before this runs, for example
|
// after startup. If the data is required before this runs, for example
|
||||||
// because a restored page contains a password field, it will be loaded on
|
// because a restored page contains a password field, it will be loaded on
|
||||||
@@ -4711,6 +4747,7 @@ BrowserGlue.prototype = {
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
// Record why the dialog is showing or not.
|
// Record why the dialog is showing or not.
|
||||||
|
Services.telemetry.setEventRecordingEnabled("upgrade_dialog", true);
|
||||||
Glean.upgradeDialog.triggerReason.record({
|
Glean.upgradeDialog.triggerReason.record({
|
||||||
value: dialogReason || "satisfied",
|
value: dialogReason || "satisfied",
|
||||||
});
|
});
|
||||||
@@ -5174,6 +5211,12 @@ BrowserGlue.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_collectTelemetryPiPEnabled() {
|
_collectTelemetryPiPEnabled() {
|
||||||
|
Services.telemetry.setEventRecordingEnabled(
|
||||||
|
"pictureinpicture.settings",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
Services.telemetry.setEventRecordingEnabled("pictureinpicture", true);
|
||||||
|
|
||||||
const TOGGLE_ENABLED_PREF =
|
const TOGGLE_ENABLED_PREF =
|
||||||
"media.videocontrols.picture-in-picture.video-toggle.enabled";
|
"media.videocontrols.picture-in-picture.video-toggle.enabled";
|
||||||
|
|
||||||
|
|||||||
@@ -416,6 +416,7 @@ const TEST_GLOBAL = {
|
|||||||
notifyObservers() {},
|
notifyObservers() {},
|
||||||
},
|
},
|
||||||
telemetry: {
|
telemetry: {
|
||||||
|
setEventRecordingEnabled: () => {},
|
||||||
recordEvent: _eventDetails => {},
|
recordEvent: _eventDetails => {},
|
||||||
scalarSet: () => {},
|
scalarSet: () => {},
|
||||||
keyedScalarAdd: () => {},
|
keyedScalarAdd: () => {},
|
||||||
|
|||||||
@@ -689,6 +689,7 @@ export class _ASRouter {
|
|||||||
this._onExperimentEnrollmentsUpdated =
|
this._onExperimentEnrollmentsUpdated =
|
||||||
this._onExperimentEnrollmentsUpdated.bind(this);
|
this._onExperimentEnrollmentsUpdated.bind(this);
|
||||||
this.forcePBWindow = this.forcePBWindow.bind(this);
|
this.forcePBWindow = this.forcePBWindow.bind(this);
|
||||||
|
Services.telemetry.setEventRecordingEnabled("messaging_experiments", true);
|
||||||
this.messagesEnabledInAutomation = [];
|
this.messagesEnabledInAutomation = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -424,6 +424,7 @@ const TEST_GLOBAL = {
|
|||||||
notifyObservers() {},
|
notifyObservers() {},
|
||||||
},
|
},
|
||||||
telemetry: {
|
telemetry: {
|
||||||
|
setEventRecordingEnabled: () => {},
|
||||||
scalarSet: () => {},
|
scalarSet: () => {},
|
||||||
keyedScalarAdd: () => {},
|
keyedScalarAdd: () => {},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -110,6 +110,9 @@ const NATIVE_FALLBACK_WARNING_PREF = "network.trr.display_fallback_warning";
|
|||||||
const NATIVE_FALLBACK_WARNING_HEURISTIC_LIST_PREF =
|
const NATIVE_FALLBACK_WARNING_HEURISTIC_LIST_PREF =
|
||||||
"network.trr.fallback_warning_heuristic_list";
|
"network.trr.fallback_warning_heuristic_list";
|
||||||
|
|
||||||
|
const HEURISTICS_TELEMETRY_CATEGORY = "doh";
|
||||||
|
const TRRSELECT_TELEMETRY_CATEGORY = "security.doh.trrPerformance";
|
||||||
|
|
||||||
const kLinkStatusChangedTopic = "network:link-status-changed";
|
const kLinkStatusChangedTopic = "network:link-status-changed";
|
||||||
const kConnectivityTopic = "network:captive-portal-connectivity-changed";
|
const kConnectivityTopic = "network:captive-portal-connectivity-changed";
|
||||||
const kPrefChangedTopic = "nsPref:changed";
|
const kPrefChangedTopic = "nsPref:changed";
|
||||||
@@ -140,6 +143,15 @@ export const DoHController = {
|
|||||||
_heuristicsAreEnabled: false,
|
_heuristicsAreEnabled: false,
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
|
Services.telemetry.setEventRecordingEnabled(
|
||||||
|
HEURISTICS_TELEMETRY_CATEGORY,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
Services.telemetry.setEventRecordingEnabled(
|
||||||
|
TRRSELECT_TELEMETRY_CATEGORY,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
await lazy.DoHConfigController.initComplete;
|
await lazy.DoHConfigController.initComplete;
|
||||||
|
|
||||||
Services.obs.addObserver(this, lazy.DoHConfigController.kConfigUpdateTopic);
|
Services.obs.addObserver(this, lazy.DoHConfigController.kConfigUpdateTopic);
|
||||||
|
|||||||
@@ -15,6 +15,11 @@
|
|||||||
* usable network until a full set of results has been captured. We stop retrying
|
* usable network until a full set of results has been captured. We stop retrying
|
||||||
* after 5 attempts.
|
* after 5 attempts.
|
||||||
*/
|
*/
|
||||||
|
Services.telemetry.setEventRecordingEnabled(
|
||||||
|
"security.doh.trrPerformance",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||||
|
|
||||||
const lazy = {};
|
const lazy = {};
|
||||||
|
|||||||
@@ -43,6 +43,11 @@ let gHasOpenedBefore = false;
|
|||||||
* the associated MigrationWizardChild.
|
* the associated MigrationWizardChild.
|
||||||
*/
|
*/
|
||||||
export class MigrationWizardParent extends JSWindowActorParent {
|
export class MigrationWizardParent extends JSWindowActorParent {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("browser.migration", true);
|
||||||
|
}
|
||||||
|
|
||||||
didDestroy() {
|
didDestroy() {
|
||||||
Services.obs.notifyObservers(this, "MigrationWizard:Destroyed");
|
Services.obs.notifyObservers(this, "MigrationWizard:Destroyed");
|
||||||
MigrationUtils.finishMigration();
|
MigrationUtils.finishMigration();
|
||||||
|
|||||||
@@ -1499,6 +1499,11 @@ export class TelemetryFeed {
|
|||||||
// init has finished setting up the observer
|
// init has finished setting up the observer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only uninit if the getter has initialized it
|
||||||
|
if (Object.prototype.hasOwnProperty.call(this, "utEvents")) {
|
||||||
|
this.utEvents.uninit();
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Send any unfinished sessions
|
// TODO: Send any unfinished sessions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ const EXTRAS_FIELD_NAMES = [
|
|||||||
|
|
||||||
export class UTEventReporting {
|
export class UTEventReporting {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
Services.telemetry.setEventRecordingEnabled("activity_stream", true);
|
||||||
this.sendUserEvent = this.sendUserEvent.bind(this);
|
this.sendUserEvent = this.sendUserEvent.bind(this);
|
||||||
this.sendSessionEndEvent = this.sendSessionEndEvent.bind(this);
|
this.sendSessionEndEvent = this.sendSessionEndEvent.bind(this);
|
||||||
}
|
}
|
||||||
@@ -47,4 +48,8 @@ export class UTEventReporting {
|
|||||||
this._createExtras(data, data.session_duration)
|
this._createExtras(data, data.session_duration)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uninit() {
|
||||||
|
Services.telemetry.setEventRecordingEnabled("activity_stream", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ describe("UTEventReporting", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
globals = new GlobalOverrider();
|
globals = new GlobalOverrider();
|
||||||
sandbox = globals.sandbox;
|
sandbox = globals.sandbox;
|
||||||
|
sandbox.stub(global.Services.telemetry, "setEventRecordingEnabled");
|
||||||
|
|
||||||
utEvents = new UTEventReporting();
|
utEvents = new UTEventReporting();
|
||||||
});
|
});
|
||||||
@@ -83,4 +84,27 @@ describe("UTEventReporting", () => {
|
|||||||
assert.validate(ping, UTSessionPing);
|
assert.validate(ping, UTSessionPing);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("#uninit()", () => {
|
||||||
|
it("should call setEventRecordingEnabled with a false value", () => {
|
||||||
|
assert.equal(
|
||||||
|
global.Services.telemetry.setEventRecordingEnabled.firstCall.args[0],
|
||||||
|
"activity_stream"
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
global.Services.telemetry.setEventRecordingEnabled.firstCall.args[1],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
utEvents.uninit();
|
||||||
|
assert.equal(
|
||||||
|
global.Services.telemetry.setEventRecordingEnabled.secondCall.args[0],
|
||||||
|
"activity_stream"
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
global.Services.telemetry.setEventRecordingEnabled.secondCall.args[1],
|
||||||
|
false
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -394,6 +394,7 @@ const TEST_GLOBAL = {
|
|||||||
notifyObservers() {},
|
notifyObservers() {},
|
||||||
},
|
},
|
||||||
telemetry: {
|
telemetry: {
|
||||||
|
setEventRecordingEnabled: () => {},
|
||||||
recordEvent: _eventDetails => {},
|
recordEvent: _eventDetails => {},
|
||||||
scalarSet: () => {},
|
scalarSet: () => {},
|
||||||
keyedScalarAdd: () => {},
|
keyedScalarAdd: () => {},
|
||||||
|
|||||||
@@ -1575,6 +1575,20 @@ add_task(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
add_task(async function test_uninit_calls_utEvents_uninit() {
|
||||||
|
info("TelemetryFeed.uninit should call .utEvents.uninit");
|
||||||
|
let sandbox = sinon.createSandbox();
|
||||||
|
let instance = new TelemetryFeed();
|
||||||
|
sandbox.stub(instance.utEvents, "uninit");
|
||||||
|
|
||||||
|
instance.uninit();
|
||||||
|
Assert.ok(
|
||||||
|
instance.utEvents.uninit.calledOnce,
|
||||||
|
"TelemetryFeed.utEvents.uninit should be called"
|
||||||
|
);
|
||||||
|
sandbox.restore();
|
||||||
|
});
|
||||||
|
|
||||||
add_task(async function test_uninit_deregisters_observer() {
|
add_task(async function test_uninit_deregisters_observer() {
|
||||||
info(
|
info(
|
||||||
"TelemetryFeed.uninit should make this.browserOpenNewtabStart() stop " +
|
"TelemetryFeed.uninit should make this.browserOpenNewtabStart() stop " +
|
||||||
|
|||||||
@@ -1397,6 +1397,12 @@ var gMainPane = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
initPrimaryBrowserLanguageUI() {
|
initPrimaryBrowserLanguageUI() {
|
||||||
|
// Enable telemetry.
|
||||||
|
Services.telemetry.setEventRecordingEnabled(
|
||||||
|
"intl.ui.browserLanguage",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
// This will register the "command" listener.
|
// This will register the "command" listener.
|
||||||
let menulist = document.getElementById("primaryBrowserLocale");
|
let menulist = document.getElementById("primaryBrowserLocale");
|
||||||
new SelectionChangedMenulist(menulist, event => {
|
new SelectionChangedMenulist(menulist, event => {
|
||||||
|
|||||||
@@ -191,6 +191,7 @@ function init_all() {
|
|||||||
// Asks Preferences to queue an update of the attribute values of
|
// Asks Preferences to queue an update of the attribute values of
|
||||||
// the entire document.
|
// the entire document.
|
||||||
Preferences.queueUpdateOfAllElements();
|
Preferences.queueUpdateOfAllElements();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("aboutpreferences", true);
|
||||||
|
|
||||||
register_module("paneGeneral", gMainPane);
|
register_module("paneGeneral", gMainPane);
|
||||||
register_module("paneHome", gHomePane);
|
register_module("paneHome", gHomePane);
|
||||||
|
|||||||
@@ -882,6 +882,8 @@ var gPrivacyPane = {
|
|||||||
* Init DoH corresponding prefs
|
* Init DoH corresponding prefs
|
||||||
*/
|
*/
|
||||||
initDoH() {
|
initDoH() {
|
||||||
|
Services.telemetry.setEventRecordingEnabled("security.doh.settings", true);
|
||||||
|
|
||||||
setEventListener("dohDefaultArrow", "command", this.toggleExpansion);
|
setEventListener("dohDefaultArrow", "command", this.toggleExpansion);
|
||||||
setEventListener("dohEnabledArrow", "command", this.toggleExpansion);
|
setEventListener("dohEnabledArrow", "command", this.toggleExpansion);
|
||||||
setEventListener("dohStrictArrow", "command", this.toggleExpansion);
|
setEventListener("dohStrictArrow", "command", this.toggleExpansion);
|
||||||
@@ -990,6 +992,10 @@ var gPrivacyPane = {
|
|||||||
this._initTrackingProtectionExtensionControl();
|
this._initTrackingProtectionExtensionControl();
|
||||||
this._initThirdPartyCertsToggle();
|
this._initThirdPartyCertsToggle();
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("privacy.ui.fpp", true);
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("pwmgr", true);
|
||||||
|
|
||||||
Preferences.get("privacy.trackingprotection.enabled").on(
|
Preferences.get("privacy.trackingprotection.enabled").on(
|
||||||
"change",
|
"change",
|
||||||
gPrivacyPane.trackingProtectionReadPrefs.bind(gPrivacyPane)
|
gPrivacyPane.trackingProtectionReadPrefs.bind(gPrivacyPane)
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ add_task(async function testwhenPrefDisabled() {
|
|||||||
|
|
||||||
add_task(async function test_aboutpreferences_event_telemetry() {
|
add_task(async function test_aboutpreferences_event_telemetry() {
|
||||||
Services.telemetry.clearEvents();
|
Services.telemetry.clearEvents();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("aboutpreferences", true);
|
||||||
|
|
||||||
await SpecialPowers.pushPrefEnv({
|
await SpecialPowers.pushPrefEnv({
|
||||||
set: [["browser.preferences.moreFromMozilla", true]],
|
set: [["browser.preferences.moreFromMozilla", true]],
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ add_task(async function checkTelemetryLoadEvents() {
|
|||||||
return !events || !events.length;
|
return !events || !events.length;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("security.ui.protections", true);
|
||||||
|
|
||||||
let tab = await BrowserTestUtils.openNewForegroundTab({
|
let tab = await BrowserTestUtils.openNewForegroundTab({
|
||||||
url: "about:protections",
|
url: "about:protections",
|
||||||
gBrowser,
|
gBrowser,
|
||||||
@@ -197,6 +199,8 @@ add_task(async function checkTelemetryClickEvents() {
|
|||||||
return !events || !events.length;
|
return !events || !events.length;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("security.ui.protections", true);
|
||||||
|
|
||||||
let tab = await BrowserTestUtils.openNewForegroundTab({
|
let tab = await BrowserTestUtils.openNewForegroundTab({
|
||||||
url: "about:protections",
|
url: "about:protections",
|
||||||
gBrowser,
|
gBrowser,
|
||||||
@@ -800,6 +804,8 @@ add_task(async function checkTelemetryLoadEventForEntrypoint() {
|
|||||||
return !events || !events.length;
|
return !events || !events.length;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("security.ui.protections", true);
|
||||||
|
|
||||||
info("Typo in 'entrypoint' should not be recorded");
|
info("Typo in 'entrypoint' should not be recorded");
|
||||||
let tab = await BrowserTestUtils.openNewForegroundTab({
|
let tab = await BrowserTestUtils.openNewForegroundTab({
|
||||||
url: "about:protections?entryPoint=newPage",
|
url: "about:protections?entryPoint=newPage",
|
||||||
@@ -882,6 +888,8 @@ add_task(async function checkTelemetryClickEventsVPN() {
|
|||||||
).content;
|
).content;
|
||||||
return !events || !events.length;
|
return !events || !events.length;
|
||||||
});
|
});
|
||||||
|
Services.telemetry.setEventRecordingEnabled("security.ui.protections", true);
|
||||||
|
|
||||||
// user is not subscribed to VPN, and is in the us
|
// user is not subscribed to VPN, and is in the us
|
||||||
AboutProtectionsParent.setTestOverride(getVPNOverrides(false, "us"));
|
AboutProtectionsParent.setTestOverride(getVPNOverrides(false, "us"));
|
||||||
await SpecialPowers.pushPrefEnv({
|
await SpecialPowers.pushPrefEnv({
|
||||||
@@ -1047,6 +1055,7 @@ add_task(async function checkTelemetryEventsVPNBanner() {
|
|||||||
return !events || !events.length;
|
return !events || !events.length;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("security.ui.protections", true);
|
||||||
// User is not subscribed to VPN
|
// User is not subscribed to VPN
|
||||||
AboutProtectionsParent.setTestOverride(getVPNOverrides(false, "us"));
|
AboutProtectionsParent.setTestOverride(getVPNOverrides(false, "us"));
|
||||||
|
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ export var ScreenshotsUtils = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.resetMethodsUsed();
|
this.resetMethodsUsed();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("screenshots", true);
|
||||||
Services.obs.addObserver(this, "menuitem-screenshot");
|
Services.obs.addObserver(this, "menuitem-screenshot");
|
||||||
this.initialized = true;
|
this.initialized = true;
|
||||||
if (Cu.isInAutomation) {
|
if (Cu.isInAutomation) {
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ var SessionFileInternal = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async _readInternal(useOldExtension) {
|
async _readInternal(useOldExtension) {
|
||||||
|
Services.telemetry.setEventRecordingEnabled("session_restore", true);
|
||||||
let result;
|
let result;
|
||||||
let noFilesFound = true;
|
let noFilesFound = true;
|
||||||
this._usingOldExtension = useOldExtension;
|
this._usingOldExtension = useOldExtension;
|
||||||
|
|||||||
@@ -87,6 +87,9 @@ add_setup(async function () {
|
|||||||
let oldCanRecord = Services.telemetry.canRecordExtended;
|
let oldCanRecord = Services.telemetry.canRecordExtended;
|
||||||
Services.telemetry.canRecordExtended = true;
|
Services.telemetry.canRecordExtended = true;
|
||||||
|
|
||||||
|
// Enable event recording for the events tested here.
|
||||||
|
Services.telemetry.setEventRecordingEnabled("navigation", true);
|
||||||
|
|
||||||
// Clear history so that history added by previous tests doesn't mess up this
|
// Clear history so that history added by previous tests doesn't mess up this
|
||||||
// test when it selects results in the urlbar.
|
// test when it selects results in the urlbar.
|
||||||
await PlacesUtils.history.clear();
|
await PlacesUtils.history.clear();
|
||||||
@@ -97,6 +100,7 @@ add_setup(async function () {
|
|||||||
Services.telemetry.canRecordExtended = oldCanRecord;
|
Services.telemetry.canRecordExtended = oldCanRecord;
|
||||||
await PlacesUtils.history.clear();
|
await PlacesUtils.history.clear();
|
||||||
await PlacesUtils.bookmarks.eraseEverything();
|
await PlacesUtils.bookmarks.eraseEverything();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("navigation", false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -28,10 +28,14 @@ add_setup(async () => {
|
|||||||
let cleanup = await installPersistTestEngines();
|
let cleanup = await installPersistTestEngines();
|
||||||
testEngine = Services.search.getEngineByName("Example");
|
testEngine = Services.search.getEngineByName("Example");
|
||||||
|
|
||||||
|
// Enable event recording for the events.
|
||||||
|
Services.telemetry.setEventRecordingEnabled("navigation", true);
|
||||||
|
|
||||||
registerCleanupFunction(async function () {
|
registerCleanupFunction(async function () {
|
||||||
await PlacesUtils.history.clear();
|
await PlacesUtils.history.clear();
|
||||||
Services.telemetry.clearScalars();
|
Services.telemetry.clearScalars();
|
||||||
Services.telemetry.clearEvents();
|
Services.telemetry.clearEvents();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("navigation", false);
|
||||||
cleanup();
|
cleanup();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -102,6 +102,9 @@ add_setup(async function () {
|
|||||||
let oldCanRecord = Services.telemetry.canRecordExtended;
|
let oldCanRecord = Services.telemetry.canRecordExtended;
|
||||||
Services.telemetry.canRecordExtended = true;
|
Services.telemetry.canRecordExtended = true;
|
||||||
|
|
||||||
|
// Enable event recording for the events tested here.
|
||||||
|
Services.telemetry.setEventRecordingEnabled("navigation", true);
|
||||||
|
|
||||||
// Clear history so that history added by previous tests doesn't mess up this
|
// Clear history so that history added by previous tests doesn't mess up this
|
||||||
// test when it selects results in the urlbar.
|
// test when it selects results in the urlbar.
|
||||||
await PlacesUtils.history.clear();
|
await PlacesUtils.history.clear();
|
||||||
@@ -118,6 +121,7 @@ add_setup(async function () {
|
|||||||
Services.telemetry.canRecordExtended = oldCanRecord;
|
Services.telemetry.canRecordExtended = oldCanRecord;
|
||||||
await PlacesUtils.history.clear();
|
await PlacesUtils.history.clear();
|
||||||
await PlacesUtils.bookmarks.eraseEverything();
|
await PlacesUtils.bookmarks.eraseEverything();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("navigation", false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ add_setup(async function () {
|
|||||||
let oldCanRecord = Services.telemetry.canRecordExtended;
|
let oldCanRecord = Services.telemetry.canRecordExtended;
|
||||||
Services.telemetry.canRecordExtended = true;
|
Services.telemetry.canRecordExtended = true;
|
||||||
|
|
||||||
|
// Enable event recording for the events tested here.
|
||||||
|
Services.telemetry.setEventRecordingEnabled("navigation", true);
|
||||||
|
|
||||||
// Clear history so that history added by previous tests doesn't mess up this
|
// Clear history so that history added by previous tests doesn't mess up this
|
||||||
// test when it selects results in the urlbar.
|
// test when it selects results in the urlbar.
|
||||||
await PlacesUtils.history.clear();
|
await PlacesUtils.history.clear();
|
||||||
@@ -146,6 +149,7 @@ add_setup(async function () {
|
|||||||
Services.telemetry.canRecordExtended = oldCanRecord;
|
Services.telemetry.canRecordExtended = oldCanRecord;
|
||||||
await PlacesUtils.history.clear();
|
await PlacesUtils.history.clear();
|
||||||
await PlacesUtils.bookmarks.eraseEverything();
|
await PlacesUtils.bookmarks.eraseEverything();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("navigation", false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ add_setup(async function () {
|
|||||||
registerCleanupFunction(async function () {
|
registerCleanupFunction(async function () {
|
||||||
Services.telemetry.canRecordExtended = oldCanRecord;
|
Services.telemetry.canRecordExtended = oldCanRecord;
|
||||||
await PlacesUtils.history.clear();
|
await PlacesUtils.history.clear();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("navigation", false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -292,6 +292,7 @@ add_task(async function test_remote_tab_result() {
|
|||||||
SyncedTabs._internal = originalSyncedTabsInternal;
|
SyncedTabs._internal = originalSyncedTabsInternal;
|
||||||
await PlacesUtils.history.clear();
|
await PlacesUtils.history.clear();
|
||||||
await PlacesUtils.bookmarks.eraseEverything();
|
await PlacesUtils.bookmarks.eraseEverything();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("navigation", false);
|
||||||
});
|
});
|
||||||
|
|
||||||
await BrowserTestUtils.withNewTab({ gBrowser }, async () => {
|
await BrowserTestUtils.withNewTab({ gBrowser }, async () => {
|
||||||
|
|||||||
@@ -264,8 +264,14 @@ add_setup(async function () {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled(EVENT_CATEGORY, true);
|
||||||
|
|
||||||
Services.telemetry.clearEvents();
|
Services.telemetry.clearEvents();
|
||||||
Services.telemetry.clearScalars();
|
Services.telemetry.clearScalars();
|
||||||
|
|
||||||
|
registerCleanupFunction(() => {
|
||||||
|
Services.telemetry.setEventRecordingEnabled(EVENT_CATEGORY, false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_popup_opened() {
|
add_task(async function test_popup_opened() {
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ function assertGleanTelemetry(events, expected_number_of_flowid = 1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
add_setup(async function () {
|
add_setup(async function () {
|
||||||
|
Services.telemetry.setEventRecordingEnabled("creditcard", true);
|
||||||
|
registerCleanupFunction(async function () {
|
||||||
|
Services.telemetry.setEventRecordingEnabled("creditcard", false);
|
||||||
|
});
|
||||||
await clearGleanTelemetry();
|
await clearGleanTelemetry();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -191,6 +191,10 @@ async function openTabAndUseCreditCard(
|
|||||||
}
|
}
|
||||||
|
|
||||||
add_setup(async function () {
|
add_setup(async function () {
|
||||||
|
Services.telemetry.setEventRecordingEnabled("creditcard", true);
|
||||||
|
registerCleanupFunction(async function () {
|
||||||
|
Services.telemetry.setEventRecordingEnabled("creditcard", false);
|
||||||
|
});
|
||||||
await clearGleanTelemetry();
|
await clearGleanTelemetry();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ const SEARCH_TOPIC_ENGINE_MODIFIED = "browser-search-engine-modified";
|
|||||||
|
|
||||||
this.addonsSearchDetection = class extends ExtensionAPI {
|
this.addonsSearchDetection = class extends ExtensionAPI {
|
||||||
getAPI(context) {
|
getAPI(context) {
|
||||||
|
Services.telemetry.setEventRecordingEnabled("addonsSearchDetection", true);
|
||||||
const { extension } = context;
|
const { extension } = context;
|
||||||
|
|
||||||
// We want to temporarily store the first monitored URLs that have been
|
// We want to temporarily store the first monitored URLs that have been
|
||||||
|
|||||||
@@ -1567,6 +1567,7 @@ export let BrowserUsageTelemetry = {
|
|||||||
let { installer_type, extra } = data;
|
let { installer_type, extra } = data;
|
||||||
|
|
||||||
// Record the event (mirrored to legacy telemetry using GIFFT)
|
// Record the event (mirrored to legacy telemetry using GIFFT)
|
||||||
|
Services.telemetry.setEventRecordingEnabled("installation", true);
|
||||||
if (installer_type == "full") {
|
if (installer_type == "full") {
|
||||||
Glean.installation.firstSeenFull.record(extra);
|
Glean.installation.firstSeenFull.record(extra);
|
||||||
} else if (installer_type == "stub") {
|
} else if (installer_type == "stub") {
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ export let HomePage = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("homepage", true);
|
||||||
|
|
||||||
// Now we have the values, listen for future updates.
|
// Now we have the values, listen for future updates.
|
||||||
this._ignoreListListener = this._handleIgnoreListUpdated.bind(this);
|
this._ignoreListListener = this._handleIgnoreListUpdated.bind(this);
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ export var PartnerLinkAttribution = {
|
|||||||
async makeRequest({ targetURL, source, campaignID }) {
|
async makeRequest({ targetURL, source, campaignID }) {
|
||||||
let partner = targetURL.match(/^https?:\/\/(?:www.)?([^.]*)/)[1];
|
let partner = targetURL.match(/^https?:\/\/(?:www.)?([^.]*)/)[1];
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("partner_link", true);
|
||||||
let extra = { value: partner };
|
let extra = { value: partner };
|
||||||
if (source == "newtab") {
|
if (source == "newtab") {
|
||||||
Glean.partnerLink.clickNewtab.record(extra);
|
Glean.partnerLink.clickNewtab.record(extra);
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ export var ProcessHangMonitor = {
|
|||||||
Services.obs.addObserver(this, "quit-application-granted");
|
Services.obs.addObserver(this, "quit-application-granted");
|
||||||
Services.obs.addObserver(this, "xpcom-shutdown");
|
Services.obs.addObserver(this, "xpcom-shutdown");
|
||||||
Services.ww.registerNotification(this);
|
Services.ww.registerNotification(this);
|
||||||
|
Services.telemetry.setEventRecordingEnabled("slow_script_warning", true);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ function DevTools() {
|
|||||||
|
|
||||||
EventEmitter.decorate(this);
|
EventEmitter.decorate(this);
|
||||||
this._telemetry = new Telemetry();
|
this._telemetry = new Telemetry();
|
||||||
|
this._telemetry.setEventRecordingEnabled(true);
|
||||||
|
|
||||||
// List of all commands of debugged local Web Extension.
|
// List of all commands of debugged local Web Extension.
|
||||||
this._commandsPromiseByWebExtId = new Map(); // Map<extensionId, commands>
|
this._commandsPromiseByWebExtId = new Map(); // Map<extensionId, commands>
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ const { TelemetryEnvironment } = ChromeUtils.importESModule(
|
|||||||
);
|
);
|
||||||
const WeakMapMap = require("resource://devtools/client/shared/WeakMapMap.js");
|
const WeakMapMap = require("resource://devtools/client/shared/WeakMapMap.js");
|
||||||
|
|
||||||
|
const CATEGORY = "devtools.main";
|
||||||
|
|
||||||
// Object to be shared among all instances.
|
// Object to be shared among all instances.
|
||||||
const PENDING_EVENT_PROPERTIES = new WeakMapMap();
|
const PENDING_EVENT_PROPERTIES = new WeakMapMap();
|
||||||
const PENDING_EVENTS = new WeakMapMap();
|
const PENDING_EVENTS = new WeakMapMap();
|
||||||
@@ -48,6 +50,7 @@ class Telemetry {
|
|||||||
this.keyedScalarAdd = this.keyedScalarAdd.bind(this);
|
this.keyedScalarAdd = this.keyedScalarAdd.bind(this);
|
||||||
this.keyedScalarSet = this.keyedScalarSet.bind(this);
|
this.keyedScalarSet = this.keyedScalarSet.bind(this);
|
||||||
this.recordEvent = this.recordEvent.bind(this);
|
this.recordEvent = this.recordEvent.bind(this);
|
||||||
|
this.setEventRecordingEnabled = this.setEventRecordingEnabled.bind(this);
|
||||||
this.preparePendingEvent = this.preparePendingEvent.bind(this);
|
this.preparePendingEvent = this.preparePendingEvent.bind(this);
|
||||||
this.addEventProperty = this.addEventProperty.bind(this);
|
this.addEventProperty = this.addEventProperty.bind(this);
|
||||||
this.addEventProperties = this.addEventProperties.bind(this);
|
this.addEventProperties = this.addEventProperties.bind(this);
|
||||||
@@ -386,6 +389,17 @@ class Telemetry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event telemetry is disabled by default. Use this method to enable or
|
||||||
|
* disable it.
|
||||||
|
*
|
||||||
|
* @param {Boolean} enabled
|
||||||
|
* Enabled: true or false.
|
||||||
|
*/
|
||||||
|
setEventRecordingEnabled(enabled) {
|
||||||
|
return Services.telemetry.setEventRecordingEnabled(CATEGORY, enabled);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Telemetry events often need to make use of a number of properties from
|
* Telemetry events often need to make use of a number of properties from
|
||||||
* completely different codepaths. To make this possible we create a
|
* completely different codepaths. To make this possible we create a
|
||||||
|
|||||||
@@ -239,6 +239,9 @@ this._telemetry = new Telemetry();
|
|||||||
And use the instance to report e.g. tool opening...
|
And use the instance to report e.g. tool opening...
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
// Event telemetry is disabled by default so enable it for your category.
|
||||||
|
this._telemetry.setEventRecordingEnabled(true);
|
||||||
|
|
||||||
// If you already have all the properties for the event you can send the
|
// If you already have all the properties for the event you can send the
|
||||||
// telemetry event using:
|
// telemetry event using:
|
||||||
// this._telemetry.recordEvent(method, object, value, extra) e.g.
|
// this._telemetry.recordEvent(method, object, value, extra) e.g.
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ export const DevToolsShim = {
|
|||||||
get telemetry() {
|
get telemetry() {
|
||||||
if (!this._telemetry) {
|
if (!this._telemetry) {
|
||||||
this._telemetry = new lazy.Telemetry();
|
this._telemetry = new lazy.Telemetry();
|
||||||
|
this._telemetry.setEventRecordingEnabled(true);
|
||||||
}
|
}
|
||||||
return this._telemetry;
|
return this._telemetry;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -330,6 +330,7 @@ DevToolsStartup.prototype = {
|
|||||||
get telemetry() {
|
get telemetry() {
|
||||||
if (!this._telemetry) {
|
if (!this._telemetry) {
|
||||||
this._telemetry = new lazy.Telemetry();
|
this._telemetry = new lazy.Telemetry();
|
||||||
|
this._telemetry.setEventRecordingEnabled(true);
|
||||||
}
|
}
|
||||||
return this._telemetry;
|
return this._telemetry;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -166,6 +166,7 @@
|
|||||||
#include "mozilla/net/CookieKey.h"
|
#include "mozilla/net/CookieKey.h"
|
||||||
#include "mozilla/net/TRRService.h"
|
#include "mozilla/net/TRRService.h"
|
||||||
#include "mozilla/TelemetryComms.h"
|
#include "mozilla/TelemetryComms.h"
|
||||||
|
#include "mozilla/TelemetryEventEnums.h"
|
||||||
#include "mozilla/RemoteLazyInputStreamParent.h"
|
#include "mozilla/RemoteLazyInputStreamParent.h"
|
||||||
#include "mozilla/widget/RemoteLookAndFeel.h"
|
#include "mozilla/widget/RemoteLookAndFeel.h"
|
||||||
#include "mozilla/widget/ScreenManager.h"
|
#include "mozilla/widget/ScreenManager.h"
|
||||||
@@ -1203,9 +1204,17 @@ IPCResult ContentParent::RecvAttributionConversion(
|
|||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Atomic<bool, mozilla::Relaxed> sContentParentTelemetryEventEnabled(false);
|
||||||
|
|
||||||
/*static*/
|
/*static*/
|
||||||
void ContentParent::LogAndAssertFailedPrincipalValidationInfo(
|
void ContentParent::LogAndAssertFailedPrincipalValidationInfo(
|
||||||
nsIPrincipal* aPrincipal, const char* aMethod) {
|
nsIPrincipal* aPrincipal, const char* aMethod) {
|
||||||
|
// nsContentSecurityManager may also enable this same event, but that's okay
|
||||||
|
if (!sContentParentTelemetryEventEnabled.exchange(true)) {
|
||||||
|
sContentParentTelemetryEventEnabled = true;
|
||||||
|
Telemetry::SetEventRecordingEnabled("security"_ns, true);
|
||||||
|
}
|
||||||
|
|
||||||
// Send Telemetry
|
// Send Telemetry
|
||||||
nsAutoCString principalScheme, principalType, spec;
|
nsAutoCString principalScheme, principalType, spec;
|
||||||
mozilla::glean::security::FissionPrincipalsExtra extra = {};
|
mozilla::glean::security::FissionPrincipalsExtra extra = {};
|
||||||
|
|||||||
@@ -1510,6 +1510,8 @@ QuotaManager::Observer::Observe(nsISupports* aSubject, const char* aTopic,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Telemetry::SetEventRecordingEnabled("dom.quota.try"_ns, true);
|
||||||
|
|
||||||
gBasePath = new nsString();
|
gBasePath = new nsString();
|
||||||
|
|
||||||
nsCOMPtr<nsIFile> baseDir;
|
nsCOMPtr<nsIFile> baseDir;
|
||||||
@@ -1596,6 +1598,8 @@ QuotaManager::Observer::Observe(nsISupports* aSubject, const char* aTopic,
|
|||||||
|
|
||||||
gBuildId = nullptr;
|
gBuildId = nullptr;
|
||||||
|
|
||||||
|
Telemetry::SetEventRecordingEnabled("dom.quota.try"_ns, false);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/StaticPrefs_dom.h"
|
#include "mozilla/StaticPrefs_dom.h"
|
||||||
#include "mozilla/StaticPrefs_security.h"
|
#include "mozilla/StaticPrefs_security.h"
|
||||||
|
#include "mozilla/Telemetry.h"
|
||||||
#include "xpcpublic.h"
|
#include "xpcpublic.h"
|
||||||
#include "nsMimeTypes.h"
|
#include "nsMimeTypes.h"
|
||||||
|
|
||||||
@@ -56,6 +57,7 @@
|
|||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
using namespace mozilla::Telemetry;
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(nsContentSecurityManager, nsIContentSecurityManager,
|
NS_IMPL_ISUPPORTS(nsContentSecurityManager, nsIContentSecurityManager,
|
||||||
nsIChannelEventSink)
|
nsIChannelEventSink)
|
||||||
@@ -69,6 +71,7 @@ Atomic<bool, mozilla::Relaxed> sJSHacksChecked(false);
|
|||||||
Atomic<bool, mozilla::Relaxed> sJSHacksPresent(false);
|
Atomic<bool, mozilla::Relaxed> sJSHacksPresent(false);
|
||||||
Atomic<bool, mozilla::Relaxed> sCSSHacksChecked(false);
|
Atomic<bool, mozilla::Relaxed> sCSSHacksChecked(false);
|
||||||
Atomic<bool, mozilla::Relaxed> sCSSHacksPresent(false);
|
Atomic<bool, mozilla::Relaxed> sCSSHacksPresent(false);
|
||||||
|
Atomic<bool, mozilla::Relaxed> sTelemetryEventEnabled(false);
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool nsContentSecurityManager::AllowTopLevelNavigationToDataURI(
|
bool nsContentSecurityManager::AllowTopLevelNavigationToDataURI(
|
||||||
@@ -835,6 +838,11 @@ void nsContentSecurityManager::MeasureUnexpectedPrivilegedLoads(
|
|||||||
MOZ_LOG(sCSMLog, LogLevel::Debug,
|
MOZ_LOG(sCSMLog, LogLevel::Debug,
|
||||||
("- redirects: %s\n\n", loggedRedirects.get()));
|
("- redirects: %s\n\n", loggedRedirects.get()));
|
||||||
|
|
||||||
|
// Send Telemetry
|
||||||
|
if (!sTelemetryEventEnabled.exchange(true)) {
|
||||||
|
Telemetry::SetEventRecordingEnabled("security"_ns, true);
|
||||||
|
}
|
||||||
|
|
||||||
glean::security::UnexpectedLoadExtra extra = {
|
glean::security::UnexpectedLoadExtra extra = {
|
||||||
.contenttype = Some(loggedContentType),
|
.contenttype = Some(loggedContentType),
|
||||||
.filedetails = Some(loggedFileDetails),
|
.filedetails = Some(loggedFileDetails),
|
||||||
|
|||||||
@@ -45,17 +45,20 @@
|
|||||||
#include "LoadInfo.h"
|
#include "LoadInfo.h"
|
||||||
#include "mozilla/StaticPrefs_extensions.h"
|
#include "mozilla/StaticPrefs_extensions.h"
|
||||||
#include "mozilla/StaticPrefs_dom.h"
|
#include "mozilla/StaticPrefs_dom.h"
|
||||||
|
#include "mozilla/Telemetry.h"
|
||||||
#include "nsIConsoleService.h"
|
#include "nsIConsoleService.h"
|
||||||
#include "nsIStringBundle.h"
|
#include "nsIStringBundle.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
using namespace mozilla::Telemetry;
|
||||||
|
|
||||||
extern mozilla::LazyLogModule sCSMLog;
|
extern mozilla::LazyLogModule sCSMLog;
|
||||||
extern Atomic<bool, mozilla::Relaxed> sJSHacksChecked;
|
extern Atomic<bool, mozilla::Relaxed> sJSHacksChecked;
|
||||||
extern Atomic<bool, mozilla::Relaxed> sJSHacksPresent;
|
extern Atomic<bool, mozilla::Relaxed> sJSHacksPresent;
|
||||||
extern Atomic<bool, mozilla::Relaxed> sCSSHacksChecked;
|
extern Atomic<bool, mozilla::Relaxed> sCSSHacksChecked;
|
||||||
extern Atomic<bool, mozilla::Relaxed> sCSSHacksPresent;
|
extern Atomic<bool, mozilla::Relaxed> sCSSHacksPresent;
|
||||||
|
extern Atomic<bool, mozilla::Relaxed> sTelemetryEventEnabled;
|
||||||
|
|
||||||
// Helper function for IsConsideredSameOriginForUIR which makes
|
// Helper function for IsConsideredSameOriginForUIR which makes
|
||||||
// Principals of scheme 'http' return Principals of scheme 'https'.
|
// Principals of scheme 'http' return Principals of scheme 'https'.
|
||||||
@@ -741,6 +744,10 @@ void nsContentSecurityUtils::NotifyEvalUsage(bool aIsSystemPrincipal,
|
|||||||
uint32_t aColumnNumber) {
|
uint32_t aColumnNumber) {
|
||||||
FilenameTypeAndDetails fileNameTypeAndDetails =
|
FilenameTypeAndDetails fileNameTypeAndDetails =
|
||||||
FilenameToFilenameType(aFileName, false);
|
FilenameToFilenameType(aFileName, false);
|
||||||
|
if (!sTelemetryEventEnabled.exchange(true)) {
|
||||||
|
sTelemetryEventEnabled = true;
|
||||||
|
Telemetry::SetEventRecordingEnabled("security"_ns, true);
|
||||||
|
}
|
||||||
auto fileinfo = fileNameTypeAndDetails.second;
|
auto fileinfo = fileNameTypeAndDetails.second;
|
||||||
auto value = Some(fileNameTypeAndDetails.first);
|
auto value = Some(fileNameTypeAndDetails.first);
|
||||||
if (aIsSystemPrincipal) {
|
if (aIsSystemPrincipal) {
|
||||||
@@ -1567,6 +1574,10 @@ bool nsContentSecurityUtils::ValidateScriptFilename(JSContext* cx,
|
|||||||
FilenameTypeAndDetails fileNameTypeAndDetails =
|
FilenameTypeAndDetails fileNameTypeAndDetails =
|
||||||
FilenameToFilenameType(filename, true);
|
FilenameToFilenameType(filename, true);
|
||||||
|
|
||||||
|
if (!sTelemetryEventEnabled.exchange(true)) {
|
||||||
|
sTelemetryEventEnabled = true;
|
||||||
|
Telemetry::SetEventRecordingEnabled("security"_ns, true);
|
||||||
|
}
|
||||||
glean::security::JavascriptLoadParentProcessExtra extra = {
|
glean::security::JavascriptLoadParentProcessExtra extra = {
|
||||||
.fileinfo = fileNameTypeAndDetails.second,
|
.fileinfo = fileNameTypeAndDetails.second,
|
||||||
.value = Some(fileNameTypeAndDetails.first),
|
.value = Some(fileNameTypeAndDetails.first),
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ const TEST_CASES = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
add_setup(async function () {
|
add_setup(async function () {
|
||||||
|
Services.telemetry.setEventRecordingEnabled("security.ui.xfocsperror", true);
|
||||||
|
|
||||||
await SpecialPowers.pushPrefEnv({
|
await SpecialPowers.pushPrefEnv({
|
||||||
set: [
|
set: [
|
||||||
["security.xfocsp.errorReporting.enabled", true],
|
["security.xfocsp.errorReporting.enabled", true],
|
||||||
|
|||||||
@@ -673,6 +673,9 @@ class Dav1dDecoder final : AVIFDecoderInterface {
|
|||||||
// the easiest way to see if we're getting unexpected behavior to
|
// the easiest way to see if we're getting unexpected behavior to
|
||||||
// investigate.
|
// investigate.
|
||||||
if (aShouldSendTelemetry && r != 0) {
|
if (aShouldSendTelemetry && r != 0) {
|
||||||
|
// Uncomment once bug 1691156 is fixed
|
||||||
|
// mozilla::Telemetry::SetEventRecordingEnabled("avif"_ns, true);
|
||||||
|
|
||||||
mozilla::glean::avif::Dav1dGetPictureReturnValueExtra extra = {
|
mozilla::glean::avif::Dav1dGetPictureReturnValueExtra extra = {
|
||||||
.value = Some(nsPrintfCString("%d", r)),
|
.value = Some(nsPrintfCString("%d", r)),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -110,6 +110,10 @@ bool UtilityProcessHost::Launch(geckoargs::ChildProcessArgs aExtraOpts) {
|
|||||||
EnsureWidevineL1PathForSandbox(aExtraOpts);
|
EnsureWidevineL1PathForSandbox(aExtraOpts);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MOZ_WMF_CDM) && defined(MOZ_SANDBOX)
|
||||||
|
EnanbleMFCDMTelemetryEventIfNeeded();
|
||||||
|
#endif
|
||||||
|
|
||||||
mLaunchPhase = LaunchPhase::Waiting;
|
mLaunchPhase = LaunchPhase::Waiting;
|
||||||
|
|
||||||
if (!GeckoChildProcessHost::AsyncLaunch(std::move(aExtraOpts))) {
|
if (!GeckoChildProcessHost::AsyncLaunch(std::move(aExtraOpts))) {
|
||||||
@@ -410,4 +414,17 @@ void UtilityProcessHost::EnsureWidevineL1PathForSandbox(
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MOZ_WMF_CDM) && defined(MOZ_SANDBOX)
|
||||||
|
void UtilityProcessHost::EnanbleMFCDMTelemetryEventIfNeeded() const {
|
||||||
|
if (mSandbox != SandboxingKind::MF_MEDIA_ENGINE_CDM) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
static bool sTelemetryEventEnabled = false;
|
||||||
|
if (!sTelemetryEventEnabled) {
|
||||||
|
sTelemetryEventEnabled = true;
|
||||||
|
Telemetry::SetEventRecordingEnabled("mfcdm"_ns, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace mozilla::ipc
|
} // namespace mozilla::ipc
|
||||||
|
|||||||
@@ -586,6 +586,7 @@ AutoScriptActivity::~AutoScriptActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const double sChromeSlowScriptTelemetryCutoff(10.0);
|
static const double sChromeSlowScriptTelemetryCutoff(10.0);
|
||||||
|
static bool sTelemetryEventEnabled(false);
|
||||||
|
|
||||||
// static
|
// static
|
||||||
bool XPCJSContext::InterruptCallback(JSContext* cx) {
|
bool XPCJSContext::InterruptCallback(JSContext* cx) {
|
||||||
@@ -1443,6 +1444,11 @@ void XPCJSContext::AfterProcessTask(uint32_t aNewRecursionDepth) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hangDuration > limit) {
|
if (hangDuration > limit) {
|
||||||
|
if (!sTelemetryEventEnabled) {
|
||||||
|
sTelemetryEventEnabled = true;
|
||||||
|
Telemetry::SetEventRecordingEnabled("slow_script_warning"_ns, true);
|
||||||
|
}
|
||||||
|
|
||||||
// Use AppendFloat to avoid printf-type APIs using locale-specific
|
// Use AppendFloat to avoid printf-type APIs using locale-specific
|
||||||
// decimal separators, when we definitely want a `.`.
|
// decimal separators, when we definitely want a `.`.
|
||||||
nsCString durationStr;
|
nsCString durationStr;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/ScopeExit.h"
|
#include "mozilla/ScopeExit.h"
|
||||||
#include "mozilla/StaticPrefs_network.h"
|
#include "mozilla/StaticPrefs_network.h"
|
||||||
|
#include "mozilla/Telemetry.h"
|
||||||
#include "mozilla/glean/GleanMetrics.h"
|
#include "mozilla/glean/GleanMetrics.h"
|
||||||
#include "private/pprio.h"
|
#include "private/pprio.h"
|
||||||
#include "nsInputStreamPump.h"
|
#include "nsInputStreamPump.h"
|
||||||
@@ -870,6 +871,7 @@ static void RecordZeroLengthEvent(bool aIsSync, const nsCString& aSpec,
|
|||||||
bool isTest = fileName.Find("test_empty_file.zip!") != -1;
|
bool isTest = fileName.Find("test_empty_file.zip!") != -1;
|
||||||
bool isOmniJa = StringBeginsWith(fileName, "omni.ja!"_ns);
|
bool isOmniJa = StringBeginsWith(fileName, "omni.ja!"_ns);
|
||||||
|
|
||||||
|
Telemetry::SetEventRecordingEnabled("zero_byte_load"_ns, true);
|
||||||
if (StringEndsWith(fileName, ".ftl"_ns)) {
|
if (StringEndsWith(fileName, ".ftl"_ns)) {
|
||||||
// FTL uses I/O to test for file presence, so we get
|
// FTL uses I/O to test for file presence, so we get
|
||||||
// a high volume of events from it, but it is not erronous.
|
// a high volume of events from it, but it is not erronous.
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ function makeChan() {
|
|||||||
add_task(async function test_empty_jar_file_async() {
|
add_task(async function test_empty_jar_file_async() {
|
||||||
var chan = makeChan();
|
var chan = makeChan();
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("zero_byte_load", true);
|
||||||
Services.telemetry.clearEvents();
|
Services.telemetry.clearEvents();
|
||||||
|
|
||||||
await new Promise(resolve => {
|
await new Promise(resolve => {
|
||||||
@@ -126,6 +127,7 @@ add_task(async function test_empty_jar_file_async() {
|
|||||||
add_task(async function test_empty_jar_file_sync() {
|
add_task(async function test_empty_jar_file_sync() {
|
||||||
var chan = makeChan();
|
var chan = makeChan();
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("zero_byte_load", true);
|
||||||
Services.telemetry.clearEvents();
|
Services.telemetry.clearEvents();
|
||||||
|
|
||||||
await new Promise(resolve => {
|
await new Promise(resolve => {
|
||||||
|
|||||||
@@ -161,6 +161,8 @@ static void ShutdownAlwaysPrefs();
|
|||||||
// Low-level types and operations
|
// Low-level types and operations
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
|
Atomic<bool, mozilla::Relaxed> sPrefTelemetryEventEnabled(false);
|
||||||
|
|
||||||
typedef nsTArray<nsCString> PrefSaveData;
|
typedef nsTArray<nsCString> PrefSaveData;
|
||||||
|
|
||||||
// 1 MB should be enough for everyone.
|
// 1 MB should be enough for everyone.
|
||||||
@@ -661,6 +663,10 @@ class Pref {
|
|||||||
|
|
||||||
#define CHECK_SANITIZATION() \
|
#define CHECK_SANITIZATION() \
|
||||||
if (IsPreferenceSanitized(this)) { \
|
if (IsPreferenceSanitized(this)) { \
|
||||||
|
if (!sPrefTelemetryEventEnabled.exchange(true)) { \
|
||||||
|
sPrefTelemetryEventEnabled = true; \
|
||||||
|
Telemetry::SetEventRecordingEnabled("security"_ns, true); \
|
||||||
|
} \
|
||||||
glean::security::pref_usage_content_process.Record( \
|
glean::security::pref_usage_content_process.Record( \
|
||||||
Some(glean::security::PrefUsageContentProcessExtra{Some(Name())})); \
|
Some(glean::security::PrefUsageContentProcessExtra{Some(Name())})); \
|
||||||
if (sCrashOnBlocklistedPref) { \
|
if (sCrashOnBlocklistedPref) { \
|
||||||
@@ -1170,6 +1176,11 @@ class MOZ_STACK_CLASS PrefWrapper : public PrefWrapperBase {
|
|||||||
// This check will be performed in the above functions; but for NoneType
|
// This check will be performed in the above functions; but for NoneType
|
||||||
// we need to do it explicitly, then fall-through.
|
// we need to do it explicitly, then fall-through.
|
||||||
if (IsPreferenceSanitized(Name())) {
|
if (IsPreferenceSanitized(Name())) {
|
||||||
|
if (!sPrefTelemetryEventEnabled.exchange(true)) {
|
||||||
|
sPrefTelemetryEventEnabled = true;
|
||||||
|
Telemetry::SetEventRecordingEnabled("security"_ns, true);
|
||||||
|
}
|
||||||
|
|
||||||
glean::security::pref_usage_content_process.Record(Some(
|
glean::security::pref_usage_content_process.Record(Some(
|
||||||
glean::security::PrefUsageContentProcessExtra{Some(Name())}));
|
glean::security::PrefUsageContentProcessExtra{Some(Name())}));
|
||||||
|
|
||||||
@@ -1192,6 +1203,11 @@ class MOZ_STACK_CLASS PrefWrapper : public PrefWrapperBase {
|
|||||||
// WantValueKind may short-circuit GetValue functions and cause them to
|
// WantValueKind may short-circuit GetValue functions and cause them to
|
||||||
// return early, before this check occurs in GetFooValue()
|
// return early, before this check occurs in GetFooValue()
|
||||||
if (this->is<Pref*>() && IsPreferenceSanitized(this->as<Pref*>())) {
|
if (this->is<Pref*>() && IsPreferenceSanitized(this->as<Pref*>())) {
|
||||||
|
if (!sPrefTelemetryEventEnabled.exchange(true)) {
|
||||||
|
sPrefTelemetryEventEnabled = true;
|
||||||
|
Telemetry::SetEventRecordingEnabled("security"_ns, true);
|
||||||
|
}
|
||||||
|
|
||||||
glean::security::pref_usage_content_process.Record(
|
glean::security::pref_usage_content_process.Record(
|
||||||
Some(glean::security::PrefUsageContentProcessExtra{Some(Name())}));
|
Some(glean::security::PrefUsageContentProcessExtra{Some(Name())}));
|
||||||
|
|
||||||
@@ -5401,6 +5417,11 @@ int32_t Preferences::GetType(const char* aPrefName) {
|
|||||||
|
|
||||||
case PrefType::None:
|
case PrefType::None:
|
||||||
if (IsPreferenceSanitized(aPrefName)) {
|
if (IsPreferenceSanitized(aPrefName)) {
|
||||||
|
if (!sPrefTelemetryEventEnabled.exchange(true)) {
|
||||||
|
sPrefTelemetryEventEnabled = true;
|
||||||
|
Telemetry::SetEventRecordingEnabled("security"_ns, true);
|
||||||
|
}
|
||||||
|
|
||||||
glean::security::pref_usage_content_process.Record(Some(
|
glean::security::pref_usage_content_process.Record(Some(
|
||||||
glean::security::PrefUsageContentProcessExtra{Some(aPrefName)}));
|
glean::security::PrefUsageContentProcessExtra{Some(aPrefName)}));
|
||||||
|
|
||||||
|
|||||||
@@ -13384,6 +13384,12 @@
|
|||||||
value: 6000
|
value: 6000
|
||||||
mirror: always
|
mirror: always
|
||||||
|
|
||||||
|
# The timeout of the TRR confirmation request
|
||||||
|
- name: network.trr.confirmation_telemetry_enabled
|
||||||
|
type: RelaxedAtomicBool
|
||||||
|
value: true
|
||||||
|
mirror: always
|
||||||
|
|
||||||
# Whether to send the Accept-Language header for TRR requests
|
# Whether to send the Accept-Language header for TRR requests
|
||||||
- name: network.trr.send_accept-language_headers
|
- name: network.trr.send_accept-language_headers
|
||||||
type: RelaxedAtomicBool
|
type: RelaxedAtomicBool
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ add_task(async function sanitized_pref_test() {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("security", true);
|
||||||
Services.telemetry.clearEvents();
|
Services.telemetry.clearEvents();
|
||||||
|
|
||||||
TelemetryTestUtils.assertNumberOfEvents(0, { process: "content" });
|
TelemetryTestUtils.assertNumberOfEvents(0, { process: "content" });
|
||||||
|
|||||||
@@ -164,6 +164,12 @@ bool TRRService::CheckCaptivePortalIsPassed() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void EventTelemetryPrefChanged(const char* aPref, void* aData) {
|
||||||
|
Telemetry::SetEventRecordingEnabled(
|
||||||
|
"network.dns"_ns,
|
||||||
|
StaticPrefs::network_trr_confirmation_telemetry_enabled());
|
||||||
|
}
|
||||||
|
|
||||||
nsresult TRRService::Init(bool aNativeHTTPSQueryEnabled) {
|
nsresult TRRService::Init(bool aNativeHTTPSQueryEnabled) {
|
||||||
MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
|
MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
|
||||||
if (mInitialized) {
|
if (mInitialized) {
|
||||||
@@ -209,6 +215,10 @@ nsresult TRRService::Init(bool aNativeHTTPSQueryEnabled) {
|
|||||||
sTRRBackgroundThread = thread;
|
sTRRBackgroundThread = thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Preferences::RegisterCallbackAndCall(
|
||||||
|
EventTelemetryPrefChanged,
|
||||||
|
"network.trr.confirmation_telemetry_enabled"_ns);
|
||||||
|
|
||||||
LOG(("Initialized TRRService\n"));
|
LOG(("Initialized TRRService\n"));
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include "mozilla/BasePrincipal.h"
|
#include "mozilla/BasePrincipal.h"
|
||||||
#include "mozilla/IntegerTypeTraits.h"
|
#include "mozilla/IntegerTypeTraits.h"
|
||||||
#include "mozilla/NullPrincipal.h"
|
#include "mozilla/NullPrincipal.h"
|
||||||
|
#include "mozilla/Telemetry.h"
|
||||||
#include "mozilla/glean/GleanMetrics.h"
|
#include "mozilla/glean/GleanMetrics.h"
|
||||||
|
|
||||||
#include "nsThreadUtils.h"
|
#include "nsThreadUtils.h"
|
||||||
@@ -1107,6 +1108,7 @@ nsresult nsExpatDriver::HandleError() {
|
|||||||
docShellDestroyed.Assign(destroyed ? "true"_ns : "false"_ns);
|
docShellDestroyed.Assign(destroyed ? "true"_ns : "false"_ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mozilla::Telemetry::SetEventRecordingEnabled("ysod"_ns, true);
|
||||||
mozilla::glean::ysod::ShownYsodExtra extra = {
|
mozilla::glean::ysod::ShownYsodExtra extra = {
|
||||||
.destroyed = mozilla::Some(docShellDestroyed),
|
.destroyed = mozilla::Some(docShellDestroyed),
|
||||||
.errorCode = mozilla::Some(code),
|
.errorCode = mozilla::Some(code),
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
|||||||
|
|
||||||
add_task(async function test_popup_opened() {
|
add_task(async function test_popup_opened() {
|
||||||
Services.telemetry.clearEvents();
|
Services.telemetry.clearEvents();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("ysod", true);
|
||||||
|
|
||||||
const PAGE_URL = getRootDirectory(gTestPath) + "broken_xml.xhtml";
|
const PAGE_URL = getRootDirectory(gTestPath) + "broken_xml.xhtml";
|
||||||
let viewSourceTab = await BrowserTestUtils.openNewForegroundTab(
|
let viewSourceTab = await BrowserTestUtils.openNewForegroundTab(
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||||||
"services.common.uptake.sampleRate"
|
"services.common.uptake.sampleRate"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Telemetry events id (see Events.yaml).
|
||||||
|
const TELEMETRY_EVENTS_ID = "uptake.remotecontent.result";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A wrapper around certain low-level operations that can be substituted for testing.
|
* A wrapper around certain low-level operations that can be substituted for testing.
|
||||||
*/
|
*/
|
||||||
@@ -160,6 +163,14 @@ export class UptakeTelemetry {
|
|||||||
throw new Error(`Unknown status '${status}'`);
|
throw new Error(`Unknown status '${status}'`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Report event for real-time monitoring. See Events.yaml for registration.
|
||||||
|
// Contrary to histograms, Telemetry Events are not enabled by default.
|
||||||
|
// Enable them on first call to `report()`.
|
||||||
|
if (!this._eventsEnabled) {
|
||||||
|
Services.telemetry.setEventRecordingEnabled(TELEMETRY_EVENTS_ID, true);
|
||||||
|
this._eventsEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
const hash = await UptakeTelemetry.Policy.getClientIDHash();
|
const hash = await UptakeTelemetry.Policy.getClientIDHash();
|
||||||
const channel = UptakeTelemetry.Policy.getChannel();
|
const channel = UptakeTelemetry.Policy.getChannel();
|
||||||
const shouldSendEvent =
|
const shouldSendEvent =
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||||||
export class FxAccountsTelemetry {
|
export class FxAccountsTelemetry {
|
||||||
constructor(fxai) {
|
constructor(fxai) {
|
||||||
this._fxai = fxai;
|
this._fxai = fxai;
|
||||||
|
Services.telemetry.setEventRecordingEnabled("fxa", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Records an event *in the Fxa/Sync ping*.
|
// Records an event *in the Fxa/Sync ping*.
|
||||||
|
|||||||
@@ -402,6 +402,7 @@ export var SyncedTabs = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
recordSyncedTabsTelemetry(object, tabEvent, extraOptions) {
|
recordSyncedTabsTelemetry(object, tabEvent, extraOptions) {
|
||||||
|
Services.telemetry.setEventRecordingEnabled("synced_tabs", true);
|
||||||
if (
|
if (
|
||||||
!["fxa_avatar_menu", "fxa_app_menu", "synced_tabs_sidebar"].includes(
|
!["fxa_avatar_menu", "fxa_app_menu", "synced_tabs_sidebar"].includes(
|
||||||
object
|
object
|
||||||
|
|||||||
@@ -1126,6 +1126,14 @@ nsCookieBannerService::OnLocationChange(nsIWebProgress* aWebProgress,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The static value to track if we have enabled the event telemetry for
|
||||||
|
// cookie banner.
|
||||||
|
static bool sTelemetryEventEnabled = false;
|
||||||
|
if (!sTelemetryEventEnabled) {
|
||||||
|
sTelemetryEventEnabled = true;
|
||||||
|
Telemetry::SetEventRecordingEnabled("cookie_banner"_ns, true);
|
||||||
|
}
|
||||||
|
|
||||||
glean::cookie_banners::ReloadExtra extra = {
|
glean::cookie_banners::ReloadExtra extra = {
|
||||||
.hasClickRule = Some(hasClickRuleInData),
|
.hasClickRule = Some(hasClickRuleInData),
|
||||||
.hasCookieRule = Some(hasCookieRuleInData),
|
.hasCookieRule = Some(hasCookieRuleInData),
|
||||||
|
|||||||
@@ -652,6 +652,7 @@ add_task(async function test_DownloadSummary_notifications() {
|
|||||||
*/
|
*/
|
||||||
add_task(async function test_downloadAddedTelemetry() {
|
add_task(async function test_downloadAddedTelemetry() {
|
||||||
Services.telemetry.clearEvents();
|
Services.telemetry.clearEvents();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("downloads", true);
|
||||||
|
|
||||||
let targetFile = getTempFile(TEST_TARGET_FILE_NAME);
|
let targetFile = getTempFile(TEST_TARGET_FILE_NAME);
|
||||||
|
|
||||||
|
|||||||
@@ -119,9 +119,13 @@ this.telemetry = class extends ExtensionAPI {
|
|||||||
throw new ExtensionUtils.ExtensionError(ex);
|
throw new ExtensionUtils.ExtensionError(ex);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setEventRecordingEnabled(_category, _enabled) {
|
setEventRecordingEnabled(category, enabled) {
|
||||||
desktopCheck();
|
desktopCheck();
|
||||||
// No-op since bug 1920562 (Fx133).
|
try {
|
||||||
|
Services.telemetry.setEventRecordingEnabled(category, enabled);
|
||||||
|
} catch (ex) {
|
||||||
|
throw new ExtensionUtils.ExtensionError(ex);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
registerEvents(_category, _data) {
|
registerEvents(_category, _data) {
|
||||||
desktopCheck();
|
desktopCheck();
|
||||||
|
|||||||
@@ -363,9 +363,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "setEventRecordingEnabled",
|
"name": "setEventRecordingEnabled",
|
||||||
"deprecated": "`setEventRecordingEnabled` has been deprecated since Firefox 133 (see bug 1920562)",
|
|
||||||
"type": "function",
|
"type": "function",
|
||||||
"description": "Enable recording of events in a category. Events default to recording enabled. This allows to toggle recording for all events in the specified category.",
|
"description": "Enable recording of events in a category. Events default to recording disabled. This allows to toggle recording for all events in the specified category.",
|
||||||
"async": true,
|
"async": true,
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -535,6 +535,7 @@ if (AppConstants.MOZ_BUILD_APP === "browser") {
|
|||||||
|
|
||||||
add_task(async function test_telemetry_record_event() {
|
add_task(async function test_telemetry_record_event() {
|
||||||
Services.telemetry.clearEvents();
|
Services.telemetry.clearEvents();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("telemetry.test", true);
|
||||||
|
|
||||||
ExtensionTestUtils.failOnSchemaWarnings(false);
|
ExtensionTestUtils.failOnSchemaWarnings(false);
|
||||||
|
|
||||||
@@ -567,12 +568,14 @@ if (AppConstants.MOZ_BUILD_APP === "browser") {
|
|||||||
|
|
||||||
ExtensionTestUtils.failOnSchemaWarnings(true);
|
ExtensionTestUtils.failOnSchemaWarnings(true);
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("telemetry.test", false);
|
||||||
Services.telemetry.clearEvents();
|
Services.telemetry.clearEvents();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Bug 1536877
|
// Bug 1536877
|
||||||
add_task(async function test_telemetry_record_event_value_must_be_string() {
|
add_task(async function test_telemetry_record_event_value_must_be_string() {
|
||||||
Services.telemetry.clearEvents();
|
Services.telemetry.clearEvents();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("telemetry.test", true);
|
||||||
|
|
||||||
ExtensionTestUtils.failOnSchemaWarnings(false);
|
ExtensionTestUtils.failOnSchemaWarnings(false);
|
||||||
|
|
||||||
@@ -616,6 +619,7 @@ if (AppConstants.MOZ_BUILD_APP === "browser") {
|
|||||||
|
|
||||||
ExtensionTestUtils.failOnSchemaWarnings(true);
|
ExtensionTestUtils.failOnSchemaWarnings(true);
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("telemetry.test", false);
|
||||||
Services.telemetry.clearEvents();
|
Services.telemetry.clearEvents();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ export let FormAutofillStatus = {
|
|||||||
if (FormAutofill.isAutofillCreditCardsAvailable) {
|
if (FormAutofill.isAutofillCreditCardsAvailable) {
|
||||||
Services.prefs.addObserver(ENABLED_AUTOFILL_CREDITCARDS_PREF, this);
|
Services.prefs.addObserver(ENABLED_AUTOFILL_CREDITCARDS_PREF, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("creditcard", true);
|
||||||
|
Services.telemetry.setEventRecordingEnabled("address", true);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -156,6 +156,15 @@ Assert.equal(true, snapshot["telemetry.test.mirror_for_labeled_bool"]["1".repeat
|
|||||||
### Telemetry Events
|
### Telemetry Events
|
||||||
|
|
||||||
A Glean event can be mirrored to a Telemetry Event.
|
A Glean event can be mirrored to a Telemetry Event.
|
||||||
|
Telemetry Events must be enabled before they can be recorded to via the API
|
||||||
|
`Telemetry.setEventRecordingEnabled(category, enable);`.
|
||||||
|
If the Telemetry Event isn't enabled,
|
||||||
|
recording to the Glean event will still work,
|
||||||
|
and the event will be Summarized in Telemetry as all disabled events are.
|
||||||
|
|
||||||
|
See
|
||||||
|
[the Telemetry Event docs](/toolkit/components/telemetry/collection/events.rst)
|
||||||
|
for details on how disabled Telemetry Events behave.
|
||||||
|
|
||||||
In order to make use of the `value` field in Telemetry Events, you must
|
In order to make use of the `value` field in Telemetry Events, you must
|
||||||
first define an event extra in the metrics.yaml file with the name "value".
|
first define an event extra in the metrics.yaml file with the name "value".
|
||||||
|
|||||||
@@ -24,6 +24,12 @@ To record your new event, use [the Glean `record(...)` API][glean-event-api].
|
|||||||
|
|
||||||
To test your new event, use [the Glean `testGetValue()` API][glean-test-api].
|
To test your new event, use [the Glean `testGetValue()` API][glean-test-api].
|
||||||
|
|
||||||
|
```{admonition} Don't Forget!
|
||||||
|
Though you're using Glean, there's still a Legacy Telemetry event underneath.
|
||||||
|
You must call `Services.telemetry.setEventRecordingEnabled("myCategory", true);`
|
||||||
|
in order for the Legacy Telemetry event to be recorded.
|
||||||
|
```
|
||||||
|
|
||||||
Your Legacy Telemetry event will appear in `about:telemetry`
|
Your Legacy Telemetry event will appear in `about:telemetry`
|
||||||
when your code is triggered as confirmation this is all working as you expect.
|
when your code is triggered as confirmation this is all working as you expect.
|
||||||
|
|
||||||
|
|||||||
@@ -218,6 +218,8 @@ add_task(function test_gifft_string_list_works() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
add_task(function test_gifft_events() {
|
add_task(function test_gifft_events() {
|
||||||
|
Telemetry.setEventRecordingEnabled("telemetry.test", true);
|
||||||
|
|
||||||
Glean.testOnlyIpc.noExtraEvent.record();
|
Glean.testOnlyIpc.noExtraEvent.record();
|
||||||
var events = Glean.testOnlyIpc.noExtraEvent.testGetValue();
|
var events = Glean.testOnlyIpc.noExtraEvent.testGetValue();
|
||||||
Assert.equal(1, events.length);
|
Assert.equal(1, events.length);
|
||||||
|
|||||||
@@ -134,6 +134,8 @@ add_task({ skip_if: () => runningInParent }, async function run_child_stuff() {
|
|||||||
add_task(
|
add_task(
|
||||||
{ skip_if: () => !runningInParent },
|
{ skip_if: () => !runningInParent },
|
||||||
async function test_child_metrics() {
|
async function test_child_metrics() {
|
||||||
|
Telemetry.setEventRecordingEnabled("telemetry.test", true);
|
||||||
|
|
||||||
// Clear any stray Telemetry data
|
// Clear any stray Telemetry data
|
||||||
Telemetry.clearScalars();
|
Telemetry.clearScalars();
|
||||||
Telemetry.getSnapshotForHistograms("main", true);
|
Telemetry.getSnapshotForHistograms("main", true);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||||||
setTimeout: "resource://gre/modules/Timer.sys.mjs",
|
setTimeout: "resource://gre/modules/Timer.sys.mjs",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const TARGETING_EVENT_CATEGORY = "messaging_experiments";
|
||||||
const DEFAULT_TIMEOUT = 5000;
|
const DEFAULT_TIMEOUT = 5000;
|
||||||
const ERROR_TYPES = {
|
const ERROR_TYPES = {
|
||||||
ATTRIBUTE_ERROR: "AttributeError",
|
ATTRIBUTE_ERROR: "AttributeError",
|
||||||
@@ -80,6 +81,9 @@ export class TargetingContext {
|
|||||||
|
|
||||||
// Used in telemetry to report where the targeting expression is coming from
|
// Used in telemetry to report where the targeting expression is coming from
|
||||||
this.#telemetrySource = options.source;
|
this.#telemetrySource = options.source;
|
||||||
|
|
||||||
|
// Enable event recording
|
||||||
|
Services.telemetry.setEventRecordingEnabled(TARGETING_EVENT_CATEGORY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTelemetrySource(source) {
|
setTelemetrySource(source) {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||||||
COLLECTION_ID_PREF,
|
COLLECTION_ID_PREF,
|
||||||
COLLECTION_ID_FALLBACK
|
COLLECTION_ID_FALLBACK
|
||||||
);
|
);
|
||||||
|
const EXPOSURE_EVENT_CATEGORY = "normandy";
|
||||||
|
|
||||||
function parseJSON(value) {
|
function parseJSON(value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
@@ -266,6 +267,7 @@ export const ExperimentAPI = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
recordExposureEvent({ featureId, experimentSlug, branchSlug }) {
|
recordExposureEvent({ featureId, experimentSlug, branchSlug }) {
|
||||||
|
Services.telemetry.setEventRecordingEnabled(EXPOSURE_EVENT_CATEGORY, true);
|
||||||
Glean.normandy.exposeNimbusExperiment.record({
|
Glean.normandy.exposeNimbusExperiment.record({
|
||||||
value: experimentSlug,
|
value: experimentSlug,
|
||||||
branchSlug,
|
branchSlug,
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ nsresult NimbusFeatures::RecordExposureEvent(const nsACString& aFeatureId,
|
|||||||
// this featureId
|
// this featureId
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
Telemetry::SetEventRecordingEnabled("normandy"_ns, true);
|
||||||
glean::normandy::expose_nimbus_experiment.Record(
|
glean::normandy::expose_nimbus_experiment.Record(
|
||||||
Some(glean::normandy::ExposeNimbusExperimentExtra{
|
Some(glean::normandy::ExposeNimbusExperimentExtra{
|
||||||
.branchslug = Some(branchName),
|
.branchslug = Some(branchName),
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ const { PrefUtils } = ChromeUtils.importESModule(
|
|||||||
const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
||||||
"resource://testing-common/TelemetryTestUtils.sys.mjs"
|
"resource://testing-common/TelemetryTestUtils.sys.mjs"
|
||||||
);
|
);
|
||||||
|
const { TelemetryEvents } = ChromeUtils.importESModule(
|
||||||
|
"resource://normandy/lib/TelemetryEvents.sys.mjs"
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pick a single entry from an object and return a new object containing only
|
* Pick a single entry from an object and return a new object containing only
|
||||||
@@ -1657,6 +1660,8 @@ add_task(async function test_restorePrefs_experimentAndRollout() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_prefChange() {
|
add_task(async function test_prefChange() {
|
||||||
|
TelemetryEvents.init();
|
||||||
|
|
||||||
const LEGACY_FILTER = {
|
const LEGACY_FILTER = {
|
||||||
category: "normandy",
|
category: "normandy",
|
||||||
method: "unenroll",
|
method: "unenroll",
|
||||||
@@ -2708,6 +2713,8 @@ add_task(async function test_prefChanged_noPrefSet() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_restorePrefs_manifestChanged() {
|
add_task(async function test_restorePrefs_manifestChanged() {
|
||||||
|
TelemetryEvents.init();
|
||||||
|
|
||||||
const LEGACY_FILTER = {
|
const LEGACY_FILTER = {
|
||||||
category: "normandy",
|
category: "normandy",
|
||||||
method: "unenroll",
|
method: "unenroll",
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ const { PanelTestProvider } = ChromeUtils.importESModule(
|
|||||||
const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
||||||
"resource://testing-common/TelemetryTestUtils.sys.mjs"
|
"resource://testing-common/TelemetryTestUtils.sys.mjs"
|
||||||
);
|
);
|
||||||
|
const { TelemetryEvents } = ChromeUtils.importESModule(
|
||||||
|
"resource://normandy/lib/TelemetryEvents.sys.mjs"
|
||||||
|
);
|
||||||
|
|
||||||
add_setup(async function setup() {
|
add_setup(async function setup() {
|
||||||
do_get_profile();
|
do_get_profile();
|
||||||
@@ -508,6 +511,8 @@ add_task(async function test_updateRecipes_simpleFeatureInvalidAfterUpdate() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_updateRecipes_validationTelemetry() {
|
add_task(async function test_updateRecipes_validationTelemetry() {
|
||||||
|
TelemetryEvents.init();
|
||||||
|
|
||||||
Services.telemetry.snapshotEvents(
|
Services.telemetry.snapshotEvents(
|
||||||
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
|
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
|
||||||
/* clear = */ true
|
/* clear = */ true
|
||||||
@@ -1031,6 +1036,7 @@ add_task(async function test_updateRecipes_invalidFeature_mismatch() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_updateRecipes_rollout_bucketing() {
|
add_task(async function test_updateRecipes_rollout_bucketing() {
|
||||||
|
TelemetryEvents.init();
|
||||||
Services.fog.testResetFOG();
|
Services.fog.testResetFOG();
|
||||||
Services.telemetry.snapshotEvents(
|
Services.telemetry.snapshotEvents(
|
||||||
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
|
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ const { ExperimentFakes, ExperimentTestUtils } = ChromeUtils.importESModule(
|
|||||||
const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
||||||
"resource://testing-common/TelemetryTestUtils.sys.mjs"
|
"resource://testing-common/TelemetryTestUtils.sys.mjs"
|
||||||
);
|
);
|
||||||
|
const { TelemetryEvents } = ChromeUtils.importESModule(
|
||||||
|
"resource://normandy/lib/TelemetryEvents.sys.mjs"
|
||||||
|
);
|
||||||
|
|
||||||
const LOCALIZATIONS = {
|
const LOCALIZATIONS = {
|
||||||
"en-US": {
|
"en-US": {
|
||||||
@@ -119,6 +122,7 @@ add_setup(function setup() {
|
|||||||
do_get_profile();
|
do_get_profile();
|
||||||
|
|
||||||
Services.fog.initializeFOG();
|
Services.fog.initializeFOG();
|
||||||
|
TelemetryEvents.init();
|
||||||
|
|
||||||
registerCleanupFunction(ExperimentTestUtils.addTestFeatures(FEATURE));
|
registerCleanupFunction(ExperimentTestUtils.addTestFeatures(FEATURE));
|
||||||
registerCleanupFunction(resetTelemetry);
|
registerCleanupFunction(resetTelemetry);
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ const { JsonSchema } = ChromeUtils.importESModule(
|
|||||||
const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
||||||
"resource://testing-common/TelemetryTestUtils.sys.mjs"
|
"resource://testing-common/TelemetryTestUtils.sys.mjs"
|
||||||
);
|
);
|
||||||
|
const { TelemetryEvents } = ChromeUtils.importESModule(
|
||||||
|
"resource://normandy/lib/TelemetryEvents.sys.mjs"
|
||||||
|
);
|
||||||
|
|
||||||
const USER = "user";
|
const USER = "user";
|
||||||
const DEFAULT = "default";
|
const DEFAULT = "default";
|
||||||
@@ -145,6 +148,7 @@ function checkExpectedPrefBranches(prefs) {
|
|||||||
add_setup(function setup() {
|
add_setup(function setup() {
|
||||||
do_get_profile();
|
do_get_profile();
|
||||||
Services.fog.initializeFOG();
|
Services.fog.initializeFOG();
|
||||||
|
TelemetryEvents.init();
|
||||||
|
|
||||||
const cleanupFeatures = ExperimentTestUtils.addTestFeatures(
|
const cleanupFeatures = ExperimentTestUtils.addTestFeatures(
|
||||||
PREF_FEATURES[USER],
|
PREF_FEATURES[USER],
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||||||
RemoteSettingsExperimentLoader:
|
RemoteSettingsExperimentLoader:
|
||||||
"resource://nimbus/lib/RemoteSettingsExperimentLoader.sys.mjs",
|
"resource://nimbus/lib/RemoteSettingsExperimentLoader.sys.mjs",
|
||||||
ShieldPreferences: "resource://normandy/lib/ShieldPreferences.sys.mjs",
|
ShieldPreferences: "resource://normandy/lib/ShieldPreferences.sys.mjs",
|
||||||
|
TelemetryEvents: "resource://normandy/lib/TelemetryEvents.sys.mjs",
|
||||||
});
|
});
|
||||||
|
|
||||||
const UI_AVAILABLE_NOTIFICATION = "sessionstore-windows-restored";
|
const UI_AVAILABLE_NOTIFICATION = "sessionstore-windows-restored";
|
||||||
@@ -85,6 +86,12 @@ export var Normandy = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async finishInit() {
|
async finishInit() {
|
||||||
|
try {
|
||||||
|
lazy.TelemetryEvents.init();
|
||||||
|
} catch (err) {
|
||||||
|
log.error("Failed to initialize telemetry events:", err);
|
||||||
|
}
|
||||||
|
|
||||||
await lazy.PreferenceRollouts.recordOriginalValues(
|
await lazy.PreferenceRollouts.recordOriginalValues(
|
||||||
this.rolloutPrefsChanged
|
this.rolloutPrefsChanged
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,7 +2,13 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
const TELEMETRY_CATEGORY = "normandy";
|
||||||
|
|
||||||
export const TelemetryEvents = {
|
export const TelemetryEvents = {
|
||||||
|
init() {
|
||||||
|
Services.telemetry.setEventRecordingEnabled(TELEMETRY_CATEGORY, true);
|
||||||
|
},
|
||||||
|
|
||||||
sendEvent(method, object, value, extra) {
|
sendEvent(method, object, value, extra) {
|
||||||
for (const val of Object.values(extra)) {
|
for (const val of Object.values(extra)) {
|
||||||
if (val == null) {
|
if (val == null) {
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ function withStubInits() {
|
|||||||
withStub(PreferenceRollouts, "init"),
|
withStub(PreferenceRollouts, "init"),
|
||||||
withStub(PreferenceExperiments, "init"),
|
withStub(PreferenceExperiments, "init"),
|
||||||
withStub(RecipeRunner, "init"),
|
withStub(RecipeRunner, "init"),
|
||||||
|
withStub(TelemetryEvents, "init"),
|
||||||
testFunction
|
testFunction
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -246,6 +247,7 @@ decorate_task(withStubInits(), async function testStartupPrefInitFail() {
|
|||||||
"startup calls PreferenceExperiments.init"
|
"startup calls PreferenceExperiments.init"
|
||||||
);
|
);
|
||||||
ok(RecipeRunner.init.called, "startup calls RecipeRunner.init");
|
ok(RecipeRunner.init.called, "startup calls RecipeRunner.init");
|
||||||
|
ok(TelemetryEvents.init.called, "startup calls TelemetryEvents.init");
|
||||||
ok(PreferenceRollouts.init.called, "startup calls PreferenceRollouts.init");
|
ok(PreferenceRollouts.init.called, "startup calls PreferenceRollouts.init");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -262,6 +264,25 @@ decorate_task(
|
|||||||
"startup calls PreferenceExperiments.init"
|
"startup calls PreferenceExperiments.init"
|
||||||
);
|
);
|
||||||
ok(RecipeRunner.init.called, "startup calls RecipeRunner.init");
|
ok(RecipeRunner.init.called, "startup calls RecipeRunner.init");
|
||||||
|
ok(TelemetryEvents.init.called, "startup calls TelemetryEvents.init");
|
||||||
|
ok(PreferenceRollouts.init.called, "startup calls PreferenceRollouts.init");
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
decorate_task(
|
||||||
|
withStubInits(),
|
||||||
|
async function testStartupTelemetryEventsInitFail() {
|
||||||
|
TelemetryEvents.init.throws();
|
||||||
|
|
||||||
|
await Normandy.finishInit();
|
||||||
|
ok(AddonStudies.init.called, "startup calls AddonStudies.init");
|
||||||
|
ok(AddonRollouts.init.called, "startup calls AddonRollouts.init");
|
||||||
|
ok(
|
||||||
|
PreferenceExperiments.init.called,
|
||||||
|
"startup calls PreferenceExperiments.init"
|
||||||
|
);
|
||||||
|
ok(RecipeRunner.init.called, "startup calls RecipeRunner.init");
|
||||||
|
ok(TelemetryEvents.init.called, "startup calls TelemetryEvents.init");
|
||||||
ok(PreferenceRollouts.init.called, "startup calls PreferenceRollouts.init");
|
ok(PreferenceRollouts.init.called, "startup calls PreferenceRollouts.init");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -279,6 +300,7 @@ decorate_task(
|
|||||||
"startup calls PreferenceExperiments.init"
|
"startup calls PreferenceExperiments.init"
|
||||||
);
|
);
|
||||||
ok(RecipeRunner.init.called, "startup calls RecipeRunner.init");
|
ok(RecipeRunner.init.called, "startup calls RecipeRunner.init");
|
||||||
|
ok(TelemetryEvents.init.called, "startup calls TelemetryEvents.init");
|
||||||
ok(PreferenceRollouts.init.called, "startup calls PreferenceRollouts.init");
|
ok(PreferenceRollouts.init.called, "startup calls PreferenceRollouts.init");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -51,6 +51,9 @@ sinon.assert.fail = function (message) {
|
|||||||
ok(false, message);
|
ok(false, message);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Prep Telemetry to receive events from tests
|
||||||
|
TelemetryEvents.init();
|
||||||
|
|
||||||
this.TEST_XPI_URL = (function () {
|
this.TEST_XPI_URL = (function () {
|
||||||
const dir = getChromeDir(getResolvedURI(gTestPath));
|
const dir = getChromeDir(getResolvedURI(gTestPath));
|
||||||
dir.append("addons");
|
dir.append("addons");
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ const { BranchedAddonStudyAction } = ChromeUtils.importESModule(
|
|||||||
const { BaseAction } = ChromeUtils.importESModule(
|
const { BaseAction } = ChromeUtils.importESModule(
|
||||||
"resource://normandy/actions/BaseAction.sys.mjs"
|
"resource://normandy/actions/BaseAction.sys.mjs"
|
||||||
);
|
);
|
||||||
|
const { TelemetryEvents } = ChromeUtils.importESModule(
|
||||||
|
"resource://normandy/lib/TelemetryEvents.sys.mjs"
|
||||||
|
);
|
||||||
const { AddonManager } = ChromeUtils.importESModule(
|
const { AddonManager } = ChromeUtils.importESModule(
|
||||||
"resource://gre/modules/AddonManager.sys.mjs"
|
"resource://gre/modules/AddonManager.sys.mjs"
|
||||||
);
|
);
|
||||||
@@ -36,6 +39,8 @@ add_task(async () => {
|
|||||||
);
|
);
|
||||||
AddonTestUtils.overrideCertDB();
|
AddonTestUtils.overrideCertDB();
|
||||||
await AddonTestUtils.promiseStartupManager();
|
await AddonTestUtils.promiseStartupManager();
|
||||||
|
|
||||||
|
TelemetryEvents.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
decorate_task(
|
decorate_task(
|
||||||
|
|||||||
@@ -407,6 +407,8 @@ export const LoginHelper = {
|
|||||||
// Watch for pref changes to update cached pref values.
|
// Watch for pref changes to update cached pref values.
|
||||||
Services.prefs.addObserver("signon.", () => this.updateSignonPrefs());
|
Services.prefs.addObserver("signon.", () => this.updateSignonPrefs());
|
||||||
this.updateSignonPrefs();
|
this.updateSignonPrefs();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("pwmgr", true);
|
||||||
|
Services.telemetry.setEventRecordingEnabled("form_autocomplete", true);
|
||||||
|
|
||||||
// Watch for FXA Logout to reset signon.firefoxRelay to 'available'
|
// Watch for FXA Logout to reset signon.firefoxRelay to 'available'
|
||||||
// Using hard-coded value for FxAccountsCommon.ONLOGOUT_NOTIFICATION because
|
// Using hard-coded value for FxAccountsCommon.ONLOGOUT_NOTIFICATION because
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ add_setup(async function () {
|
|||||||
const canRecordExtendedOld = Services.telemetry.canRecordExtended;
|
const canRecordExtendedOld = Services.telemetry.canRecordExtended;
|
||||||
Services.telemetry.canRecordExtended = true;
|
Services.telemetry.canRecordExtended = true;
|
||||||
Services.telemetry.clearEvents();
|
Services.telemetry.clearEvents();
|
||||||
|
Services.telemetry.setEventRecordingEnabled("relay_integration", true);
|
||||||
|
|
||||||
gRelayACOptionsTitles = await new Localization([
|
gRelayACOptionsTitles = await new Localization([
|
||||||
"browser/firefoxRelay.ftl",
|
"browser/firefoxRelay.ftl",
|
||||||
@@ -185,6 +186,7 @@ add_setup(async function () {
|
|||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Services.telemetry.setEventRecordingEnabled("relay_integration", false);
|
||||||
Services.telemetry.clearEvents();
|
Services.telemetry.clearEvents();
|
||||||
Services.telemetry.canRecordExtended = canRecordExtendedOld;
|
Services.telemetry.canRecordExtended = canRecordExtendedOld;
|
||||||
sinon.restore();
|
sinon.restore();
|
||||||
|
|||||||
@@ -223,6 +223,7 @@ add_task(async function test_eventTelemetry() {
|
|||||||
url: TEST_PAGE,
|
url: TEST_PAGE,
|
||||||
},
|
},
|
||||||
async browser => {
|
async browser => {
|
||||||
|
Services.telemetry.setEventRecordingEnabled("pictureinpicture", true);
|
||||||
let videoID = "no-controls";
|
let videoID = "no-controls";
|
||||||
|
|
||||||
const PIP_PREF =
|
const PIP_PREF =
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ const DEFAULT_COLORS = {
|
|||||||
"selection-highlight": "#FFFFCC",
|
"selection-highlight": "#FFFFCC",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("readermode", true);
|
||||||
|
|
||||||
const zoomOnCtrl =
|
const zoomOnCtrl =
|
||||||
Services.prefs.getIntPref("mousewheel.with_control.action", 3) == 3;
|
Services.prefs.getIntPref("mousewheel.with_control.action", 3) == 3;
|
||||||
const zoomOnMeta =
|
const zoomOnMeta =
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||||||
const gIsFirefoxDesktop =
|
const gIsFirefoxDesktop =
|
||||||
Services.appinfo.ID == "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
|
Services.appinfo.ID == "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
|
||||||
|
|
||||||
|
Services.telemetry.setEventRecordingEnabled("readermode", true);
|
||||||
|
|
||||||
export var ReaderMode = {
|
export var ReaderMode = {
|
||||||
DEBUG: 0,
|
DEBUG: 0,
|
||||||
|
|
||||||
|
|||||||
@@ -743,6 +743,7 @@ class RelayDisabled {}
|
|||||||
class RelayFeature extends OptInFeature {
|
class RelayFeature extends OptInFeature {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(RelayOffered, RelayEnabled, RelayDisabled, gConfig.relayFeaturePref);
|
super(RelayOffered, RelayEnabled, RelayDisabled, gConfig.relayFeaturePref);
|
||||||
|
Services.telemetry.setEventRecordingEnabled("relay_integration", true);
|
||||||
// Update the config when the signon.firefoxRelay.base_url pref is changed.
|
// Update the config when the signon.firefoxRelay.base_url pref is changed.
|
||||||
// This is added mainly for tests.
|
// This is added mainly for tests.
|
||||||
Services.prefs.addObserver(
|
Services.prefs.addObserver(
|
||||||
|
|||||||
@@ -1633,6 +1633,13 @@ TelemetryImpl::ClearEvents() {
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
TelemetryImpl::SetEventRecordingEnabled(const nsACString& aCategory,
|
||||||
|
bool aEnabled) {
|
||||||
|
TelemetryEvent::SetEventRecordingEnabled(aCategory, aEnabled);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
TelemetryImpl::FlushBatchedChildTelemetry() {
|
TelemetryImpl::FlushBatchedChildTelemetry() {
|
||||||
TelemetryIPCAccumulator::IPCTimerFired(nullptr, nullptr);
|
TelemetryIPCAccumulator::IPCTimerFired(nullptr, nullptr);
|
||||||
@@ -2005,6 +2012,10 @@ void ScalarSetMaximum(mozilla::Telemetry::ScalarID aId, const nsAString& aKey,
|
|||||||
TelemetryScalar::SetMaximum(aId, aKey, aVal);
|
TelemetryScalar::SetMaximum(aId, aKey, aVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetEventRecordingEnabled(const nsACString& aCategory, bool aEnabled) {
|
||||||
|
TelemetryEvent::SetEventRecordingEnabled(aCategory, aEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
void ShutdownTelemetry() { TelemetryImpl::ShutdownTelemetry(); }
|
void ShutdownTelemetry() { TelemetryImpl::ShutdownTelemetry(); }
|
||||||
|
|
||||||
} // namespace mozilla::Telemetry
|
} // namespace mozilla::Telemetry
|
||||||
|
|||||||
@@ -549,6 +549,16 @@ class MOZ_RAII AutoScalarTimer {
|
|||||||
const nsString key;
|
const nsString key;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables recording of events in a category.
|
||||||
|
* Events default to recording disabled.
|
||||||
|
* This toggles recording for all events in the specified category.
|
||||||
|
*
|
||||||
|
* @param aCategory The category name.
|
||||||
|
* @param aEnabled Whether recording should be enabled or disabled.
|
||||||
|
*/
|
||||||
|
void SetEventRecordingEnabled(const nsACString& aCategory, bool aEnabled);
|
||||||
|
|
||||||
} // namespace Telemetry
|
} // namespace Telemetry
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
|||||||
@@ -334,6 +334,9 @@ nsTHashMap<nsCStringHashKey, EventKey> gEventNameIDMap(kEventCount);
|
|||||||
// The CategoryName set.
|
// The CategoryName set.
|
||||||
nsTHashSet<nsCString> gCategoryNames;
|
nsTHashSet<nsCString> gCategoryNames;
|
||||||
|
|
||||||
|
// This tracks the IDs of the categories for which recording is enabled.
|
||||||
|
nsTHashSet<nsCString> gEnabledCategories;
|
||||||
|
|
||||||
// The main event storage. Events are inserted here, keyed by process id and
|
// The main event storage. Events are inserted here, keyed by process id and
|
||||||
// in recording order.
|
// in recording order.
|
||||||
typedef nsUint32HashKey ProcessIDHashKey;
|
typedef nsUint32HashKey ProcessIDHashKey;
|
||||||
@@ -371,6 +374,19 @@ unsigned int GetDataset(const StaticMutexAutoLock& lock,
|
|||||||
: nsITelemetry::DATASET_PRERELEASE_CHANNELS;
|
: nsITelemetry::DATASET_PRERELEASE_CHANNELS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsCString GetCategory(const StaticMutexAutoLock& lock,
|
||||||
|
const EventKey& eventKey) {
|
||||||
|
if (!eventKey.dynamic) {
|
||||||
|
return gEventInfo[eventKey.id].common_info.category();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gDynamicEventInfo) {
|
||||||
|
return ""_ns;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (*gDynamicEventInfo)[eventKey.id].category;
|
||||||
|
}
|
||||||
|
|
||||||
bool CanRecordEvent(const StaticMutexAutoLock& lock, const EventKey& eventKey,
|
bool CanRecordEvent(const StaticMutexAutoLock& lock, const EventKey& eventKey,
|
||||||
ProcessID process) {
|
ProcessID process) {
|
||||||
if (!gCanRecordBase) {
|
if (!gCanRecordBase) {
|
||||||
@@ -481,10 +497,16 @@ RecordEventResult RecordEvent(const StaticMutexAutoLock& lock,
|
|||||||
return RecordEventResult::CannotRecord;
|
return RecordEventResult::CannotRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count the number of times this event has been recorded.
|
// Count the number of times this event has been recorded, even if its
|
||||||
|
// category does not have recording enabled.
|
||||||
TelemetryScalar::SummarizeEvent(UniqueEventName(category, method, object),
|
TelemetryScalar::SummarizeEvent(UniqueEventName(category, method, object),
|
||||||
processType, dynamicNonBuiltin);
|
processType, dynamicNonBuiltin);
|
||||||
|
|
||||||
|
// Check whether this event's category has recording enabled
|
||||||
|
if (!gEnabledCategories.Contains(GetCategory(lock, eventKey))) {
|
||||||
|
return RecordEventResult::Ok;
|
||||||
|
}
|
||||||
|
|
||||||
EventRecordArray* eventRecords = GetEventRecordsForProcess(lock, processType);
|
EventRecordArray* eventRecords = GetEventRecordsForProcess(lock, processType);
|
||||||
eventRecords->AppendElement(EventRecord(timestamp, eventKey, value, extra));
|
eventRecords->AppendElement(EventRecord(timestamp, eventKey, value, extra));
|
||||||
|
|
||||||
@@ -560,6 +582,12 @@ void RegisterEvents(const StaticMutexAutoLock& lock, const nsACString& category,
|
|||||||
if (aBuiltin) {
|
if (aBuiltin) {
|
||||||
gCategoryNames.Insert(category);
|
gCategoryNames.Insert(category);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!aBuiltin) {
|
||||||
|
// Now after successful registration enable recording for this category
|
||||||
|
// (if not a dynamic builtin).
|
||||||
|
gEnabledCategories.Insert(category);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
@@ -722,6 +750,9 @@ void TelemetryEvent::InitializeGlobalState(bool aCanRecordBase,
|
|||||||
gCategoryNames.Insert(info.common_info.category());
|
gCategoryNames.Insert(info.common_info.category());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A hack until bug 1691156 is fixed
|
||||||
|
gEnabledCategories.Insert("avif"_ns);
|
||||||
|
|
||||||
gInitDone = true;
|
gInitDone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -734,6 +765,7 @@ void TelemetryEvent::DeInitializeGlobalState() {
|
|||||||
|
|
||||||
gEventNameIDMap.Clear();
|
gEventNameIDMap.Clear();
|
||||||
gCategoryNames.Clear();
|
gCategoryNames.Clear();
|
||||||
|
gEnabledCategories.Clear();
|
||||||
gEventRecords.Clear();
|
gEventRecords.Clear();
|
||||||
|
|
||||||
gDynamicEventInfo = nullptr;
|
gDynamicEventInfo = nullptr;
|
||||||
@@ -1348,6 +1380,27 @@ void TelemetryEvent::ClearEvents() {
|
|||||||
gEventRecords.Clear();
|
gEventRecords.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TelemetryEvent::SetEventRecordingEnabled(const nsACString& category,
|
||||||
|
bool enabled) {
|
||||||
|
StaticMutexAutoLock locker(gTelemetryEventsMutex);
|
||||||
|
|
||||||
|
if (!gCategoryNames.Contains(category)) {
|
||||||
|
LogToBrowserConsole(
|
||||||
|
nsIScriptError::warningFlag,
|
||||||
|
NS_ConvertUTF8toUTF16(
|
||||||
|
nsLiteralCString(
|
||||||
|
"Unknown category for SetEventRecordingEnabled: ") +
|
||||||
|
category));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enabled) {
|
||||||
|
gEnabledCategories.Insert(category);
|
||||||
|
} else {
|
||||||
|
gEnabledCategories.Remove(category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
size_t TelemetryEvent::SizeOfIncludingThis(
|
size_t TelemetryEvent::SizeOfIncludingThis(
|
||||||
mozilla::MallocSizeOf aMallocSizeOf) {
|
mozilla::MallocSizeOf aMallocSizeOf) {
|
||||||
StaticMutexAutoLock locker(gTelemetryEventsMutex);
|
StaticMutexAutoLock locker(gTelemetryEventsMutex);
|
||||||
@@ -1374,6 +1427,7 @@ size_t TelemetryEvent::SizeOfIncludingThis(
|
|||||||
}
|
}
|
||||||
|
|
||||||
n += gCategoryNames.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
n += gCategoryNames.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||||
|
n += gEnabledCategories.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||||
|
|
||||||
if (gDynamicEventInfo) {
|
if (gDynamicEventInfo) {
|
||||||
n += gDynamicEventInfo->ShallowSizeOfIncludingThis(aMallocSizeOf);
|
n += gDynamicEventInfo->ShallowSizeOfIncludingThis(aMallocSizeOf);
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ nsresult RecordEvent(const nsACString& aCategory, const nsACString& aMethod,
|
|||||||
JS::Handle<JS::Value> aExtra, JSContext* aCx,
|
JS::Handle<JS::Value> aExtra, JSContext* aCx,
|
||||||
uint8_t optional_argc);
|
uint8_t optional_argc);
|
||||||
|
|
||||||
|
void SetEventRecordingEnabled(const nsACString& aCategory, bool aEnabled);
|
||||||
nsresult RegisterEvents(const nsACString& aCategory,
|
nsresult RegisterEvents(const nsACString& aCategory,
|
||||||
JS::Handle<JS::Value> aEventData, bool aBuiltin,
|
JS::Handle<JS::Value> aEventData, bool aBuiltin,
|
||||||
JSContext* cx);
|
JSContext* cx);
|
||||||
|
|||||||
@@ -529,6 +529,16 @@ interface nsITelemetry : nsISupports
|
|||||||
[implicit_jscontext, optional_argc]
|
[implicit_jscontext, optional_argc]
|
||||||
void recordEvent(in ACString aCategory, in ACString aMethod, in ACString aObject, [optional] in jsval aValue, [optional] in jsval extra);
|
void recordEvent(in ACString aCategory, in ACString aMethod, in ACString aObject, [optional] in jsval aValue, [optional] in jsval extra);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable recording of events in a category.
|
||||||
|
* Events default to recording disabled. This allows to toggle recording for all events
|
||||||
|
* in the specified category.
|
||||||
|
*
|
||||||
|
* @param aCategory The category name.
|
||||||
|
* @param aEnabled Whether recording is enabled for events in that category.
|
||||||
|
*/
|
||||||
|
void setEventRecordingEnabled(in ACString aCategory, in boolean aEnabled);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serializes the recorded events to a JSON-appropriate array and optionally resets them.
|
* Serializes the recorded events to a JSON-appropriate array and optionally resets them.
|
||||||
* The returned structure looks like this:
|
* The returned structure looks like this:
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user