зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
d1a6774d15
Коммит
fc1cd91320
|
@ -31,6 +31,10 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
let gSearchBannerShownThisSession;
|
||||
|
||||
export class AboutPrivateBrowsingParent extends JSWindowActorParent {
|
||||
constructor() {
|
||||
super();
|
||||
Services.telemetry.setEventRecordingEnabled("aboutprivatebrowsing", true);
|
||||
}
|
||||
// Used by tests
|
||||
static setShownThisSession(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
|
||||
pref("app.feedback.baseURL", "https://ideas.mozilla.org/");
|
||||
|
||||
pref("security.certerrors.recordEventTelemetry", true);
|
||||
pref("security.certerrors.permanentOverride", true);
|
||||
pref("security.certerrors.mitm.priming.enabled", true);
|
||||
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.sidebar", true);
|
||||
|
||||
pref("security.protectionspopup.recordEventTelemetry", true);
|
||||
|
||||
// Block insecure active content on https pages
|
||||
pref("security.mixed_content.block_active_content", true);
|
||||
|
||||
|
|
|
@ -936,6 +936,7 @@ var gBrowserInit = {
|
|||
"resource:///modules/DownloadsMacFinderProgress.sys.mjs"
|
||||
).DownloadsMacFinderProgress.register();
|
||||
}
|
||||
Services.telemetry.setEventRecordingEnabled("downloads", true);
|
||||
} catch (ex) {
|
||||
console.error(ex);
|
||||
}
|
||||
|
|
|
@ -806,6 +806,8 @@ function updateFxaToolbarMenu(enable, isInitialUpdate = false) {
|
|||
|
||||
fxaPanelEl.addEventListener("ViewShowing", gSync.updateSendToDeviceTitle);
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("fxa_app_menu", true);
|
||||
|
||||
if (enable && syncEnabled) {
|
||||
mainWindowEl.setAttribute("fxatoolbarmenu", "visible");
|
||||
|
||||
|
@ -815,6 +817,8 @@ function updateFxaToolbarMenu(enable, isInitialUpdate = false) {
|
|||
if (!isInitialUpdate) {
|
||||
gSync.maybeUpdateUIState();
|
||||
}
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("fxa_avatar_menu", true);
|
||||
} else {
|
||||
mainWindowEl.removeAttribute("fxatoolbarmenu");
|
||||
}
|
||||
|
@ -7603,6 +7607,7 @@ var FirefoxViewHandler = {
|
|||
let viewCount = Services.prefs.getIntPref(PREF_NAME, 0);
|
||||
|
||||
// Record telemetry
|
||||
Services.telemetry.setEventRecordingEnabled("firefoxview_next", true);
|
||||
Glean.firefoxviewNext.tabSelectedToolbarbutton.record();
|
||||
|
||||
if (viewCount < MAX_VIEW_COUNT) {
|
||||
|
|
|
@ -6,8 +6,11 @@
|
|||
const ISSUED_BY_CCA_SITE = "https://issued-by-cca.example.com";
|
||||
const UNKNOWN_ISSUER_SITE = "https://untrusted.example.com";
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("security.ui.certerror", true);
|
||||
|
||||
registerCleanupFunction(async () => {
|
||||
await resetTelemetry();
|
||||
Services.telemetry.setEventRecordingEnabled("security.ui.certerror", false);
|
||||
});
|
||||
|
||||
async function resetTelemetry() {
|
||||
|
|
|
@ -40,6 +40,11 @@ add_task(async function checkTelemetryClickEvents() {
|
|||
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]) {
|
||||
let recordedObjects = [
|
||||
"advanced_button",
|
||||
|
@ -148,4 +153,12 @@ add_task(async function checkTelemetryClickEvents() {
|
|||
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;
|
||||
return !events || !events.length;
|
||||
});
|
||||
Services.telemetry.setEventRecordingEnabled("security.ui.tlserror", true);
|
||||
}
|
||||
|
||||
async function checkTelemetry(errorString, nssError) {
|
||||
|
|
|
@ -50,6 +50,7 @@ async function verifyError(url, fallbackWarning, testName) {
|
|||
).content;
|
||||
return !events || !events.length;
|
||||
});
|
||||
Services.telemetry.setEventRecordingEnabled("security.doh.neterror", true);
|
||||
|
||||
let browser;
|
||||
let pageLoaded;
|
||||
|
|
|
@ -89,6 +89,7 @@ add_task(async function TRROnlyExceptionButtonTelemetry() {
|
|||
).content;
|
||||
return !events || !events.length;
|
||||
});
|
||||
Services.telemetry.setEventRecordingEnabled("security.doh.neterror", true);
|
||||
|
||||
let browser = await loadErrorPage();
|
||||
|
||||
|
|
|
@ -1346,6 +1346,10 @@ nsDefaultCommandLineHandler.prototype = {
|
|||
}
|
||||
|
||||
if (notificationData?.privilegedName) {
|
||||
Services.telemetry.setEventRecordingEnabled(
|
||||
"browser.launched_to_handle",
|
||||
true
|
||||
);
|
||||
Glean.browserLaunchedToHandle.systemNotification.record({
|
||||
name: notificationData.privilegedName,
|
||||
});
|
||||
|
|
|
@ -1361,6 +1361,10 @@ BrowserGlue.prototype = {
|
|||
// If we don't start with last profile, the user
|
||||
// likely sees the profile selector on launch.
|
||||
if (Services.prefs.getBoolPref(launchOnLoginPref)) {
|
||||
Services.telemetry.setEventRecordingEnabled(
|
||||
"launch_on_login",
|
||||
true
|
||||
);
|
||||
Glean.launchOnLogin.lastProfileDisableStartup.record();
|
||||
}
|
||||
Services.prefs.setBoolPref(launchOnLoginPref, false);
|
||||
|
@ -1946,6 +1950,13 @@ BrowserGlue.prototype = {
|
|||
|
||||
lazy.NewTabUtils.init();
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled(
|
||||
"security.ui.protections",
|
||||
true
|
||||
);
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("security.doh.neterror", true);
|
||||
|
||||
lazy.PageActions.init();
|
||||
|
||||
lazy.DoHController.init();
|
||||
|
@ -2088,6 +2099,13 @@ BrowserGlue.prototype = {
|
|||
},
|
||||
|
||||
_recordContentBlockingTelemetry() {
|
||||
Services.telemetry.setEventRecordingEnabled(
|
||||
"security.ui.protectionspopup",
|
||||
Services.prefs.getBoolPref(
|
||||
"security.protectionspopup.recordEventTelemetry"
|
||||
)
|
||||
);
|
||||
|
||||
let tpEnabled = Services.prefs.getBoolPref(
|
||||
"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
|
||||
// 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
|
||||
|
@ -4711,6 +4747,7 @@ BrowserGlue.prototype = {
|
|||
})();
|
||||
|
||||
// Record why the dialog is showing or not.
|
||||
Services.telemetry.setEventRecordingEnabled("upgrade_dialog", true);
|
||||
Glean.upgradeDialog.triggerReason.record({
|
||||
value: dialogReason || "satisfied",
|
||||
});
|
||||
|
@ -5174,6 +5211,12 @@ BrowserGlue.prototype = {
|
|||
},
|
||||
|
||||
_collectTelemetryPiPEnabled() {
|
||||
Services.telemetry.setEventRecordingEnabled(
|
||||
"pictureinpicture.settings",
|
||||
true
|
||||
);
|
||||
Services.telemetry.setEventRecordingEnabled("pictureinpicture", true);
|
||||
|
||||
const TOGGLE_ENABLED_PREF =
|
||||
"media.videocontrols.picture-in-picture.video-toggle.enabled";
|
||||
|
||||
|
|
|
@ -416,6 +416,7 @@ const TEST_GLOBAL = {
|
|||
notifyObservers() {},
|
||||
},
|
||||
telemetry: {
|
||||
setEventRecordingEnabled: () => {},
|
||||
recordEvent: _eventDetails => {},
|
||||
scalarSet: () => {},
|
||||
keyedScalarAdd: () => {},
|
||||
|
|
|
@ -689,6 +689,7 @@ export class _ASRouter {
|
|||
this._onExperimentEnrollmentsUpdated =
|
||||
this._onExperimentEnrollmentsUpdated.bind(this);
|
||||
this.forcePBWindow = this.forcePBWindow.bind(this);
|
||||
Services.telemetry.setEventRecordingEnabled("messaging_experiments", true);
|
||||
this.messagesEnabledInAutomation = [];
|
||||
}
|
||||
|
||||
|
|
|
@ -424,6 +424,7 @@ const TEST_GLOBAL = {
|
|||
notifyObservers() {},
|
||||
},
|
||||
telemetry: {
|
||||
setEventRecordingEnabled: () => {},
|
||||
scalarSet: () => {},
|
||||
keyedScalarAdd: () => {},
|
||||
},
|
||||
|
|
|
@ -110,6 +110,9 @@ const NATIVE_FALLBACK_WARNING_PREF = "network.trr.display_fallback_warning";
|
|||
const NATIVE_FALLBACK_WARNING_HEURISTIC_LIST_PREF =
|
||||
"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 kConnectivityTopic = "network:captive-portal-connectivity-changed";
|
||||
const kPrefChangedTopic = "nsPref:changed";
|
||||
|
@ -140,6 +143,15 @@ export const DoHController = {
|
|||
_heuristicsAreEnabled: false,
|
||||
|
||||
async init() {
|
||||
Services.telemetry.setEventRecordingEnabled(
|
||||
HEURISTICS_TELEMETRY_CATEGORY,
|
||||
true
|
||||
);
|
||||
Services.telemetry.setEventRecordingEnabled(
|
||||
TRRSELECT_TELEMETRY_CATEGORY,
|
||||
true
|
||||
);
|
||||
|
||||
await lazy.DoHConfigController.initComplete;
|
||||
|
||||
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
|
||||
* after 5 attempts.
|
||||
*/
|
||||
Services.telemetry.setEventRecordingEnabled(
|
||||
"security.doh.trrPerformance",
|
||||
true
|
||||
);
|
||||
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
|
|
|
@ -43,6 +43,11 @@ let gHasOpenedBefore = false;
|
|||
* the associated MigrationWizardChild.
|
||||
*/
|
||||
export class MigrationWizardParent extends JSWindowActorParent {
|
||||
constructor() {
|
||||
super();
|
||||
Services.telemetry.setEventRecordingEnabled("browser.migration", true);
|
||||
}
|
||||
|
||||
didDestroy() {
|
||||
Services.obs.notifyObservers(this, "MigrationWizard:Destroyed");
|
||||
MigrationUtils.finishMigration();
|
||||
|
|
|
@ -1499,6 +1499,11 @@ export class TelemetryFeed {
|
|||
// 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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ const EXTRAS_FIELD_NAMES = [
|
|||
|
||||
export class UTEventReporting {
|
||||
constructor() {
|
||||
Services.telemetry.setEventRecordingEnabled("activity_stream", true);
|
||||
this.sendUserEvent = this.sendUserEvent.bind(this);
|
||||
this.sendSessionEndEvent = this.sendSessionEndEvent.bind(this);
|
||||
}
|
||||
|
@ -47,4 +48,8 @@ export class UTEventReporting {
|
|||
this._createExtras(data, data.session_duration)
|
||||
);
|
||||
}
|
||||
|
||||
uninit() {
|
||||
Services.telemetry.setEventRecordingEnabled("activity_stream", false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ describe("UTEventReporting", () => {
|
|||
beforeEach(() => {
|
||||
globals = new GlobalOverrider();
|
||||
sandbox = globals.sandbox;
|
||||
sandbox.stub(global.Services.telemetry, "setEventRecordingEnabled");
|
||||
|
||||
utEvents = new UTEventReporting();
|
||||
});
|
||||
|
@ -83,4 +84,27 @@ describe("UTEventReporting", () => {
|
|||
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() {},
|
||||
},
|
||||
telemetry: {
|
||||
setEventRecordingEnabled: () => {},
|
||||
recordEvent: _eventDetails => {},
|
||||
scalarSet: () => {},
|
||||
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() {
|
||||
info(
|
||||
"TelemetryFeed.uninit should make this.browserOpenNewtabStart() stop " +
|
||||
|
|
|
@ -1397,6 +1397,12 @@ var gMainPane = {
|
|||
},
|
||||
|
||||
initPrimaryBrowserLanguageUI() {
|
||||
// Enable telemetry.
|
||||
Services.telemetry.setEventRecordingEnabled(
|
||||
"intl.ui.browserLanguage",
|
||||
true
|
||||
);
|
||||
|
||||
// This will register the "command" listener.
|
||||
let menulist = document.getElementById("primaryBrowserLocale");
|
||||
new SelectionChangedMenulist(menulist, event => {
|
||||
|
|
|
@ -191,6 +191,7 @@ function init_all() {
|
|||
// Asks Preferences to queue an update of the attribute values of
|
||||
// the entire document.
|
||||
Preferences.queueUpdateOfAllElements();
|
||||
Services.telemetry.setEventRecordingEnabled("aboutpreferences", true);
|
||||
|
||||
register_module("paneGeneral", gMainPane);
|
||||
register_module("paneHome", gHomePane);
|
||||
|
|
|
@ -882,6 +882,8 @@ var gPrivacyPane = {
|
|||
* Init DoH corresponding prefs
|
||||
*/
|
||||
initDoH() {
|
||||
Services.telemetry.setEventRecordingEnabled("security.doh.settings", true);
|
||||
|
||||
setEventListener("dohDefaultArrow", "command", this.toggleExpansion);
|
||||
setEventListener("dohEnabledArrow", "command", this.toggleExpansion);
|
||||
setEventListener("dohStrictArrow", "command", this.toggleExpansion);
|
||||
|
@ -990,6 +992,10 @@ var gPrivacyPane = {
|
|||
this._initTrackingProtectionExtensionControl();
|
||||
this._initThirdPartyCertsToggle();
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("privacy.ui.fpp", true);
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("pwmgr", true);
|
||||
|
||||
Preferences.get("privacy.trackingprotection.enabled").on(
|
||||
"change",
|
||||
gPrivacyPane.trackingProtectionReadPrefs.bind(gPrivacyPane)
|
||||
|
|
|
@ -141,6 +141,7 @@ add_task(async function testwhenPrefDisabled() {
|
|||
|
||||
add_task(async function test_aboutpreferences_event_telemetry() {
|
||||
Services.telemetry.clearEvents();
|
||||
Services.telemetry.setEventRecordingEnabled("aboutpreferences", true);
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.preferences.moreFromMozilla", true]],
|
||||
|
|
|
@ -102,6 +102,8 @@ add_task(async function checkTelemetryLoadEvents() {
|
|||
return !events || !events.length;
|
||||
});
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("security.ui.protections", true);
|
||||
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab({
|
||||
url: "about:protections",
|
||||
gBrowser,
|
||||
|
@ -197,6 +199,8 @@ add_task(async function checkTelemetryClickEvents() {
|
|||
return !events || !events.length;
|
||||
});
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("security.ui.protections", true);
|
||||
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab({
|
||||
url: "about:protections",
|
||||
gBrowser,
|
||||
|
@ -800,6 +804,8 @@ add_task(async function checkTelemetryLoadEventForEntrypoint() {
|
|||
return !events || !events.length;
|
||||
});
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("security.ui.protections", true);
|
||||
|
||||
info("Typo in 'entrypoint' should not be recorded");
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab({
|
||||
url: "about:protections?entryPoint=newPage",
|
||||
|
@ -882,6 +888,8 @@ add_task(async function checkTelemetryClickEventsVPN() {
|
|||
).content;
|
||||
return !events || !events.length;
|
||||
});
|
||||
Services.telemetry.setEventRecordingEnabled("security.ui.protections", true);
|
||||
|
||||
// user is not subscribed to VPN, and is in the us
|
||||
AboutProtectionsParent.setTestOverride(getVPNOverrides(false, "us"));
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
|
@ -1047,6 +1055,7 @@ add_task(async function checkTelemetryEventsVPNBanner() {
|
|||
return !events || !events.length;
|
||||
});
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("security.ui.protections", true);
|
||||
// User is not subscribed to VPN
|
||||
AboutProtectionsParent.setTestOverride(getVPNOverrides(false, "us"));
|
||||
|
||||
|
|
|
@ -176,6 +176,7 @@ export var ScreenshotsUtils = {
|
|||
return;
|
||||
}
|
||||
this.resetMethodsUsed();
|
||||
Services.telemetry.setEventRecordingEnabled("screenshots", true);
|
||||
Services.obs.addObserver(this, "menuitem-screenshot");
|
||||
this.initialized = true;
|
||||
if (Cu.isInAutomation) {
|
||||
|
|
|
@ -195,6 +195,7 @@ var SessionFileInternal = {
|
|||
},
|
||||
|
||||
async _readInternal(useOldExtension) {
|
||||
Services.telemetry.setEventRecordingEnabled("session_restore", true);
|
||||
let result;
|
||||
let noFilesFound = true;
|
||||
this._usingOldExtension = useOldExtension;
|
||||
|
|
|
@ -87,6 +87,9 @@ add_setup(async function () {
|
|||
let oldCanRecord = Services.telemetry.canRecordExtended;
|
||||
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
|
||||
// test when it selects results in the urlbar.
|
||||
await PlacesUtils.history.clear();
|
||||
|
@ -97,6 +100,7 @@ add_setup(async function () {
|
|||
Services.telemetry.canRecordExtended = oldCanRecord;
|
||||
await PlacesUtils.history.clear();
|
||||
await PlacesUtils.bookmarks.eraseEverything();
|
||||
Services.telemetry.setEventRecordingEnabled("navigation", false);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -28,10 +28,14 @@ add_setup(async () => {
|
|||
let cleanup = await installPersistTestEngines();
|
||||
testEngine = Services.search.getEngineByName("Example");
|
||||
|
||||
// Enable event recording for the events.
|
||||
Services.telemetry.setEventRecordingEnabled("navigation", true);
|
||||
|
||||
registerCleanupFunction(async function () {
|
||||
await PlacesUtils.history.clear();
|
||||
Services.telemetry.clearScalars();
|
||||
Services.telemetry.clearEvents();
|
||||
Services.telemetry.setEventRecordingEnabled("navigation", false);
|
||||
cleanup();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -102,6 +102,9 @@ add_setup(async function () {
|
|||
let oldCanRecord = Services.telemetry.canRecordExtended;
|
||||
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
|
||||
// test when it selects results in the urlbar.
|
||||
await PlacesUtils.history.clear();
|
||||
|
@ -118,6 +121,7 @@ add_setup(async function () {
|
|||
Services.telemetry.canRecordExtended = oldCanRecord;
|
||||
await PlacesUtils.history.clear();
|
||||
await PlacesUtils.bookmarks.eraseEverything();
|
||||
Services.telemetry.setEventRecordingEnabled("navigation", false);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -90,6 +90,9 @@ add_setup(async function () {
|
|||
let oldCanRecord = Services.telemetry.canRecordExtended;
|
||||
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
|
||||
// test when it selects results in the urlbar.
|
||||
await PlacesUtils.history.clear();
|
||||
|
@ -146,6 +149,7 @@ add_setup(async function () {
|
|||
Services.telemetry.canRecordExtended = oldCanRecord;
|
||||
await PlacesUtils.history.clear();
|
||||
await PlacesUtils.bookmarks.eraseEverything();
|
||||
Services.telemetry.setEventRecordingEnabled("navigation", false);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -125,6 +125,7 @@ add_setup(async function () {
|
|||
registerCleanupFunction(async function () {
|
||||
Services.telemetry.canRecordExtended = oldCanRecord;
|
||||
await PlacesUtils.history.clear();
|
||||
Services.telemetry.setEventRecordingEnabled("navigation", false);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -292,6 +292,7 @@ add_task(async function test_remote_tab_result() {
|
|||
SyncedTabs._internal = originalSyncedTabsInternal;
|
||||
await PlacesUtils.history.clear();
|
||||
await PlacesUtils.bookmarks.eraseEverything();
|
||||
Services.telemetry.setEventRecordingEnabled("navigation", false);
|
||||
});
|
||||
|
||||
await BrowserTestUtils.withNewTab({ gBrowser }, async () => {
|
||||
|
|
|
@ -264,8 +264,14 @@ add_setup(async function () {
|
|||
],
|
||||
});
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled(EVENT_CATEGORY, true);
|
||||
|
||||
Services.telemetry.clearEvents();
|
||||
Services.telemetry.clearScalars();
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
Services.telemetry.setEventRecordingEnabled(EVENT_CATEGORY, false);
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_popup_opened() {
|
||||
|
|
|
@ -37,6 +37,10 @@ function assertGleanTelemetry(events, expected_number_of_flowid = 1) {
|
|||
}
|
||||
|
||||
add_setup(async function () {
|
||||
Services.telemetry.setEventRecordingEnabled("creditcard", true);
|
||||
registerCleanupFunction(async function () {
|
||||
Services.telemetry.setEventRecordingEnabled("creditcard", false);
|
||||
});
|
||||
await clearGleanTelemetry();
|
||||
});
|
||||
|
||||
|
|
|
@ -191,6 +191,10 @@ async function openTabAndUseCreditCard(
|
|||
}
|
||||
|
||||
add_setup(async function () {
|
||||
Services.telemetry.setEventRecordingEnabled("creditcard", true);
|
||||
registerCleanupFunction(async function () {
|
||||
Services.telemetry.setEventRecordingEnabled("creditcard", false);
|
||||
});
|
||||
await clearGleanTelemetry();
|
||||
});
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ const SEARCH_TOPIC_ENGINE_MODIFIED = "browser-search-engine-modified";
|
|||
|
||||
this.addonsSearchDetection = class extends ExtensionAPI {
|
||||
getAPI(context) {
|
||||
Services.telemetry.setEventRecordingEnabled("addonsSearchDetection", true);
|
||||
const { extension } = context;
|
||||
|
||||
// We want to temporarily store the first monitored URLs that have been
|
||||
|
|
|
@ -1567,6 +1567,7 @@ export let BrowserUsageTelemetry = {
|
|||
let { installer_type, extra } = data;
|
||||
|
||||
// Record the event (mirrored to legacy telemetry using GIFFT)
|
||||
Services.telemetry.setEventRecordingEnabled("installation", true);
|
||||
if (installer_type == "full") {
|
||||
Glean.installation.firstSeenFull.record(extra);
|
||||
} else if (installer_type == "stub") {
|
||||
|
|
|
@ -76,6 +76,8 @@ export let HomePage = {
|
|||
return;
|
||||
}
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("homepage", true);
|
||||
|
||||
// Now we have the values, listen for future updates.
|
||||
this._ignoreListListener = this._handleIgnoreListUpdated.bind(this);
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ export var PartnerLinkAttribution = {
|
|||
async makeRequest({ targetURL, source, campaignID }) {
|
||||
let partner = targetURL.match(/^https?:\/\/(?:www.)?([^.]*)/)[1];
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("partner_link", true);
|
||||
let extra = { value: partner };
|
||||
if (source == "newtab") {
|
||||
Glean.partnerLink.clickNewtab.record(extra);
|
||||
|
|
|
@ -92,6 +92,7 @@ export var ProcessHangMonitor = {
|
|||
Services.obs.addObserver(this, "quit-application-granted");
|
||||
Services.obs.addObserver(this, "xpcom-shutdown");
|
||||
Services.ww.registerNotification(this);
|
||||
Services.telemetry.setEventRecordingEnabled("slow_script_warning", true);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -103,6 +103,7 @@ function DevTools() {
|
|||
|
||||
EventEmitter.decorate(this);
|
||||
this._telemetry = new Telemetry();
|
||||
this._telemetry.setEventRecordingEnabled(true);
|
||||
|
||||
// List of all commands of debugged local Web Extension.
|
||||
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 CATEGORY = "devtools.main";
|
||||
|
||||
// Object to be shared among all instances.
|
||||
const PENDING_EVENT_PROPERTIES = new WeakMapMap();
|
||||
const PENDING_EVENTS = new WeakMapMap();
|
||||
|
@ -48,6 +50,7 @@ class Telemetry {
|
|||
this.keyedScalarAdd = this.keyedScalarAdd.bind(this);
|
||||
this.keyedScalarSet = this.keyedScalarSet.bind(this);
|
||||
this.recordEvent = this.recordEvent.bind(this);
|
||||
this.setEventRecordingEnabled = this.setEventRecordingEnabled.bind(this);
|
||||
this.preparePendingEvent = this.preparePendingEvent.bind(this);
|
||||
this.addEventProperty = this.addEventProperty.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
|
||||
* 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...
|
||||
|
||||
```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
|
||||
// telemetry event using:
|
||||
// this._telemetry.recordEvent(method, object, value, extra) e.g.
|
||||
|
|
|
@ -45,6 +45,7 @@ export const DevToolsShim = {
|
|||
get telemetry() {
|
||||
if (!this._telemetry) {
|
||||
this._telemetry = new lazy.Telemetry();
|
||||
this._telemetry.setEventRecordingEnabled(true);
|
||||
}
|
||||
return this._telemetry;
|
||||
},
|
||||
|
|
|
@ -330,6 +330,7 @@ DevToolsStartup.prototype = {
|
|||
get telemetry() {
|
||||
if (!this._telemetry) {
|
||||
this._telemetry = new lazy.Telemetry();
|
||||
this._telemetry.setEventRecordingEnabled(true);
|
||||
}
|
||||
return this._telemetry;
|
||||
},
|
||||
|
|
|
@ -166,6 +166,7 @@
|
|||
#include "mozilla/net/CookieKey.h"
|
||||
#include "mozilla/net/TRRService.h"
|
||||
#include "mozilla/TelemetryComms.h"
|
||||
#include "mozilla/TelemetryEventEnums.h"
|
||||
#include "mozilla/RemoteLazyInputStreamParent.h"
|
||||
#include "mozilla/widget/RemoteLookAndFeel.h"
|
||||
#include "mozilla/widget/ScreenManager.h"
|
||||
|
@ -1203,9 +1204,17 @@ IPCResult ContentParent::RecvAttributionConversion(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
Atomic<bool, mozilla::Relaxed> sContentParentTelemetryEventEnabled(false);
|
||||
|
||||
/*static*/
|
||||
void ContentParent::LogAndAssertFailedPrincipalValidationInfo(
|
||||
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
|
||||
nsAutoCString principalScheme, principalType, spec;
|
||||
mozilla::glean::security::FissionPrincipalsExtra extra = {};
|
||||
|
|
|
@ -1510,6 +1510,8 @@ QuotaManager::Observer::Observe(nsISupports* aSubject, const char* aTopic,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
Telemetry::SetEventRecordingEnabled("dom.quota.try"_ns, true);
|
||||
|
||||
gBasePath = new nsString();
|
||||
|
||||
nsCOMPtr<nsIFile> baseDir;
|
||||
|
@ -1596,6 +1598,8 @@ QuotaManager::Observer::Observe(nsISupports* aSubject, const char* aTopic,
|
|||
|
||||
gBuildId = nullptr;
|
||||
|
||||
Telemetry::SetEventRecordingEnabled("dom.quota.try"_ns, false);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/StaticPrefs_dom.h"
|
||||
#include "mozilla/StaticPrefs_security.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsMimeTypes.h"
|
||||
|
||||
|
@ -56,6 +57,7 @@
|
|||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::Telemetry;
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsContentSecurityManager, nsIContentSecurityManager,
|
||||
nsIChannelEventSink)
|
||||
|
@ -69,6 +71,7 @@ Atomic<bool, mozilla::Relaxed> sJSHacksChecked(false);
|
|||
Atomic<bool, mozilla::Relaxed> sJSHacksPresent(false);
|
||||
Atomic<bool, mozilla::Relaxed> sCSSHacksChecked(false);
|
||||
Atomic<bool, mozilla::Relaxed> sCSSHacksPresent(false);
|
||||
Atomic<bool, mozilla::Relaxed> sTelemetryEventEnabled(false);
|
||||
|
||||
/* static */
|
||||
bool nsContentSecurityManager::AllowTopLevelNavigationToDataURI(
|
||||
|
@ -835,6 +838,11 @@ void nsContentSecurityManager::MeasureUnexpectedPrivilegedLoads(
|
|||
MOZ_LOG(sCSMLog, LogLevel::Debug,
|
||||
("- redirects: %s\n\n", loggedRedirects.get()));
|
||||
|
||||
// Send Telemetry
|
||||
if (!sTelemetryEventEnabled.exchange(true)) {
|
||||
Telemetry::SetEventRecordingEnabled("security"_ns, true);
|
||||
}
|
||||
|
||||
glean::security::UnexpectedLoadExtra extra = {
|
||||
.contenttype = Some(loggedContentType),
|
||||
.filedetails = Some(loggedFileDetails),
|
||||
|
|
|
@ -45,17 +45,20 @@
|
|||
#include "LoadInfo.h"
|
||||
#include "mozilla/StaticPrefs_extensions.h"
|
||||
#include "mozilla/StaticPrefs_dom.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::Telemetry;
|
||||
|
||||
extern mozilla::LazyLogModule sCSMLog;
|
||||
extern Atomic<bool, mozilla::Relaxed> sJSHacksChecked;
|
||||
extern Atomic<bool, mozilla::Relaxed> sJSHacksPresent;
|
||||
extern Atomic<bool, mozilla::Relaxed> sCSSHacksChecked;
|
||||
extern Atomic<bool, mozilla::Relaxed> sCSSHacksPresent;
|
||||
extern Atomic<bool, mozilla::Relaxed> sTelemetryEventEnabled;
|
||||
|
||||
// Helper function for IsConsideredSameOriginForUIR which makes
|
||||
// Principals of scheme 'http' return Principals of scheme 'https'.
|
||||
|
@ -741,6 +744,10 @@ void nsContentSecurityUtils::NotifyEvalUsage(bool aIsSystemPrincipal,
|
|||
uint32_t aColumnNumber) {
|
||||
FilenameTypeAndDetails fileNameTypeAndDetails =
|
||||
FilenameToFilenameType(aFileName, false);
|
||||
if (!sTelemetryEventEnabled.exchange(true)) {
|
||||
sTelemetryEventEnabled = true;
|
||||
Telemetry::SetEventRecordingEnabled("security"_ns, true);
|
||||
}
|
||||
auto fileinfo = fileNameTypeAndDetails.second;
|
||||
auto value = Some(fileNameTypeAndDetails.first);
|
||||
if (aIsSystemPrincipal) {
|
||||
|
@ -1567,6 +1574,10 @@ bool nsContentSecurityUtils::ValidateScriptFilename(JSContext* cx,
|
|||
FilenameTypeAndDetails fileNameTypeAndDetails =
|
||||
FilenameToFilenameType(filename, true);
|
||||
|
||||
if (!sTelemetryEventEnabled.exchange(true)) {
|
||||
sTelemetryEventEnabled = true;
|
||||
Telemetry::SetEventRecordingEnabled("security"_ns, true);
|
||||
}
|
||||
glean::security::JavascriptLoadParentProcessExtra extra = {
|
||||
.fileinfo = fileNameTypeAndDetails.second,
|
||||
.value = Some(fileNameTypeAndDetails.first),
|
||||
|
|
|
@ -63,6 +63,8 @@ const TEST_CASES = [
|
|||
];
|
||||
|
||||
add_setup(async function () {
|
||||
Services.telemetry.setEventRecordingEnabled("security.ui.xfocsperror", true);
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["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
|
||||
// investigate.
|
||||
if (aShouldSendTelemetry && r != 0) {
|
||||
// Uncomment once bug 1691156 is fixed
|
||||
// mozilla::Telemetry::SetEventRecordingEnabled("avif"_ns, true);
|
||||
|
||||
mozilla::glean::avif::Dav1dGetPictureReturnValueExtra extra = {
|
||||
.value = Some(nsPrintfCString("%d", r)),
|
||||
};
|
||||
|
|
|
@ -110,6 +110,10 @@ bool UtilityProcessHost::Launch(geckoargs::ChildProcessArgs aExtraOpts) {
|
|||
EnsureWidevineL1PathForSandbox(aExtraOpts);
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_WMF_CDM) && defined(MOZ_SANDBOX)
|
||||
EnanbleMFCDMTelemetryEventIfNeeded();
|
||||
#endif
|
||||
|
||||
mLaunchPhase = LaunchPhase::Waiting;
|
||||
|
||||
if (!GeckoChildProcessHost::AsyncLaunch(std::move(aExtraOpts))) {
|
||||
|
@ -410,4 +414,17 @@ void UtilityProcessHost::EnsureWidevineL1PathForSandbox(
|
|||
|
||||
#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
|
||||
|
|
|
@ -586,6 +586,7 @@ AutoScriptActivity::~AutoScriptActivity() {
|
|||
}
|
||||
|
||||
static const double sChromeSlowScriptTelemetryCutoff(10.0);
|
||||
static bool sTelemetryEventEnabled(false);
|
||||
|
||||
// static
|
||||
bool XPCJSContext::InterruptCallback(JSContext* cx) {
|
||||
|
@ -1443,6 +1444,11 @@ void XPCJSContext::AfterProcessTask(uint32_t aNewRecursionDepth) {
|
|||
}
|
||||
}
|
||||
if (hangDuration > limit) {
|
||||
if (!sTelemetryEventEnabled) {
|
||||
sTelemetryEventEnabled = true;
|
||||
Telemetry::SetEventRecordingEnabled("slow_script_warning"_ns, true);
|
||||
}
|
||||
|
||||
// Use AppendFloat to avoid printf-type APIs using locale-specific
|
||||
// decimal separators, when we definitely want a `.`.
|
||||
nsCString durationStr;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/StaticPrefs_network.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/glean/GleanMetrics.h"
|
||||
#include "private/pprio.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 isOmniJa = StringBeginsWith(fileName, "omni.ja!"_ns);
|
||||
|
||||
Telemetry::SetEventRecordingEnabled("zero_byte_load"_ns, true);
|
||||
if (StringEndsWith(fileName, ".ftl"_ns)) {
|
||||
// FTL uses I/O to test for file presence, so we get
|
||||
// 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() {
|
||||
var chan = makeChan();
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("zero_byte_load", true);
|
||||
Services.telemetry.clearEvents();
|
||||
|
||||
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() {
|
||||
var chan = makeChan();
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("zero_byte_load", true);
|
||||
Services.telemetry.clearEvents();
|
||||
|
||||
await new Promise(resolve => {
|
||||
|
|
|
@ -161,6 +161,8 @@ static void ShutdownAlwaysPrefs();
|
|||
// Low-level types and operations
|
||||
//===========================================================================
|
||||
|
||||
Atomic<bool, mozilla::Relaxed> sPrefTelemetryEventEnabled(false);
|
||||
|
||||
typedef nsTArray<nsCString> PrefSaveData;
|
||||
|
||||
// 1 MB should be enough for everyone.
|
||||
|
@ -661,6 +663,10 @@ class Pref {
|
|||
|
||||
#define CHECK_SANITIZATION() \
|
||||
if (IsPreferenceSanitized(this)) { \
|
||||
if (!sPrefTelemetryEventEnabled.exchange(true)) { \
|
||||
sPrefTelemetryEventEnabled = true; \
|
||||
Telemetry::SetEventRecordingEnabled("security"_ns, true); \
|
||||
} \
|
||||
glean::security::pref_usage_content_process.Record( \
|
||||
Some(glean::security::PrefUsageContentProcessExtra{Some(Name())})); \
|
||||
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
|
||||
// we need to do it explicitly, then fall-through.
|
||||
if (IsPreferenceSanitized(Name())) {
|
||||
if (!sPrefTelemetryEventEnabled.exchange(true)) {
|
||||
sPrefTelemetryEventEnabled = true;
|
||||
Telemetry::SetEventRecordingEnabled("security"_ns, true);
|
||||
}
|
||||
|
||||
glean::security::pref_usage_content_process.Record(Some(
|
||||
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
|
||||
// return early, before this check occurs in GetFooValue()
|
||||
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(
|
||||
Some(glean::security::PrefUsageContentProcessExtra{Some(Name())}));
|
||||
|
||||
|
@ -5401,6 +5417,11 @@ int32_t Preferences::GetType(const char* aPrefName) {
|
|||
|
||||
case PrefType::None:
|
||||
if (IsPreferenceSanitized(aPrefName)) {
|
||||
if (!sPrefTelemetryEventEnabled.exchange(true)) {
|
||||
sPrefTelemetryEventEnabled = true;
|
||||
Telemetry::SetEventRecordingEnabled("security"_ns, true);
|
||||
}
|
||||
|
||||
glean::security::pref_usage_content_process.Record(Some(
|
||||
glean::security::PrefUsageContentProcessExtra{Some(aPrefName)}));
|
||||
|
||||
|
|
|
@ -13384,6 +13384,12 @@
|
|||
value: 6000
|
||||
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
|
||||
- name: network.trr.send_accept-language_headers
|
||||
type: RelaxedAtomicBool
|
||||
|
|
|
@ -44,6 +44,7 @@ add_task(async function sanitized_pref_test() {
|
|||
],
|
||||
});
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("security", true);
|
||||
Services.telemetry.clearEvents();
|
||||
|
||||
TelemetryTestUtils.assertNumberOfEvents(0, { process: "content" });
|
||||
|
|
|
@ -164,6 +164,12 @@ bool TRRService::CheckCaptivePortalIsPassed() {
|
|||
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) {
|
||||
MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
|
||||
if (mInitialized) {
|
||||
|
@ -209,6 +215,10 @@ nsresult TRRService::Init(bool aNativeHTTPSQueryEnabled) {
|
|||
sTRRBackgroundThread = thread;
|
||||
}
|
||||
|
||||
Preferences::RegisterCallbackAndCall(
|
||||
EventTelemetryPrefChanged,
|
||||
"network.trr.confirmation_telemetry_enabled"_ns);
|
||||
|
||||
LOG(("Initialized TRRService\n"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/IntegerTypeTraits.h"
|
||||
#include "mozilla/NullPrincipal.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/glean/GleanMetrics.h"
|
||||
|
||||
#include "nsThreadUtils.h"
|
||||
|
@ -1107,6 +1108,7 @@ nsresult nsExpatDriver::HandleError() {
|
|||
docShellDestroyed.Assign(destroyed ? "true"_ns : "false"_ns);
|
||||
}
|
||||
|
||||
mozilla::Telemetry::SetEventRecordingEnabled("ysod"_ns, true);
|
||||
mozilla::glean::ysod::ShownYsodExtra extra = {
|
||||
.destroyed = mozilla::Some(docShellDestroyed),
|
||||
.errorCode = mozilla::Some(code),
|
||||
|
|
|
@ -6,6 +6,7 @@ const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
|||
|
||||
add_task(async function test_popup_opened() {
|
||||
Services.telemetry.clearEvents();
|
||||
Services.telemetry.setEventRecordingEnabled("ysod", true);
|
||||
|
||||
const PAGE_URL = getRootDirectory(gTestPath) + "broken_xml.xhtml";
|
||||
let viewSourceTab = await BrowserTestUtils.openNewForegroundTab(
|
||||
|
|
|
@ -24,6 +24,9 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||
"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.
|
||||
*/
|
||||
|
@ -160,6 +163,14 @@ export class UptakeTelemetry {
|
|||
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 channel = UptakeTelemetry.Policy.getChannel();
|
||||
const shouldSendEvent =
|
||||
|
|
|
@ -35,6 +35,7 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||
export class FxAccountsTelemetry {
|
||||
constructor(fxai) {
|
||||
this._fxai = fxai;
|
||||
Services.telemetry.setEventRecordingEnabled("fxa", true);
|
||||
}
|
||||
|
||||
// Records an event *in the Fxa/Sync ping*.
|
||||
|
|
|
@ -402,6 +402,7 @@ export var SyncedTabs = {
|
|||
},
|
||||
|
||||
recordSyncedTabsTelemetry(object, tabEvent, extraOptions) {
|
||||
Services.telemetry.setEventRecordingEnabled("synced_tabs", true);
|
||||
if (
|
||||
!["fxa_avatar_menu", "fxa_app_menu", "synced_tabs_sidebar"].includes(
|
||||
object
|
||||
|
|
|
@ -1126,6 +1126,14 @@ nsCookieBannerService::OnLocationChange(nsIWebProgress* aWebProgress,
|
|||
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 = {
|
||||
.hasClickRule = Some(hasClickRuleInData),
|
||||
.hasCookieRule = Some(hasCookieRuleInData),
|
||||
|
|
|
@ -652,6 +652,7 @@ add_task(async function test_DownloadSummary_notifications() {
|
|||
*/
|
||||
add_task(async function test_downloadAddedTelemetry() {
|
||||
Services.telemetry.clearEvents();
|
||||
Services.telemetry.setEventRecordingEnabled("downloads", true);
|
||||
|
||||
let targetFile = getTempFile(TEST_TARGET_FILE_NAME);
|
||||
|
||||
|
|
|
@ -119,9 +119,13 @@ this.telemetry = class extends ExtensionAPI {
|
|||
throw new ExtensionUtils.ExtensionError(ex);
|
||||
}
|
||||
},
|
||||
setEventRecordingEnabled(_category, _enabled) {
|
||||
setEventRecordingEnabled(category, enabled) {
|
||||
desktopCheck();
|
||||
// No-op since bug 1920562 (Fx133).
|
||||
try {
|
||||
Services.telemetry.setEventRecordingEnabled(category, enabled);
|
||||
} catch (ex) {
|
||||
throw new ExtensionUtils.ExtensionError(ex);
|
||||
}
|
||||
},
|
||||
registerEvents(_category, _data) {
|
||||
desktopCheck();
|
||||
|
|
|
@ -363,9 +363,8 @@
|
|||
},
|
||||
{
|
||||
"name": "setEventRecordingEnabled",
|
||||
"deprecated": "`setEventRecordingEnabled` has been deprecated since Firefox 133 (see bug 1920562)",
|
||||
"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,
|
||||
"parameters": [
|
||||
{
|
||||
|
|
|
@ -535,6 +535,7 @@ if (AppConstants.MOZ_BUILD_APP === "browser") {
|
|||
|
||||
add_task(async function test_telemetry_record_event() {
|
||||
Services.telemetry.clearEvents();
|
||||
Services.telemetry.setEventRecordingEnabled("telemetry.test", true);
|
||||
|
||||
ExtensionTestUtils.failOnSchemaWarnings(false);
|
||||
|
||||
|
@ -567,12 +568,14 @@ if (AppConstants.MOZ_BUILD_APP === "browser") {
|
|||
|
||||
ExtensionTestUtils.failOnSchemaWarnings(true);
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("telemetry.test", false);
|
||||
Services.telemetry.clearEvents();
|
||||
});
|
||||
|
||||
// Bug 1536877
|
||||
add_task(async function test_telemetry_record_event_value_must_be_string() {
|
||||
Services.telemetry.clearEvents();
|
||||
Services.telemetry.setEventRecordingEnabled("telemetry.test", true);
|
||||
|
||||
ExtensionTestUtils.failOnSchemaWarnings(false);
|
||||
|
||||
|
@ -616,6 +619,7 @@ if (AppConstants.MOZ_BUILD_APP === "browser") {
|
|||
|
||||
ExtensionTestUtils.failOnSchemaWarnings(true);
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("telemetry.test", false);
|
||||
Services.telemetry.clearEvents();
|
||||
});
|
||||
|
||||
|
|
|
@ -93,6 +93,9 @@ export let FormAutofillStatus = {
|
|||
if (FormAutofill.isAutofillCreditCardsAvailable) {
|
||||
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
|
||||
|
||||
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
|
||||
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].
|
||||
|
||||
```{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`
|
||||
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() {
|
||||
Telemetry.setEventRecordingEnabled("telemetry.test", true);
|
||||
|
||||
Glean.testOnlyIpc.noExtraEvent.record();
|
||||
var events = Glean.testOnlyIpc.noExtraEvent.testGetValue();
|
||||
Assert.equal(1, events.length);
|
||||
|
|
|
@ -134,6 +134,8 @@ add_task({ skip_if: () => runningInParent }, async function run_child_stuff() {
|
|||
add_task(
|
||||
{ skip_if: () => !runningInParent },
|
||||
async function test_child_metrics() {
|
||||
Telemetry.setEventRecordingEnabled("telemetry.test", true);
|
||||
|
||||
// Clear any stray Telemetry data
|
||||
Telemetry.clearScalars();
|
||||
Telemetry.getSnapshotForHistograms("main", true);
|
||||
|
|
|
@ -20,6 +20,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
setTimeout: "resource://gre/modules/Timer.sys.mjs",
|
||||
});
|
||||
|
||||
const TARGETING_EVENT_CATEGORY = "messaging_experiments";
|
||||
const DEFAULT_TIMEOUT = 5000;
|
||||
const ERROR_TYPES = {
|
||||
ATTRIBUTE_ERROR: "AttributeError",
|
||||
|
@ -80,6 +81,9 @@ export class TargetingContext {
|
|||
|
||||
// Used in telemetry to report where the targeting expression is coming from
|
||||
this.#telemetrySource = options.source;
|
||||
|
||||
// Enable event recording
|
||||
Services.telemetry.setEventRecordingEnabled(TARGETING_EVENT_CATEGORY, true);
|
||||
}
|
||||
|
||||
setTelemetrySource(source) {
|
||||
|
|
|
@ -25,6 +25,7 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||
COLLECTION_ID_PREF,
|
||||
COLLECTION_ID_FALLBACK
|
||||
);
|
||||
const EXPOSURE_EVENT_CATEGORY = "normandy";
|
||||
|
||||
function parseJSON(value) {
|
||||
if (value) {
|
||||
|
@ -266,6 +267,7 @@ export const ExperimentAPI = {
|
|||
},
|
||||
|
||||
recordExposureEvent({ featureId, experimentSlug, branchSlug }) {
|
||||
Services.telemetry.setEventRecordingEnabled(EXPOSURE_EVENT_CATEGORY, true);
|
||||
Glean.normandy.exposeNimbusExperiment.record({
|
||||
value: experimentSlug,
|
||||
branchSlug,
|
||||
|
|
|
@ -195,6 +195,7 @@ nsresult NimbusFeatures::RecordExposureEvent(const nsACString& aFeatureId,
|
|||
// this featureId
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
Telemetry::SetEventRecordingEnabled("normandy"_ns, true);
|
||||
glean::normandy::expose_nimbus_experiment.Record(
|
||||
Some(glean::normandy::ExposeNimbusExperimentExtra{
|
||||
.branchslug = Some(branchName),
|
||||
|
|
|
@ -11,6 +11,9 @@ const { PrefUtils } = ChromeUtils.importESModule(
|
|||
const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
||||
"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
|
||||
|
@ -1657,6 +1660,8 @@ add_task(async function test_restorePrefs_experimentAndRollout() {
|
|||
});
|
||||
|
||||
add_task(async function test_prefChange() {
|
||||
TelemetryEvents.init();
|
||||
|
||||
const LEGACY_FILTER = {
|
||||
category: "normandy",
|
||||
method: "unenroll",
|
||||
|
@ -2708,6 +2713,8 @@ add_task(async function test_prefChanged_noPrefSet() {
|
|||
});
|
||||
|
||||
add_task(async function test_restorePrefs_manifestChanged() {
|
||||
TelemetryEvents.init();
|
||||
|
||||
const LEGACY_FILTER = {
|
||||
category: "normandy",
|
||||
method: "unenroll",
|
||||
|
|
|
@ -20,6 +20,9 @@ const { PanelTestProvider } = ChromeUtils.importESModule(
|
|||
const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/TelemetryTestUtils.sys.mjs"
|
||||
);
|
||||
const { TelemetryEvents } = ChromeUtils.importESModule(
|
||||
"resource://normandy/lib/TelemetryEvents.sys.mjs"
|
||||
);
|
||||
|
||||
add_setup(async function setup() {
|
||||
do_get_profile();
|
||||
|
@ -508,6 +511,8 @@ add_task(async function test_updateRecipes_simpleFeatureInvalidAfterUpdate() {
|
|||
});
|
||||
|
||||
add_task(async function test_updateRecipes_validationTelemetry() {
|
||||
TelemetryEvents.init();
|
||||
|
||||
Services.telemetry.snapshotEvents(
|
||||
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
|
||||
/* clear = */ true
|
||||
|
@ -1031,6 +1036,7 @@ add_task(async function test_updateRecipes_invalidFeature_mismatch() {
|
|||
});
|
||||
|
||||
add_task(async function test_updateRecipes_rollout_bucketing() {
|
||||
TelemetryEvents.init();
|
||||
Services.fog.testResetFOG();
|
||||
Services.telemetry.snapshotEvents(
|
||||
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
|
||||
|
|
|
@ -9,6 +9,9 @@ const { ExperimentFakes, ExperimentTestUtils } = ChromeUtils.importESModule(
|
|||
const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/TelemetryTestUtils.sys.mjs"
|
||||
);
|
||||
const { TelemetryEvents } = ChromeUtils.importESModule(
|
||||
"resource://normandy/lib/TelemetryEvents.sys.mjs"
|
||||
);
|
||||
|
||||
const LOCALIZATIONS = {
|
||||
"en-US": {
|
||||
|
@ -119,6 +122,7 @@ add_setup(function setup() {
|
|||
do_get_profile();
|
||||
|
||||
Services.fog.initializeFOG();
|
||||
TelemetryEvents.init();
|
||||
|
||||
registerCleanupFunction(ExperimentTestUtils.addTestFeatures(FEATURE));
|
||||
registerCleanupFunction(resetTelemetry);
|
||||
|
|
|
@ -12,6 +12,9 @@ const { JsonSchema } = ChromeUtils.importESModule(
|
|||
const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/TelemetryTestUtils.sys.mjs"
|
||||
);
|
||||
const { TelemetryEvents } = ChromeUtils.importESModule(
|
||||
"resource://normandy/lib/TelemetryEvents.sys.mjs"
|
||||
);
|
||||
|
||||
const USER = "user";
|
||||
const DEFAULT = "default";
|
||||
|
@ -145,6 +148,7 @@ function checkExpectedPrefBranches(prefs) {
|
|||
add_setup(function setup() {
|
||||
do_get_profile();
|
||||
Services.fog.initializeFOG();
|
||||
TelemetryEvents.init();
|
||||
|
||||
const cleanupFeatures = ExperimentTestUtils.addTestFeatures(
|
||||
PREF_FEATURES[USER],
|
||||
|
|
|
@ -21,6 +21,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
RemoteSettingsExperimentLoader:
|
||||
"resource://nimbus/lib/RemoteSettingsExperimentLoader.sys.mjs",
|
||||
ShieldPreferences: "resource://normandy/lib/ShieldPreferences.sys.mjs",
|
||||
TelemetryEvents: "resource://normandy/lib/TelemetryEvents.sys.mjs",
|
||||
});
|
||||
|
||||
const UI_AVAILABLE_NOTIFICATION = "sessionstore-windows-restored";
|
||||
|
@ -85,6 +86,12 @@ export var Normandy = {
|
|||
},
|
||||
|
||||
async finishInit() {
|
||||
try {
|
||||
lazy.TelemetryEvents.init();
|
||||
} catch (err) {
|
||||
log.error("Failed to initialize telemetry events:", err);
|
||||
}
|
||||
|
||||
await lazy.PreferenceRollouts.recordOriginalValues(
|
||||
this.rolloutPrefsChanged
|
||||
);
|
||||
|
|
|
@ -2,7 +2,13 @@
|
|||
* 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/. */
|
||||
|
||||
const TELEMETRY_CATEGORY = "normandy";
|
||||
|
||||
export const TelemetryEvents = {
|
||||
init() {
|
||||
Services.telemetry.setEventRecordingEnabled(TELEMETRY_CATEGORY, true);
|
||||
},
|
||||
|
||||
sendEvent(method, object, value, extra) {
|
||||
for (const val of Object.values(extra)) {
|
||||
if (val == null) {
|
||||
|
|
|
@ -37,6 +37,7 @@ function withStubInits() {
|
|||
withStub(PreferenceRollouts, "init"),
|
||||
withStub(PreferenceExperiments, "init"),
|
||||
withStub(RecipeRunner, "init"),
|
||||
withStub(TelemetryEvents, "init"),
|
||||
testFunction
|
||||
);
|
||||
};
|
||||
|
@ -246,6 +247,7 @@ decorate_task(withStubInits(), async function testStartupPrefInitFail() {
|
|||
"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");
|
||||
});
|
||||
|
||||
|
@ -262,6 +264,25 @@ decorate_task(
|
|||
"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");
|
||||
}
|
||||
);
|
||||
|
||||
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");
|
||||
}
|
||||
);
|
||||
|
@ -279,6 +300,7 @@ decorate_task(
|
|||
"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");
|
||||
}
|
||||
);
|
||||
|
|
|
@ -51,6 +51,9 @@ sinon.assert.fail = function (message) {
|
|||
ok(false, message);
|
||||
};
|
||||
|
||||
// Prep Telemetry to receive events from tests
|
||||
TelemetryEvents.init();
|
||||
|
||||
this.TEST_XPI_URL = (function () {
|
||||
const dir = getChromeDir(getResolvedURI(gTestPath));
|
||||
dir.append("addons");
|
||||
|
|
|
@ -10,6 +10,9 @@ const { BranchedAddonStudyAction } = ChromeUtils.importESModule(
|
|||
const { BaseAction } = ChromeUtils.importESModule(
|
||||
"resource://normandy/actions/BaseAction.sys.mjs"
|
||||
);
|
||||
const { TelemetryEvents } = ChromeUtils.importESModule(
|
||||
"resource://normandy/lib/TelemetryEvents.sys.mjs"
|
||||
);
|
||||
const { AddonManager } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/AddonManager.sys.mjs"
|
||||
);
|
||||
|
@ -36,6 +39,8 @@ add_task(async () => {
|
|||
);
|
||||
AddonTestUtils.overrideCertDB();
|
||||
await AddonTestUtils.promiseStartupManager();
|
||||
|
||||
TelemetryEvents.init();
|
||||
});
|
||||
|
||||
decorate_task(
|
||||
|
|
|
@ -407,6 +407,8 @@ export const LoginHelper = {
|
|||
// Watch for pref changes to update cached pref values.
|
||||
Services.prefs.addObserver("signon.", () => 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'
|
||||
// Using hard-coded value for FxAccountsCommon.ONLOGOUT_NOTIFICATION because
|
||||
|
|
|
@ -170,6 +170,7 @@ add_setup(async function () {
|
|||
const canRecordExtendedOld = Services.telemetry.canRecordExtended;
|
||||
Services.telemetry.canRecordExtended = true;
|
||||
Services.telemetry.clearEvents();
|
||||
Services.telemetry.setEventRecordingEnabled("relay_integration", true);
|
||||
|
||||
gRelayACOptionsTitles = await new Localization([
|
||||
"browser/firefoxRelay.ftl",
|
||||
|
@ -185,6 +186,7 @@ add_setup(async function () {
|
|||
resolve();
|
||||
});
|
||||
});
|
||||
Services.telemetry.setEventRecordingEnabled("relay_integration", false);
|
||||
Services.telemetry.clearEvents();
|
||||
Services.telemetry.canRecordExtended = canRecordExtendedOld;
|
||||
sinon.restore();
|
||||
|
|
|
@ -223,6 +223,7 @@ add_task(async function test_eventTelemetry() {
|
|||
url: TEST_PAGE,
|
||||
},
|
||||
async browser => {
|
||||
Services.telemetry.setEventRecordingEnabled("pictureinpicture", true);
|
||||
let videoID = "no-controls";
|
||||
|
||||
const PIP_PREF =
|
||||
|
|
|
@ -85,6 +85,8 @@ const DEFAULT_COLORS = {
|
|||
"selection-highlight": "#FFFFCC",
|
||||
};
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("readermode", true);
|
||||
|
||||
const zoomOnCtrl =
|
||||
Services.prefs.getIntPref("mousewheel.with_control.action", 3) == 3;
|
||||
const zoomOnMeta =
|
||||
|
|
|
@ -42,6 +42,8 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
const gIsFirefoxDesktop =
|
||||
Services.appinfo.ID == "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("readermode", true);
|
||||
|
||||
export var ReaderMode = {
|
||||
DEBUG: 0,
|
||||
|
||||
|
|
|
@ -743,6 +743,7 @@ class RelayDisabled {}
|
|||
class RelayFeature extends OptInFeature {
|
||||
constructor() {
|
||||
super(RelayOffered, RelayEnabled, RelayDisabled, gConfig.relayFeaturePref);
|
||||
Services.telemetry.setEventRecordingEnabled("relay_integration", true);
|
||||
// Update the config when the signon.firefoxRelay.base_url pref is changed.
|
||||
// This is added mainly for tests.
|
||||
Services.prefs.addObserver(
|
||||
|
|
|
@ -1633,6 +1633,13 @@ TelemetryImpl::ClearEvents() {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelemetryImpl::SetEventRecordingEnabled(const nsACString& aCategory,
|
||||
bool aEnabled) {
|
||||
TelemetryEvent::SetEventRecordingEnabled(aCategory, aEnabled);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelemetryImpl::FlushBatchedChildTelemetry() {
|
||||
TelemetryIPCAccumulator::IPCTimerFired(nullptr, nullptr);
|
||||
|
@ -2005,6 +2012,10 @@ void ScalarSetMaximum(mozilla::Telemetry::ScalarID aId, const nsAString& aKey,
|
|||
TelemetryScalar::SetMaximum(aId, aKey, aVal);
|
||||
}
|
||||
|
||||
void SetEventRecordingEnabled(const nsACString& aCategory, bool aEnabled) {
|
||||
TelemetryEvent::SetEventRecordingEnabled(aCategory, aEnabled);
|
||||
}
|
||||
|
||||
void ShutdownTelemetry() { TelemetryImpl::ShutdownTelemetry(); }
|
||||
|
||||
} // namespace mozilla::Telemetry
|
||||
|
|
|
@ -549,6 +549,16 @@ class MOZ_RAII AutoScalarTimer {
|
|||
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 mozilla
|
||||
|
||||
|
|
|
@ -334,6 +334,9 @@ nsTHashMap<nsCStringHashKey, EventKey> gEventNameIDMap(kEventCount);
|
|||
// The CategoryName set.
|
||||
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
|
||||
// in recording order.
|
||||
typedef nsUint32HashKey ProcessIDHashKey;
|
||||
|
@ -371,6 +374,19 @@ unsigned int GetDataset(const StaticMutexAutoLock& lock,
|
|||
: 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,
|
||||
ProcessID process) {
|
||||
if (!gCanRecordBase) {
|
||||
|
@ -481,10 +497,16 @@ RecordEventResult RecordEvent(const StaticMutexAutoLock& lock,
|
|||
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),
|
||||
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);
|
||||
eventRecords->AppendElement(EventRecord(timestamp, eventKey, value, extra));
|
||||
|
||||
|
@ -560,6 +582,12 @@ void RegisterEvents(const StaticMutexAutoLock& lock, const nsACString& category,
|
|||
if (aBuiltin) {
|
||||
gCategoryNames.Insert(category);
|
||||
}
|
||||
|
||||
if (!aBuiltin) {
|
||||
// Now after successful registration enable recording for this category
|
||||
// (if not a dynamic builtin).
|
||||
gEnabledCategories.Insert(category);
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
@ -722,6 +750,9 @@ void TelemetryEvent::InitializeGlobalState(bool aCanRecordBase,
|
|||
gCategoryNames.Insert(info.common_info.category());
|
||||
}
|
||||
|
||||
// A hack until bug 1691156 is fixed
|
||||
gEnabledCategories.Insert("avif"_ns);
|
||||
|
||||
gInitDone = true;
|
||||
}
|
||||
|
||||
|
@ -734,6 +765,7 @@ void TelemetryEvent::DeInitializeGlobalState() {
|
|||
|
||||
gEventNameIDMap.Clear();
|
||||
gCategoryNames.Clear();
|
||||
gEnabledCategories.Clear();
|
||||
gEventRecords.Clear();
|
||||
|
||||
gDynamicEventInfo = nullptr;
|
||||
|
@ -1348,6 +1380,27 @@ void TelemetryEvent::ClearEvents() {
|
|||
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(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) {
|
||||
StaticMutexAutoLock locker(gTelemetryEventsMutex);
|
||||
|
@ -1374,6 +1427,7 @@ size_t TelemetryEvent::SizeOfIncludingThis(
|
|||
}
|
||||
|
||||
n += gCategoryNames.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||
n += gEnabledCategories.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||
|
||||
if (gDynamicEventInfo) {
|
||||
n += gDynamicEventInfo->ShallowSizeOfIncludingThis(aMallocSizeOf);
|
||||
|
|
|
@ -47,6 +47,7 @@ nsresult RecordEvent(const nsACString& aCategory, const nsACString& aMethod,
|
|||
JS::Handle<JS::Value> aExtra, JSContext* aCx,
|
||||
uint8_t optional_argc);
|
||||
|
||||
void SetEventRecordingEnabled(const nsACString& aCategory, bool aEnabled);
|
||||
nsresult RegisterEvents(const nsACString& aCategory,
|
||||
JS::Handle<JS::Value> aEventData, bool aBuiltin,
|
||||
JSContext* cx);
|
||||
|
|
|
@ -529,6 +529,16 @@ interface nsITelemetry : nsISupports
|
|||
[implicit_jscontext, optional_argc]
|
||||
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.
|
||||
* The returned structure looks like this:
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче