diff --git a/toolkit/components/telemetry/docs/data/crash-ping.rst b/toolkit/components/telemetry/docs/data/crash-ping.rst index f29ebfd2a530..bdbd0e733ccb 100644 --- a/toolkit/components/telemetry/docs/data/crash-ping.rst +++ b/toolkit/components/telemetry/docs/data/crash-ping.rst @@ -87,6 +87,7 @@ Structure: UptimeTS: , // Seconds since Firefox was started, this can have a fractional component User32BeforeBlocklist: "1", // Windows-only, present only if user32.dll was loaded before the DLL blocklist has been initialized WindowsErrorReporting: "1", // Windows-only, present only if the crash was intercepted by the WER runtime exception module + WindowsPackageFamilyName: , // Windows-only, a string containing the "Package Family Name" of Firefox, if installed through an MSIX package }, hasCrashEnvironment: bool } @@ -244,3 +245,4 @@ Version History - Firefox 90: Removed MemoryErrorCorrection (`bug 1710152 `_) and added WindowsErrorReporting (`bug 1703761 `_). - Firefox 95: Added HeadlessMode and BackgroundTaskName (`bug 1697875 `_) +- Firefox 96: Added WindowsPackageFamilyName (`bug 1738375 `_). diff --git a/toolkit/crashreporter/CrashAnnotations.yaml b/toolkit/crashreporter/CrashAnnotations.yaml index 8d91088545a7..74683f1a24ad 100644 --- a/toolkit/crashreporter/CrashAnnotations.yaml +++ b/toolkit/crashreporter/CrashAnnotations.yaml @@ -974,6 +974,15 @@ WasmLibrarySandboxMallocFailed: Set to 1 if a rlbox wasm library sandbox ran out of memory, causing a malloc inside the sandbox to fail. type: boolean + +WindowsPackageFamilyName: + description: > + If running in a Windows package context, the package family name, per + https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-getcurrentpackagefamilyname. + + The package family name is only included when it is likely to have been produced by Mozilla: it + starts "Mozilla." or "MozillaCorporation.". + type: string ping: true WindowsErrorReporting: diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 8c2c5e732cb1..3acf47e21029 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -3803,6 +3803,14 @@ int XREMain::XRE_mainInit(bool* aExitFlag) { CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::AppInitDLLs, NS_ConvertUTF16toUTF8(appInitDLLs)); } + + nsString packageFamilyName = widget::WinUtils::GetPackageFamilyName(); + if (StringBeginsWith(packageFamilyName, u"Mozilla."_ns) || + StringBeginsWith(packageFamilyName, u"MozillaCorporation."_ns)) { + CrashReporter::AnnotateCrashReport( + CrashReporter::Annotation::WindowsPackageFamilyName, + NS_ConvertUTF16toUTF8(packageFamilyName)); + } #endif bool isBackgroundTaskMode = false;