Bug 1923741 - Add telemetry to measure how many users have read only system temporary folders. r=jrmuizel

Differential Revision: https://phabricator.services.mozilla.com/D225139
This commit is contained in:
Andrew Osmond 2024-10-10 14:48:04 +00:00
parent 70fc238b6b
commit 5085cff7f2
2 changed files with 28 additions and 0 deletions

View File

@ -1042,6 +1042,16 @@ void gfxPlatform::Init() {
}
}
static bool IsOsTempDirWritable() {
nsCOMPtr<nsIFile> file;
nsresult rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(file));
NS_ENSURE_SUCCESS(rv, false);
bool writable = false;
rv = file->IsWritable(&writable);
NS_ENSURE_SUCCESS(rv, false);
return writable;
}
void gfxPlatform::ReportTelemetry() {
MOZ_RELEASE_ASSERT(XRE_IsParentProcess(),
"GFX: Only allowed to be called from parent process.");
@ -1064,6 +1074,9 @@ void gfxPlatform::ReportTelemetry() {
supportsHDR |= screen->GetIsHDR();
}
Telemetry::ScalarSet(Telemetry::ScalarID::GFX_SUPPORTS_HDR, supportsHDR);
bool tmpWritable = IsOsTempDirWritable();
Telemetry::ScalarSet(Telemetry::ScalarID::GFX_TMP_WRITABLE, tmpWritable);
}
nsString adapterDesc;

View File

@ -4030,6 +4030,21 @@ gfx:
record_in_processes:
- 'main'
release_channel_collection: opt-out
tmp_writable:
bug_numbers:
- 1923741
description: >
Is the system temporary directory writable
expires: "134"
kind: boolean
notification_emails:
- gfx-telemetry-alerts@mozilla.com
- aosmond@mozilla.com
products:
- 'firefox'
record_in_processes:
- 'main'
release_channel_collection: opt-out
apz:
scrollwheel_overshoot: