Bug 1715348 - Add telemetry environment boolean scalar for kept in macOS Dock r=pdahiya

Add BrowserGlue task and telemetry Scalar matching is_taskbar_pinned but for macOS as is_kept_in_dock.

Differential Revision: https://phabricator.services.mozilla.com/D117346
This commit is contained in:
Ed Lee 2021-06-10 20:58:08 +00:00
Родитель 9fc83995ba
Коммит 442a2844ac
4 изменённых файлов: 61 добавлений и 0 удалений

Просмотреть файл

@ -2380,6 +2380,23 @@ BrowserGlue.prototype = {
},
},
// Report macOS Dock status
{
condition: AppConstants.platform == "macosx",
task: () => {
try {
Services.telemetry.scalarSet(
"os.environment.is_kept_in_dock",
Cc["@mozilla.org/widget/macdocksupport;1"].getService(
Ci.nsIMacDockSupport
).isAppInDock
);
} catch (ex) {
Cu.reportError(ex);
}
},
},
{
task: () => {
this._maybeShowDefaultBrowserPrompt();

Просмотреть файл

@ -2,6 +2,7 @@
support-files =
head.js
[browser_browserGlue_telemetry.js]
[browser_browserGlue_upgradeDialog.js]
[browser_browserGlue_upgradeDialog_resize.js]
[browser_bug538331.js]

Просмотреть файл

@ -0,0 +1,26 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Check that telemetry reports Firefox is not pinned on any OS at startup.
add_task(function check_startup_pinned_telemetry() {
const scalars = TelemetryTestUtils.getProcessScalars("parent");
const check = (key, val, msg) => Assert.strictEqual(scalars[key], val, msg);
// Check the appropriate telemetry is set or not reported by platform.
switch (AppConstants.platform) {
case "win":
check("os.environment.is_taskbar_pinned", false, "Pin set on win");
check("os.environment.is_kept_in_dock", undefined, "Dock unset on win");
break;
case "macosx":
check("os.environment.is_taskbar_pinned", undefined, "Pin unset on mac");
check("os.environment.is_kept_in_dock", false, "Dock set on mac");
break;
default:
check("os.environment.is_taskbar_pinned", undefined, "Pin unset on lin");
check("os.environment.is_kept_in_dock", undefined, "Dock unset on lin");
break;
}
});

Просмотреть файл

@ -1764,6 +1764,23 @@ os.environment:
operating_systems:
- windows
is_kept_in_dock:
bug_numbers:
- 1715348
description: Whether this app was kept in macOS Dock on startup
expires: "97"
kind: boolean
notification_emails:
- elee@mozilla.com
- shong@mozilla.com
release_channel_collection: opt-out
products:
- firefox
record_in_processes:
- main
operating_systems:
- mac
is_taskbar_pinned:
bug_numbers:
- 1685213