Bug 1348273 - Convert the browser and toolkit annotations; r?njn draft
authorGabriele Svelto <gsvelto@mozilla.com>
Sat, 17 Mar 2018 22:54:08 +0100
changeset 781407 37318fe37ce2c4e017164fdce8d53f14d2d2ac19
parent 781406 ce25480d8082a2c92664b26cc1c7f29fa39e30f8
push id106292
push usergsvelto@mozilla.com
push dateThu, 12 Apr 2018 22:06:23 +0000
reviewersnjn
bugs1348273
milestone61.0a1
Bug 1348273 - Convert the browser and toolkit annotations; r?njn MozReview-Commit-ID: K3A68yAINVx
browser/base/content/browser.js
browser/experiments/Experiments.jsm
toolkit/components/asyncshutdown/AsyncShutdown.jsm
toolkit/components/terminator/nsTerminator.cpp
toolkit/content/browser-child.js
toolkit/crashreporter/CrashAnnotations.yaml
toolkit/mozapps/extensions/internal/XPIProvider.jsm
toolkit/mozapps/extensions/test/xpcshell/head_addons.js
toolkit/xre/nsAppRunner.cpp
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -4809,17 +4809,17 @@ var XULBrowserWindow = {
       try {
         // If the current URI contains a username/password, remove it.
         uri = aLocationURI.mutate()
                           .setUserPass("")
                           .finalize();
       } catch (ex) { /* Ignore failures on about: URIs. */ }
 
       try {
-        gCrashReporter.annotateCrashReport("URL", uri.spec);
+        gCrashReporter.annotateCrashReport(gCrashReporter.URL, uri.spec);
       } catch (ex) {
         // Don't make noise when the crash reporter is built but not enabled.
         if (ex.result != Cr.NS_ERROR_NOT_INITIALIZED) {
           throw ex;
         }
       }
     }
   },
--- a/browser/experiments/Experiments.jsm
+++ b/browser/experiments/Experiments.jsm
@@ -1305,18 +1305,20 @@ Experiments.Experiments.prototype = {
 
     if (activeChanged || this._firstEvaluate) {
       Services.obs.notifyObservers(null, EXPERIMENTS_CHANGED_TOPIC);
       this._firstEvaluate = false;
     }
 
     if ("@mozilla.org/toolkit/crash-reporter;1" in Cc && activeExperiment) {
       try {
-        gCrashReporter.annotateCrashReport("ActiveExperiment", activeExperiment.id);
-        gCrashReporter.annotateCrashReport("ActiveExperimentBranch", activeExperiment.branch);
+        gCrashReporter.annotateCrashReport(
+          gCrashReporter.ActiveExperiment, activeExperiment.id);
+        gCrashReporter.annotateCrashReport(
+          gCrashReporter.ActiveExperimentBranch, activeExperiment.branch);
       } catch (e) {
         // It's ok if crash reporting is disabled.
       }
     }
   },
 
   /*
    * Schedule the soonest re-check of experiment applicability that is needed.
--- a/toolkit/components/asyncshutdown/AsyncShutdown.jsm
+++ b/toolkit/components/asyncshutdown/AsyncShutdown.jsm
@@ -944,18 +944,18 @@ Barrier.prototype = Object.freeze({
             " ensure that we do not leave the user with an unresponsive" +
             " process draining resources.";
           fatalerr(msg);
           if (gCrashReporter && gCrashReporter.enabled) {
             let data = {
               phase: topic,
               conditions: state
             };
-            gCrashReporter.annotateCrashReport("AsyncShutdownTimeout",
-              JSON.stringify(data));
+            gCrashReporter.annotateCrashReport(
+              gCrashReporter.AsyncShutdownTimeout, JSON.stringify(data));
           } else {
             warn("No crash reporter available");
           }
 
           // To help sorting out bugs, we want to make sure that the
           // call to nsIDebug2.abort points to a guilty client, rather
           // than to AsyncShutdown itself. We pick a client that is
           // still blocking and use its filename/lineNumber,
--- a/toolkit/components/terminator/nsTerminator.cpp
+++ b/toolkit/components/terminator/nsTerminator.cpp
@@ -579,18 +579,18 @@ nsTerminator::UpdateTelemetry()
 }
 
 void
 nsTerminator::UpdateCrashReport(const char* aTopic)
 {
   // In case of crash, we wish to know where in shutdown we are
   nsAutoCString report(aTopic);
 
-  Unused << CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ShutdownProgress"),
-                                               report);
+  Unused << CrashReporter::AnnotateCrashReport(
+    CrashReporter::Annotation::ShutdownProgress, report);
 }
 
 void
 XPCOMShutdownNotified()
 {
   MOZ_DIAGNOSTIC_ASSERT(sShutdownNotified == false);
   sShutdownNotified = true;
 }
--- a/toolkit/content/browser-child.js
+++ b/toolkit/content/browser-child.js
@@ -184,17 +184,17 @@ var WebProgressListener = {
       if (AppConstants.MOZ_CRASHREPORTER && CrashReporter.enabled) {
         let uri = aLocationURI;
         try {
           // If the current URI contains a username/password, remove it.
           uri = uri.mutate()
                    .setUserPass("")
                    .finalize();
         } catch (ex) { /* Ignore failures on about: URIs. */ }
-        CrashReporter.annotateCrashReport("URL", uri.spec);
+        CrashReporter.annotateCrashReport(CrashReporter.URL, uri.spec);
       }
     }
 
     this._send("Content:LocationChange", json, objects);
   },
 
   // Note: Because the nsBrowserStatusFilter timeout runnable is
   // SystemGroup-labeled, this method should not modify content DOM or
@@ -338,17 +338,17 @@ var WebNavigation =  {
         let url = Services.io.newURI(uri);
         // If the current URI contains a username/password, remove it.
         url = url.mutate()
                  .setUserPass("")
                  .finalize();
         annotation = url.spec;
       } catch (ex) { /* Ignore failures to parse and failures
                       on about: URIs. */ }
-      CrashReporter.annotateCrashReport("URL", annotation);
+      CrashReporter.annotateCrashReport(CrashReporter.URL, annotation);
     }
     if (referrer)
       referrer = Services.io.newURI(referrer);
     if (postData)
       postData = Utils.makeInputStream(postData);
     if (headers)
       headers = Utils.makeInputStream(headers);
     if (baseURI)
--- a/toolkit/crashreporter/CrashAnnotations.yaml
+++ b/toolkit/crashreporter/CrashAnnotations.yaml
@@ -34,16 +34,25 @@ AccessibilityClient:
   type: string
 
 AccessibilityInProcClient:
   description: >
     Hexadecimal mask of in-process accessibility consumers, see
     accessible/windows/msaa/Compatibility.h for the mappings.
   type: string
 
+ActiveExperiment:
+  description: >
+    ID of the active experiment.
+  type: string
+
+ActiveExperimentBranch:
+  description: >
+    Branch of the active experiment.
+
 ActualStreamLen:
   description: >
     Actual length of an IPC proxy stream.
   type: integer
 
 AdapterDeviceID:
   description: >
     Graphics adapter name.
@@ -67,21 +76,41 @@ AdapterVendorID:
 additional_minidumps:
   description: >
     Comma separated list of additional minidumps for this crash, each element
     in the list represent the suffix used in the dump filename. E.g. the
     "browser" entry for crash fa909194-737b-4b93-b8da-da110ac785e0 implies the
     existence of the fa909194-737b-4b93-b8da-da110ac785e0-browser.dmp file.
   type: string
 
+Addons:
+  description: >
+    List of currently enabled add-ons.
+  type: string
+  altname: Add-ons
+
+AppInitDLLs:
+  description: >
+    List of DLLs loaded when launching any application on Windows, this
+    reflects the contents of the AppInit_DLLs registry key.
+  type: string
+
 AsyncShutdownModule:
   description: >
     Holds the contents of the AsyncShutdown.js script
   type: string
 
+AsyncShutdownTimeout:
+  description: >
+    This annotation is present if a shutdown blocker was not released in time
+    and the browser was crashed instead of waiting for shutdown to finish. The
+    condition that caused the hang is contained in the annotation.
+  type: string
+  ping: true
+
 AvailablePageFile:
   description: >
     Windows-only, maximum amount of memory that can be committed.  This
     annotation is populated with the contents of the MEMORYSTATUSEX's structure
     ullAvailPageFile field.
   type: string
   ping: true
 
@@ -96,16 +125,21 @@ AvailablePhysicalMemory:
 AvailableVirtualMemory:
   description: >
     Windows-only, amount of free virtual memory in bytes. This annotation is
     populated with the contents of the MEMORYSTATUSEX's structure
     ullAvailVirtual field.
   type: string
   ping: true
 
+BIOS_Manufacturer:
+  description: >
+    Name of the BIOS manufacturer.
+  type: string
+
 BlockedDllList:
   description: >
     Comma-separated list of blocked DLLS, Windows-only
   type: string
   ping: true
 
 BlocklistInitFailed:
   description: >
@@ -118,16 +152,21 @@ BreakpadReserveAddress:
     Address of the buffer reserved by Breakpad.
   type: string
 
 BreakpadReserveSize:
   description: >
     Size of the buffer reserved by Breakpad.
   type: string
 
+BuildID:
+  description: >
+    Application build ID, the format is YYYYMMDDHHMMSS.
+  ping: true
+
 ClassRegistrationInfoChild:
   description: >
     Microsoft COM class registration annotation for the child process.
   type: string
 
 ClassRegistrationInfoParent:
   description: >
     Microsoft COM class registration annotation for the parent process.
@@ -166,26 +205,37 @@ ContentSandboxLevel:
   type: integer
 
 CoUnmarshalInterfaceResult:
   description: >
     Annotation describing the error returned by trying to unmarshal an object
     via CoUnmarshalInterface during the creation of an IPC proxy stream.
   type: integer
 
+CPUMicrocodeVersion:
+  description: >
+    Version of the CPU microcode.
+  type: string
+
 CpuUsageFlashProcess1:
   description: >
     CPU usage of the first Adobe Flash plugin process.
   type: string
 
 CpuUsageFlashProcess2:
   description: >
     CPU usage of the second Adobe Flash plugin process.
   type: string
 
+CrashAddressLikelyWrong:
+  description: >
+    Set to 1 if signal handling is broken, in which case the crash address is
+    likely to be wrong.
+  type: boolean
+
 CrashTime:
   description: >
     Crash time in seconds since the Epoch.
   type: string
   ping: true
 
 CreateStreamOnHGlobalFailure:
   description: >
@@ -203,16 +253,21 @@ DeviceResetReason:
     Reason why a DirectX device has been reset, Windows only.
   type: string
 
 DOMIPCEnabled:
   description: >
     Set to 1 when a tab is running in a content process
   type: boolean
 
+EMCheckCompatibility:
+  description: >
+    Set to 1 if add-on compatibility checking is enabled.
+  type: boolean
+
 EventLoopNestingLevel:
   description: >
     Present only if higher than 0, indicates that we're running in a nested
     event loop and indicates the nesting level.
   type: integer
   ping: true
 
 ExpectedStreamLen:
@@ -221,16 +276,30 @@ ExpectedStreamLen:
   type: integer
 
 FlashProcessDump:
   description: >
     Type of process the flash plugin is running in, can be either "Broker" or
     "Sandbox".
   type: string
 
+FramePoisonBase:
+  description: >
+    Base pointer of the memory area used for the poison value we place in freed
+    memory.
+  type: string
+  content: false
+
+FramePoisonSize:
+  description: >
+    Size of the memory area used for the poison value we place in freed
+    memory.
+  type: string
+  content: false
+
 GetHGlobalFromStreamFailure:
   description: >
     Error returned when invoking GetHGlobalFromStreamFailure() during the
     creation of an IPC stream proxy.
   type: string
 
 GMPLibraryPath:
   description: >
@@ -470,16 +539,28 @@ PluginVersion:
   type: string
 
 ProcessType:
   description: >
     Type of the process that crashed, can hold the values "content", "plugin" or
     "gpu" currently.
   type: string
 
+ProductName:
+  description: >
+    Application name (e.g. Firefox).
+  type: string
+  ping: true
+
+ProductID:
+  description: >
+    Application UUID (e.g. ec8030f7-c20a-464f-9b0e-13a3a9e97384).
+  type: string
+  ping: true
+
 ProxyStreamSize:
   description: >
     Size of an IPC proxy stream.
   type: integer
 
 ProxyStreamSizeFrom:
   description: >
     Describes how the size of a proxy stream was obtained. It can be set to
@@ -492,22 +573,33 @@ ProxyStreamUnmarshalStatus:
     the various value this annotation can take.
   type: string
 
 ProxyStreamValid:
   description: >
     Set to "false" when encountering an invalid IPC proxy stream.
   type: string
 
+ReleaseChannel:
+  description: >
+    Application release channel (e.g. default, beta, ...)
+  type: string
+  ping: true
+
 RemoteType:
   description: >
     Type of the content process, can be set to "web", "file" or "extension".
   type: string
   ping: true
 
+SafeMode:
+  description: >
+    Set to 1 if the browser was started in safe mode.
+  type: boolean
+
 SecondsSinceLastCrash:
   description: >
     Time in seconds since the last crash occurred.
   type: string
   ping: true
 
 ServerURL:
   description: >
@@ -515,16 +607,31 @@ ServerURL:
   type: string
 
 SheetLoadFailure:
   description: >
     Set when failing to load a built-in style sheet. This can contain a
     potentially very large amount of diagnostic information.
   type: string
 
+ShutdownProgress:
+  description: >
+   Shutdown step at which the browser crashed, can be set to "quit-application",
+   "profile-change-teardown", "profile-before-change", "xpcom-will-shutdown" or
+   "xpcom-shutdown".
+  type: string
+  ping: true
+
+StartupCrash:
+  description: >
+    If set to 1 then this crash occurred during startup.
+  type: boolean
+  content: false
+  ping: true
+
 StartupTime:
   description: >
     The time when Firefox was launched expressed in seconds since the Epoch.
   type: integer
   content: false
 
 StatFailure:
   description: >
@@ -579,16 +686,21 @@ TestUnicode:
   type: string
 
 TextureUsage:
   description: >
     Amount of memory in bytes consumed by textures.
   type: string
   ping: true
 
+Theme:
+  description: >
+    The browser's current skin.
+  type: string
+
 ThreadIdNameMapping:
   description: >
     List of thread names with their corresponding thread IDs.
   type: string
 
 TotalPageFile:
   description: >
     Windows-only, current committed memory limit. This annotation is
@@ -643,12 +755,26 @@ URL:
   content: false
 
 User32BeforeBlocklist:
   description: >
     Set to 1 if user32.dll was loaded before we could install the DLL blocklist.
   type: boolean
   ping: true
 
+useragent_locale:
+  description: >
+    User-agent locale.
+  type: string
+
+Vendor:
+  description: >
+    Application vendor (e.g. Mozilla).
+  type: string
+
+Version:
+  description: >
+    Product version.
+
 Winsock_LSP:
   description: >
     Information on winsock LSPs injected in our networking stack.
   type: string
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -2140,21 +2140,23 @@ var XPIProvider = {
         // effect
         Services.obs.notifyObservers(null, "chrome-flush-skin-caches");
         Services.obs.notifyObservers(null, "chrome-flush-caches");
       }
 
       if (AppConstants.MOZ_CRASHREPORTER) {
         // Annotate the crash report with relevant add-on information.
         try {
-          Services.appinfo.annotateCrashReport("Theme", DEFAULT_SKIN);
+          Services.appinfo.annotateCrashReport(
+            Services.appinfo.Theme, DEFAULT_SKIN);
         } catch (e) { }
         try {
-          Services.appinfo.annotateCrashReport("EMCheckCompatibility",
-                                               AddonManager.checkCompatibility);
+          Services.appinfo.annotateCrashReport(
+            Services.appinfo.EMCheckCompatibility,
+            AddonManager.checkCompatibility);
         } catch (e) { }
         this.addAddonsToCrashReporter();
       }
 
       try {
         AddonManagerPrivate.recordTimestamp("XPI_bootstrap_addons_begin");
 
         for (let addon of this.sortBootstrappedAddons()) {
@@ -2697,17 +2699,17 @@ var XPIProvider = {
     if (Services.appinfo.inSafeMode) {
       return;
     }
 
     let data = Array.from(XPIStates.enabledAddons(),
                           a => encoded`${a.id}:${a.version}`).join(",");
 
     try {
-      Services.appinfo.annotateCrashReport("Add-ons", data);
+      Services.appinfo.annotateCrashReport(Services.appinfo.Addons, data);
     } catch (e) { }
 
     let TelemetrySession =
       ChromeUtils.import("resource://gre/modules/TelemetrySession.jsm", {}).TelemetrySession;
     TelemetrySession.setAddOns(data);
   },
 
   /**
--- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
@@ -419,22 +419,25 @@ function checkAddon(id, addon, expected)
  * @param  aVersion
  *         The version of the add-on
  */
 function do_check_in_crash_annotation(aId, aVersion) {
   if (!AppConstants.MOZ_CRASHREPORTER) {
     return;
   }
 
-  if (!("Add-ons" in gAppInfo.annotations)) {
+  let crashReporter = Cc["@mozilla.org/toolkit/crash-reporter;1"]
+                        .getService(Ci.nsICrashReporter);
+
+  if (!(crashReporter.Addons in gAppInfo.annotations)) {
     Assert.equal(false, true);
     return;
   }
 
-  let addons = gAppInfo.annotations["Add-ons"].split(",");
+  let addons = gAppInfo.annotations[crashReporter.Addons].split(",");
   Assert.ok(addons.includes(`${encodeURIComponent(aId)}:${encodeURIComponent(aVersion)}`));
 }
 
 /**
  * Tests that an add-on does not appear in the crash report annotations, if
  * crash reporting is enabled. The test will fail if the add-on is in the
  * annotation.
  * @param  aId
@@ -442,22 +445,25 @@ function do_check_in_crash_annotation(aI
  * @param  aVersion
  *         The version of the add-on
  */
 function do_check_not_in_crash_annotation(aId, aVersion) {
   if (!AppConstants.MOZ_CRASHREPORTER) {
     return;
   }
 
-  if (!("Add-ons" in gAppInfo.annotations)) {
+  let crashReporter = Cc["@mozilla.org/toolkit/crash-reporter;1"]
+                        .getService(Ci.nsICrashReporter);
+
+  if (!(crashReporter.Addons in gAppInfo.annotations)) {
     Assert.ok(true);
     return;
   }
 
-  let addons = gAppInfo.annotations["Add-ons"].split(",");
+  let addons = gAppInfo.annotations[crashReporter.Addons].split(",");
   Assert.ok(!addons.includes(`${encodeURIComponent(aId)}:${encodeURIComponent(aVersion)}`));
 }
 
 /**
  * Returns a testcase xpi
  *
  * @param  aName
  *         The name of the testcase (without extension)
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -3483,49 +3483,49 @@ XREMain::XRE_mainInit(bool* aExitFlag)
     rv = nsXREDirProvider::GetUserAppDataDirectory(getter_AddRefs(file));
     if (NS_SUCCEEDED(rv)) {
       CrashReporter::SetUserAppDataDirectory(file);
     }
     if (mAppData->crashReporterURL)
       CrashReporter::SetServerURL(nsDependentCString(mAppData->crashReporterURL));
 
     // We overwrite this once we finish starting up.
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("StartupCrash"),
-                                       NS_LITERAL_CSTRING("1"));
+    CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::StartupCrash,
+                                       true);
 
     // pass some basic info from the app data
     if (mAppData->vendor)
-      CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Vendor"),
+      CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::Vendor,
                                          nsDependentCString(mAppData->vendor));
     if (mAppData->name)
-      CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProductName"),
+      CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::ProductName,
                                          nsDependentCString(mAppData->name));
     if (mAppData->ID)
-      CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProductID"),
+      CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::ProductID,
                                          nsDependentCString(mAppData->ID));
     if (mAppData->version)
-      CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Version"),
+      CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::Version,
                                          nsDependentCString(mAppData->version));
     if (mAppData->buildID)
-      CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("BuildID"),
+      CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::BuildID,
                                          nsDependentCString(mAppData->buildID));
 
     nsDependentCString releaseChannel(NS_STRINGIFY(MOZ_UPDATE_CHANNEL));
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ReleaseChannel"),
-                                       releaseChannel);
+    CrashReporter::AnnotateCrashReport(
+      CrashReporter::Annotation::ReleaseChannel, releaseChannel);
 #ifdef MOZ_LINKER
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CrashAddressLikelyWrong"),
-                                       IsSignalHandlingBroken() ? NS_LITERAL_CSTRING("1")
-                                                                : NS_LITERAL_CSTRING("0"));
+    CrashReporter::AnnotateCrashReport(
+      CrashReporter::Annotation::CrashAddressLikelyWrong,
+      IsSignalHandlingBroken());
 #endif
 
 #ifdef XP_WIN
     nsAutoString appInitDLLs;
     if (widget::WinUtils::GetAppInitDLLs(appInitDLLs)) {
-      CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AppInitDLLs"),
+      CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::AppInitDLLs,
                                          NS_ConvertUTF16toUTF8(appInitDLLs));
     }
 #endif
 
     CrashReporter::SetRestartArgs(gArgc, gArgv);
 
     // annotate other data (user id etc)
     nsCOMPtr<nsIFile> userAppDataDir;
@@ -3707,26 +3707,25 @@ if (gSafeMode && SafeModeBlockedByPolicy
             cpuUpdateRevision = static_cast<int>(updateRevision[0]);
             break;
           }
         }
       }
     }
 
     if (cpuUpdateRevision > 0) {
-      CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CPUMicrocodeVersion"),
-                                         nsPrintfCString("0x%x",
-                                                         cpuUpdateRevision));
+      CrashReporter::AnnotateCrashReport(
+        CrashReporter::Annotation::CPUMicrocodeVersion,
+        nsPrintfCString("0x%x", cpuUpdateRevision));
     }
   }
 #endif
 
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("SafeMode"),
-                                       gSafeMode ? NS_LITERAL_CSTRING("1") :
-                                                   NS_LITERAL_CSTRING("0"));
+    CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::SafeMode,
+                                       gSafeMode);
 
   // Handle --no-remote and --new-instance command line arguments. Setup
   // the environment to better accommodate other components and various
   // restart scenarios.
   ar = CheckArg("no-remote", true);
   if (ar == ARG_BAD) {
     PR_fprintf(PR_STDERR, "Error: argument --no-remote is invalid when argument --osint is specified\n");
     return 1;
@@ -3839,18 +3838,19 @@ static void AnnotateSystemManufacturer()
   }
 
   VARIANT value;
   VariantInit(&value);
 
   hr = classObject->Get(L"Manufacturer", 0, &value, 0, 0);
 
   if (SUCCEEDED(hr) && V_VT(&value) == VT_BSTR) {
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("BIOS_Manufacturer"),
-                                       NS_ConvertUTF16toUTF8(V_BSTR(&value)));
+    CrashReporter::AnnotateCrashReport(
+      CrashReporter::Annotation::BIOS_Manufacturer,
+      NS_ConvertUTF16toUTF8(V_BSTR(&value)));
   }
 
   VariantClear(&value);
 }
 
 static void PR_CALLBACK AnnotateSystemManufacturer_ThreadStart(void*)
 {
   HRESULT hr = CoInitialize(nullptr);
@@ -4544,26 +4544,28 @@ XREMain::XRE_mainRun()
   if (NS_SUCCEEDED(rv)) {
     nsCOMPtr<nsIPrefBranch> defaultPrefBranch;
     rv = prefs->GetDefaultBranch(nullptr, getter_AddRefs(defaultPrefBranch));
 
     if (NS_SUCCEEDED(rv)) {
       nsAutoCString sval;
       rv = defaultPrefBranch->GetCharPref("app.update.channel", sval);
       if (NS_SUCCEEDED(rv)) {
-        CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ReleaseChannel"),
-                                            sval);
+        CrashReporter::AnnotateCrashReport(
+          CrashReporter::Annotation::ReleaseChannel, sval);
       }
     }
   }
   // Needs to be set after xpcom initialization.
-  CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonBase"),
-                                     nsPrintfCString("%.16" PRIu64, uint64_t(gMozillaPoisonBase)));
-  CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonSize"),
-                                     nsPrintfCString("%" PRIu32, uint32_t(gMozillaPoisonSize)));
+  CrashReporter::AnnotateCrashReport(
+    CrashReporter::Annotation::FramePoisonBase,
+    nsPrintfCString("%.16" PRIu64, uint64_t(gMozillaPoisonBase)));
+  CrashReporter::AnnotateCrashReport(
+    CrashReporter::Annotation::FramePoisonSize,
+    nsPrintfCString("%" PRIu32, uint32_t(gMozillaPoisonSize)));
 
   bool includeContextHeap =
     Preferences::GetBool("toolkit.crashreporter.include_context_heap", false);
   CrashReporter::SetIncludeContextHeap(includeContextHeap);
 
 #ifdef XP_WIN
   PR_CreateThread(PR_USER_THREAD, AnnotateSystemManufacturer_ThreadStart, 0,
                   PR_PRIORITY_LOW, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0);
@@ -4708,17 +4710,18 @@ XREMain::XRE_mainRun()
   NS_ENSURE_TRUE(appStartup, NS_ERROR_FAILURE);
 
   mDirProvider.DoStartup();
 
   OverrideDefaultLocaleIfNeeded();
 
   nsCString userAgentLocale;
   LocaleService::GetInstance()->GetAppLocaleAsLangTag(userAgentLocale);
-  CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("useragent_locale"), userAgentLocale);
+  CrashReporter::AnnotateCrashReport(
+    CrashReporter::Annotation::useragent_locale, userAgentLocale);
 
   appStartup->GetShuttingDown(&mShuttingDown);
 
   nsCOMPtr<nsICommandLineRunner> cmdLine;
 
   nsCOMPtr<nsIFile> workingDir;
   rv = NS_GetSpecialDirectory(NS_OS_CURRENT_WORKING_DIR, getter_AddRefs(workingDir));
   NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
@@ -4799,18 +4802,18 @@ XREMain::XRE_mainRun()
 
     nsCOMPtr<nsIObserverService> obsService =
       mozilla::services::GetObserverService();
     if (obsService)
       obsService->NotifyObservers(nullptr, "final-ui-startup", nullptr);
 
     (void)appStartup->DoneStartingUp();
 
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("StartupCrash"),
-                                       NS_LITERAL_CSTRING("0"));
+    CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::StartupCrash,
+                                       false);
 
     appStartup->GetShuttingDown(&mShuttingDown);
   }
 
   if (!mShuttingDown) {
     rv = cmdLine->Run();
     NS_ENSURE_SUCCESS_LOG(rv, NS_ERROR_FAILURE);