Bug 1348273 - Convert the IPC-related annotations; r?jimm draft
authorGabriele Svelto <gsvelto@mozilla.com>
Fri, 16 Mar 2018 21:50:51 +0100
changeset 781398 e06b2524a7591a923ca7e6b0782e30af40ac5cfc
parent 781397 a7e6ae211bb9e7993e464e843e4a217ec8b6e9fe
child 781399 c14726b2d1cf63b2a52f37de30682227742a659a
push id106292
push usergsvelto@mozilla.com
push dateThu, 12 Apr 2018 22:06:23 +0000
reviewersjimm
bugs1348273
milestone61.0a1
Bug 1348273 - Convert the IPC-related annotations; r?jimm MozReview-Commit-ID: LIywhQ0y08O
dom/ipc/ContentChild.cpp
dom/ipc/ContentParent.cpp
dom/ipc/TabChild.cpp
dom/plugins/base/nsPluginHost.cpp
dom/plugins/base/nsPluginsDirDarwin.cpp
dom/plugins/ipc/PluginMessageUtils.h
dom/plugins/ipc/PluginModuleParent.cpp
ipc/chromium/src/chrome/common/ipc_channel_posix.cc
ipc/glue/IPCMessageUtils.h
ipc/glue/MessageChannel.cpp
ipc/glue/MessageLink.cpp
ipc/glue/ProtocolUtils.cpp
ipc/glue/ProtocolUtils.h
ipc/glue/Transport_posix.cpp
ipc/mscom/COMPtrHolder.h
ipc/mscom/ProxyStream.cpp
ipc/mscom/RegistrationAnnotator.cpp
toolkit/crashreporter/CrashAnnotations.yaml
toolkit/xre/nsAppRunner.cpp
toolkit/xre/nsEmbedFunctions.cpp
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -1748,26 +1748,24 @@ ContentChild::RecvSetProcessSandbox(cons
   }
 #elif defined(XP_WIN)
   mozilla::SandboxTarget::Instance()->StartSandbox();
 #elif defined(XP_MACOSX)
   sandboxEnabled = StartMacOSContentSandbox();
 #endif
 
   CrashReporter::AnnotateCrashReport(
-    NS_LITERAL_CSTRING("ContentSandboxEnabled"),
-    sandboxEnabled? NS_LITERAL_CSTRING("1") : NS_LITERAL_CSTRING("0"));
+    CrashReporter::Annotation::ContentSandboxEnabled, sandboxEnabled);
 #if defined(XP_LINUX) && !defined(OS_ANDROID)
-  nsAutoCString flagsString;
-  flagsString.AppendInt(SandboxInfo::Get().AsInteger());
 
   CrashReporter::AnnotateCrashReport(
-    NS_LITERAL_CSTRING("ContentSandboxCapabilities"), flagsString);
+    CrashReporter::Annotation::ContentSandboxCapabilities,
+    static_cast<int>(SandboxInfo::Get().AsInteger()));
 #endif /* XP_LINUX && !OS_ANDROID */
-  CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("RemoteType"),
+  CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::RemoteType,
                                      NS_ConvertUTF16toUTF8(GetRemoteType()));
 #endif /* MOZ_CONTENT_SANDBOX */
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 ContentChild::RecvBidiKeyboardNotify(const bool& aIsLangRTL,
@@ -2409,17 +2407,18 @@ ContentChild::ProcessingError(Result aCo
     case MsgValueError:
       break;
 
     default:
       MOZ_CRASH("not reached");
   }
 
   nsDependentCString reason(aReason);
-  CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ipc_channel_error"), reason);
+  CrashReporter::AnnotateCrashReport(
+    CrashReporter::Annotation::ipc_channel_error, reason);
 
   MOZ_CRASH("Content child abort due to IPC error");
 }
 
 nsresult
 ContentChild::AddRemoteAlertObserver(const nsString& aData,
                                      nsIObserver* aObserver)
 {
@@ -3015,18 +3014,19 @@ ContentChild::RecvShutdown()
 
   ShutdownInternal();
   return IPC_OK();
 }
 
 void
 ContentChild::ShutdownInternal()
 {
-  CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCShutdownState"),
-                                     NS_LITERAL_CSTRING("RecvShutdown"));
+  CrashReporter::AnnotateCrashReport(
+    CrashReporter::Annotation::IPCShutdownState,
+    NS_LITERAL_CSTRING("RecvShutdown"));
 
   // If we receive the shutdown message from within a nested event loop, we want
   // to wait for that event loop to finish. Otherwise we could prematurely
   // terminate an "unload" or "pagehide" event handler (which might be doing a
   // sync XHR, for example). However, we need to strike a balance and shut down
   // within a reasonable amount of time (mShutdownTimeout) or the ForceKillTimer
   // in the parent will execute and kill us hard.
   // Note that we only have to check the recursion count for the current
@@ -3082,20 +3082,21 @@ ContentChild::ShutdownInternal()
   }
 #endif
 
   // Start a timer that will insure we quickly exit after a reasonable
   // period of time. Prevents shutdown hangs after our connection to the
   // parent closes.
   StartForceKillTimer();
 
-  CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCShutdownState"),
-                                     NS_LITERAL_CSTRING("SendFinishShutdown (sending)"));
+  CrashReporter::AnnotateCrashReport(
+    CrashReporter::Annotation::IPCShutdownState,
+    NS_LITERAL_CSTRING("SendFinishShutdown (sending)"));
   bool sent = SendFinishShutdown();
-  CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCShutdownState"),
+  CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::IPCShutdownState,
                                      sent ? NS_LITERAL_CSTRING("SendFinishShutdown (sent)")
                                           : NS_LITERAL_CSTRING("SendFinishShutdown (failed)"));
 }
 
 PBrowserOrId
 ContentChild::GetBrowserOrId(TabChild* aTabChild)
 {
   if (!aTabChild ||
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2180,18 +2180,18 @@ ContentParent::~ContentParent()
                         Pid(), "open channel",
                         static_cast<nsIContentParent*>(this), refcnt,
                         numQueuedMessages,
                         NS_ConvertUTF16toUTF8(mRemoteType).get(),
                         mCalledClose ? "true" : "false",
                         mCalledKillHard ? "true" : "false",
                         mShutdownPending ? "true" : "false",
                         mIPCOpen ? "true" : "false");
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCFatalErrorMsg"),
-                                       msg);
+    CrashReporter::AnnotateCrashReport(
+      CrashReporter::Annotation::IPCFatalErrorMsg, msg);
     switch (channel->GetChannelState__TotallyRacy()) {
         case ChannelOpening:
             MOZ_CRASH("MessageChannel destroyed without being closed " \
                       "(mChannelState == ChannelOpening).");
             break;
         case ChannelConnected:
             MOZ_CRASH("MessageChannel destroyed without being closed " \
                       "(mChannelState == ChannelConnected).");
@@ -3172,23 +3172,21 @@ ContentParent::KillHard(const char* aRea
   // of the parent and child for submission to the crash server.
   if (mCrashReporter) {
     // GeneratePairedMinidump creates two minidumps for us - the main
     // one is for the content process we're about to kill, and the other
     // one is for the main browser process. That second one is the extra
     // minidump tagging along, so we have to tell the crash reporter that
     // it exists and is being appended.
     nsAutoCString additionalDumps("browser");
-    mCrashReporter->AddNote(
-      NS_LITERAL_CSTRING("additional_minidumps"),
-      additionalDumps);
+    mCrashReporter->AddAnnotation(
+      CrashReporter::Annotation::additional_minidumps, additionalDumps);
     nsDependentCString reason(aReason);
-    mCrashReporter->AddNote(
-      NS_LITERAL_CSTRING("ipc_channel_error"),
-      reason);
+    mCrashReporter->AddAnnotation(CrashReporter::Annotation::ipc_channel_error,
+                                  reason);
 
     Telemetry::Accumulate(Telemetry::SUBPROCESS_KILL_HARD, reason, 1);
 
     RefPtr<ContentParent> self = this;
     std::function<void(bool)> callback = [self](bool aResult) {
       self->OnGenerateMinidumpComplete(aResult);
     };
     // Generate the report and insert into the queue for submittal.
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1165,17 +1165,17 @@ TabChild::RecvLoadURL(const nsCString& a
     WebNavigation()->LoadURI(NS_ConvertUTF8toUTF16(aURI).get(),
                              nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
                              nsIWebNavigation::LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL,
                              nullptr, nullptr, nullptr, nsContentUtils::GetSystemPrincipal());
   if (NS_FAILED(rv)) {
       NS_WARNING("WebNavigation()->LoadURI failed. Eating exception, what else can I do?");
   }
 
-  CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("URL"), aURI);
+  CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::URL, aURI);
 
   return IPC_OK();
 }
 
 void
 TabChild::DoFakeShow(const TextureFactoryIdentifier& aTextureFactoryIdentifier,
                      const layers::LayersId& aLayersId,
                      const CompositorOptions& aCompositorOptions,
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -6,17 +6,16 @@
 /* nsPluginHost.cpp - top-level plugin management code */
 
 #include "nscore.h"
 #include "nsPluginHost.h"
 
 #include <cstdlib>
 #include <stdio.h>
 #include "prio.h"
-#include "nsExceptionHandler.h"
 #include "nsNPAPIPlugin.h"
 #include "nsNPAPIPluginStreamListener.h"
 #include "nsNPAPIPluginInstance.h"
 #include "nsPluginInstanceOwner.h"
 #include "nsObjectLoadingContent.h"
 #include "nsIHTTPHeaderListener.h"
 #include "nsIHttpHeaderVisitor.h"
 #include "nsIObserverService.h"
--- a/dom/plugins/base/nsPluginsDirDarwin.cpp
+++ b/dom/plugins/base/nsPluginsDirDarwin.cpp
@@ -404,53 +404,24 @@ nsresult nsPluginFile::GetPluginInfo(nsP
   // First look for data in a bundle plist
   if (bundle) {
     ParsePlistPluginInfo(info, bundle);
     ::CFRelease(bundle);
     if (info.fVariantCount > 0)
       return NS_OK;
   }
 
-  // Don't load "fbplugin" or any plugins whose name starts with "fbplugin_"
-  // (Facebook plugins) if we're running on OS X 10.10 (Yosemite) or later.
-  // A "fbplugin" file crashes on load, in the call to LoadPlugin() below.
-  // See bug 1086977.
-  if (nsCocoaFeatures::OnYosemiteOrLater()) {
-    if (fileName.EqualsLiteral("fbplugin") ||
-        StringBeginsWith(fileName, NS_LITERAL_CSTRING("fbplugin_"))) {
-      nsAutoCString msg;
-      msg.AppendPrintf("Preventing load of %s (see bug 1086977)",
-                       fileName.get());
-      NS_WARNING(msg.get());
-      return NS_ERROR_FAILURE;
-    }
-
-    // The block above assumes that "fbplugin" is the filename of the plugin
-    // to be blocked, or that the filename starts with "fbplugin_".  But we
-    // don't yet know for sure if this is always true.  So for the time being
-    // record extra information in our crash logs.
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Bug_1086977"),
-                                       fileName);
-  }
-
   // It's possible that our plugin has 2 entry points that'll give us mime type
   // info. Quicktime does this to get around the need of having admin rights to
   // change mime info in the resource fork. We need to use this info instead of
   // the resource. See bug 113464.
 
   // Sadly we have to load the library for this to work.
   rv = LoadPlugin(outLibrary);
 
-  if (nsCocoaFeatures::OnYosemiteOrLater()) {
-    // If we didn't crash in LoadPlugin(), change the previous annotation so we
-    // don't sow confusion.
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Bug_1086977"),
-                                       NS_LITERAL_CSTRING("Didn't crash, please ignore"));
-  }
-
   if (NS_FAILED(rv))
     return rv;
 
   // Try to get data from NP_GetMIMEDescription
   if (pLibrary) {
     NP_GETMIMEDESCRIPTION pfnGetMimeDesc = (NP_GETMIMEDESCRIPTION)PR_FindFunctionSymbol(pLibrary, NP_GETMIMEDESCRIPTION_NAME);
     if (pfnGetMimeDesc)
       ParsePluginMimeDescription(pfnGetMimeDesc(), info);
--- a/dom/plugins/ipc/PluginMessageUtils.h
+++ b/dom/plugins/ipc/PluginMessageUtils.h
@@ -18,17 +18,16 @@
 #include "gfxipc/ShadowLayerUtils.h"
 
 #include "npapi.h"
 #include "npruntime.h"
 #include "npfunctions.h"
 #include "nsString.h"
 #include "nsTArray.h"
 #include "mozilla/Logging.h"
-#include "nsExceptionHandler.h"
 #include "nsHashKeys.h"
 
 #ifdef XP_MACOSX
 #include "PluginInterposeOSX.h"
 #else
 namespace mac_plugin_interposing { class NSCursorInfo { }; }
 #endif
 using mac_plugin_interposing::NSCursorInfo;
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -721,36 +721,46 @@ PluginModuleChromeParent::WriteExtraData
 
     // Get the plugin filename, try to get just the file leafname
     const std::string& pluginFile = mSubprocess->GetPluginFilePath();
     size_t filePos = pluginFile.rfind(FILE_PATH_SEPARATOR);
     if (filePos == std::string::npos)
         filePos = 0;
     else
         filePos++;
-    mCrashReporter->AddNote(NS_LITERAL_CSTRING("PluginFilename"), cstring(pluginFile.substr(filePos).c_str()));
-
-    mCrashReporter->AddNote(NS_LITERAL_CSTRING("PluginName"), mPluginName);
-    mCrashReporter->AddNote(NS_LITERAL_CSTRING("PluginVersion"), mPluginVersion);
+    mCrashReporter->AddAnnotation(CrashReporter::Annotation::PluginFilename,
+                                  cstring(pluginFile.substr(filePos).c_str()));
+    mCrashReporter->AddAnnotation(CrashReporter::Annotation::PluginName,
+                                  mPluginName);
+    mCrashReporter->AddAnnotation(CrashReporter::Annotation::PluginVersion,
+                                  mPluginVersion);
 
     if (mCrashReporter) {
 #ifdef XP_WIN
         if (mPluginCpuUsageOnHang.Length() > 0) {
-            mCrashReporter->AddNote(NS_LITERAL_CSTRING("NumberOfProcessors"),
-                                    nsPrintfCString("%d", PR_GetNumberOfProcessors()));
+            mCrashReporter->AddAnnotation(
+              CrashReporter::Annotation::NumberOfProcessors,
+              PR_GetNumberOfProcessors());
 
             nsCString cpuUsageStr;
             cpuUsageStr.AppendFloat(std::ceil(mPluginCpuUsageOnHang[0] * 100) / 100);
-            mCrashReporter->AddNote(NS_LITERAL_CSTRING("PluginCpuUsage"), cpuUsageStr);
+            mCrashReporter->AddAnnotation(
+              CrashReporter::Annotation::PluginCpuUsage,
+              cpuUsageStr);
 
 #ifdef MOZ_CRASHREPORTER_INJECTOR
-            for (uint32_t i=1; i<mPluginCpuUsageOnHang.Length(); ++i) {
+            for (uint32_t i = 1; i < mPluginCpuUsageOnHang.Length(); ++i) {
                 nsCString tempStr;
                 tempStr.AppendFloat(std::ceil(mPluginCpuUsageOnHang[i] * 100) / 100);
-                mCrashReporter->AddNote(nsPrintfCString("CpuUsageFlashProcess%d", i), tempStr);
+                // HACK: There can only be at most two flash processes hence
+                // the hardcoded annotations
+                CrashReporter::Annotation annotation =
+                  (i == 1) ? CrashReporter::Annotation::CpuUsageFlashProcess1
+                           : CrashReporter::Annotation::CpuUsageFlashProcess2;
+                mCrashReporter->AddAnnotation(annotation, tempStr);
             }
 #endif
         }
 #endif
     }
 }
 
 void
@@ -1229,18 +1239,18 @@ PluginModuleChromeParent::OnTakeFullMini
                 // Include the content process minidump
                 if (CreatePluginMinidump(aContentPid, 0,
                                          pluginDumpFile,
                                          NS_LITERAL_CSTRING("content"))) {
                     additionalDumps.AppendLiteral(",content");
                 }
             }
         }
-        mCrashReporter->AddNote(NS_LITERAL_CSTRING("additional_minidumps"),
-                                additionalDumps);
+        mCrashReporter->AddAnnotation(Annotation::additional_minidumps,
+                                      additionalDumps);
 
         mTakeFullMinidumpCallback.Invoke(mCrashReporter->MinidumpID());
     } else {
         mTakeFullMinidumpCallback.Invoke(EmptyString());
         NS_WARNING("failed to capture paired minidumps from hang");
     }
 }
 
@@ -1291,28 +1301,25 @@ PluginModuleChromeParent::TerminateChild
     mCrashReporterMutex.AssertCurrentThreadOwns();
 
     if (!mCrashReporter) {
         // If mCrashReporter is null then the hang has ended, the plugin module
         // is shutting down. There's nothing to do here.
         mTerminateChildProcessCallback.Invoke(true);
         return;
     }
-    mCrashReporter->AddNote(NS_LITERAL_CSTRING("PluginHang"),
-                            NS_LITERAL_CSTRING("1"));
-    mCrashReporter->AddNote(NS_LITERAL_CSTRING("HangMonitorDescription"),
-                            aMonitorDescription);
+    mCrashReporter->AddAnnotation(Annotation::PluginHang, true);
+    mCrashReporter->AddAnnotation(Annotation::HangMonitorDescription,
+                                  aMonitorDescription);
 #ifdef XP_WIN
     if (mHangUIParent) {
         unsigned int hangUIDuration = mHangUIParent->LastShowDurationMs();
         if (hangUIDuration) {
-            nsPrintfCString strHangUIDuration("%u", hangUIDuration);
-            mCrashReporter->AddNote(
-                    NS_LITERAL_CSTRING("PluginHangUIDuration"),
-                    strHangUIDuration);
+            mCrashReporter->AddAnnotation(Annotation::PluginHangUIDuration,
+                                          hangUIDuration);
         }
     }
 #endif // XP_WIN
 
     mozilla::ipc::ScopedProcessHandle geckoChildProcess;
     bool childOpened = base::OpenProcessHandle(OtherPid(),
                                                &geckoChildProcess.rwget());
 
@@ -1568,17 +1575,18 @@ PluginModuleChromeParent::ProcessFirstMi
         NS_WARNING("[PluginModuleParent::ActorDestroy] abnormal shutdown without minidump!");
         return;
     }
 
     PLUGIN_LOG_DEBUG(("got child minidump: %s",
                       NS_ConvertUTF16toUTF8(mCrashReporter->MinidumpID()).get()));
 
     if (!flashProcessType.IsEmpty()) {
-        mCrashReporter->AddNote(NS_LITERAL_CSTRING("FlashProcessDump"), flashProcessType);
+        mCrashReporter->AddAnnotation(Annotation::FlashProcessDump,
+                                      flashProcessType);
     }
     mCrashReporter->FinalizeCrashReport();
 }
 
 void
 PluginModuleParent::ActorDestroy(ActorDestroyReason why)
 {
     switch (why) {
--- a/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
+++ b/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
@@ -243,31 +243,34 @@ bool Channel::ChannelImpl::CreatePipe(co
                                       Mode mode) {
   DCHECK(server_listen_pipe_ == -1 && pipe_ == -1);
 
   // socketpair()
   pipe_name_ = WideToASCII(channel_id);
   if (mode == MODE_SERVER) {
     int pipe_fds[2];
     if (socketpair(AF_UNIX, SOCK_STREAM, 0, pipe_fds) != 0) {
-      mozilla::ipc::AnnotateCrashReportWithErrno("IpcCreatePipeSocketPairErrno", errno);
+      mozilla::ipc::AnnotateCrashReportWithErrno(
+        CrashReporter::Annotation::IpcCreatePipeSocketPairErrno, errno);
       return false;
     }
     // Set both ends to be non-blocking.
     if (fcntl(pipe_fds[0], F_SETFL, O_NONBLOCK) == -1 ||
         fcntl(pipe_fds[1], F_SETFL, O_NONBLOCK) == -1) {
-      mozilla::ipc::AnnotateCrashReportWithErrno("IpcCreatePipeFcntlErrno", errno);
+      mozilla::ipc::AnnotateCrashReportWithErrno(
+        CrashReporter::Annotation::IpcCreatePipeFcntlErrno, errno);
       HANDLE_EINTR(close(pipe_fds[0]));
       HANDLE_EINTR(close(pipe_fds[1]));
       return false;
     }
 
     if (!SetCloseOnExec(pipe_fds[0]) ||
         !SetCloseOnExec(pipe_fds[1])) {
-      mozilla::ipc::AnnotateCrashReportWithErrno("IpcCreatePipeCloExecErrno", errno);
+      mozilla::ipc::AnnotateCrashReportWithErrno(
+        CrashReporter::Annotation::IpcCreatePipeCloExecErrno, errno);
       HANDLE_EINTR(close(pipe_fds[0]));
       HANDLE_EINTR(close(pipe_fds[1]));
       return false;
     }
 
     pipe_ = pipe_fds[0];
     client_pipe_ = pipe_fds[1];
 
--- a/ipc/glue/IPCMessageUtils.h
+++ b/ipc/glue/IPCMessageUtils.h
@@ -130,22 +130,24 @@ struct EnumSerializer {
   static void Write(Message* aMsg, const paramType& aValue) {
     MOZ_RELEASE_ASSERT(EnumValidator::IsLegalValue(aValue));
     WriteParam(aMsg, uintParamType(aValue));
   }
 
   static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
     uintParamType value;
     if (!ReadParam(aMsg, aIter, &value)) {
-      CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCReadErrorReason"),
-                                         NS_LITERAL_CSTRING("Bad iter"));
+      CrashReporter::AnnotateCrashReport(
+        CrashReporter::Annotation::IPCReadErrorReason,
+        NS_LITERAL_CSTRING("Bad iter"));
       return false;
     } else if (!EnumValidator::IsLegalValue(paramType(value))) {
-      CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCReadErrorReason"),
-                                         NS_LITERAL_CSTRING("Illegal value"));
+      CrashReporter::AnnotateCrashReport(
+        CrashReporter::Annotation::IPCReadErrorReason,
+        NS_LITERAL_CSTRING("Illegal value"));
       return false;
     }
     *aResult = paramType(value);
     return true;
   }
 };
 
 template <typename E,
--- a/ipc/glue/MessageChannel.cpp
+++ b/ipc/glue/MessageChannel.cpp
@@ -669,19 +669,18 @@ MessageChannel::CanSend() const
     MonitorAutoLock lock(*mMonitor);
     return Connected();
 }
 
 void
 MessageChannel::WillDestroyCurrentMessageLoop()
 {
 #if defined(DEBUG)
-    CrashReporter::AnnotateCrashReport(
-        NS_LITERAL_CSTRING("IPCFatalErrorProtocol"),
-        nsDependentCString(mName));
+    CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::IPCFatalErrorProtocol,
+                                       nsDependentCString(mName));
     MOZ_CRASH("MessageLoop destroyed before MessageChannel that's bound to it");
 #endif
 
     // Clear mWorkerThread to avoid posting to it in the future.
     MonitorAutoLock lock(*mMonitor);
     mWorkerLoop = nullptr;
 }
 
@@ -696,18 +695,17 @@ MessageChannel::Clear()
     // crash.
     //
     // In practice, mListener owns the channel, so the channel gets deleted
     // before mListener.  But just to be safe, mListener is a weak pointer.
 
 #if !defined(ANDROID)
     if (!Unsound_IsClosed()) {
         CrashReporter::AnnotateCrashReport(
-            NS_LITERAL_CSTRING("IPCFatalErrorProtocol"),
-            nsDependentCString(mName));
+          CrashReporter::Annotation::IPCFatalErrorProtocol, nsDependentCString(mName));
         switch (mChannelState) {
             case ChannelOpening:
                 MOZ_CRASH("MessageChannel destroyed without being closed " \
                           "(mChannelState == ChannelOpening).");
                 break;
             case ChannelConnected:
                 MOZ_CRASH("MessageChannel destroyed without being closed " \
                           "(mChannelState == ChannelConnected).");
--- a/ipc/glue/MessageLink.cpp
+++ b/ipc/glue/MessageLink.cpp
@@ -154,18 +154,22 @@ ProcessLink::EchoMessage(Message *msg)
                                            msg));
     // OnEchoMessage takes ownership of |msg|
 }
 
 void
 ProcessLink::SendMessage(Message *msg)
 {
     if (msg->size() > IPC::Channel::kMaximumMessageSize) {
-      CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCMessageName"), nsDependentCString(msg->name()));
-      CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCMessageSize"), nsPrintfCString("%d", msg->size()));
+      CrashReporter::AnnotateCrashReport(
+        CrashReporter::Annotation::IPCMessageName,
+        nsDependentCString(msg->name()));
+      CrashReporter::AnnotateCrashReport(
+        CrashReporter::Annotation::IPCMessageSize,
+        static_cast<int>(msg->size()));
       MOZ_CRASH("IPC message size is too large");
     }
 
     if (!mChan->mIsPostponingSends) {
         mChan->AssertWorkerThread();
     }
     mChan->mMonitor->AssertCurrentThreadOwns();
 
--- a/ipc/glue/ProtocolUtils.cpp
+++ b/ipc/glue/ProtocolUtils.cpp
@@ -204,17 +204,17 @@ bool DuplicateHandle(HANDLE aSourceHandl
 #endif
 
   // Finally, see if we already have access to the process.
   ScopedProcessHandle targetProcess(OpenProcess(PROCESS_DUP_HANDLE,
                                                 FALSE,
                                                 aTargetProcessId));
   if (!targetProcess) {
     CrashReporter::AnnotateCrashReport(
-      NS_LITERAL_CSTRING("IPCTransportFailureReason"),
+      CrashReporter::Annotation::IPCTransportFailureReason,
       NS_LITERAL_CSTRING("Failed to open target process."));
     return false;
   }
 
   return !!::DuplicateHandle(::GetCurrentProcess(), aSourceHandle,
                               targetProcess, aTargetHandle,
                               aDesiredAccess, FALSE, aOptions);
 }
@@ -226,30 +226,28 @@ AnnotateSystemError()
   int64_t error = 0;
 #if defined(XP_WIN)
   error = ::GetLastError();
 #elif defined(OS_POSIX)
   error = errno;
 #endif
   if (error) {
     CrashReporter::AnnotateCrashReport(
-      NS_LITERAL_CSTRING("IPCSystemError"),
+      CrashReporter::Annotation::IPCSystemError,
       nsPrintfCString("%" PRId64, error));
   }
 }
 
 #if defined(XP_MACOSX)
 void
-AnnotateCrashReportWithErrno(const char* tag, int error)
+AnnotateCrashReportWithErrno(CrashReporter::Annotation tag, int error)
 {
-  CrashReporter::AnnotateCrashReport(
-    nsCString(tag),
-    nsPrintfCString("%d", error));
+  CrashReporter::AnnotateCrashReport(tag, error);
 }
-#endif
+#endif // defined(XP_MACOSX)
 
 void
 LogMessageForProtocol(const char* aTopLevelProtocol, base::ProcessId aOtherPid,
                       const char* aContextDescription,
                       uint32_t aMessageId,
                       MessageDirection aDirection)
 {
   nsPrintfCString logMessage("[time: %" PRId64 "][%d%s%d] [%s] %s %s\n",
@@ -283,20 +281,22 @@ FatalError(const char* aProtocolName, co
   formattedMessage.AppendLiteral("]: \"");
   formattedMessage.AppendASCII(aMsg);
   if (aIsParent) {
     // We're going to crash the parent process because at this time
     // there's no other really nice way of getting a minidump out of
     // this process if we're off the main thread.
     formattedMessage.AppendLiteral("\". Intentionally crashing.");
     NS_ERROR(formattedMessage.get());
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCFatalErrorProtocol"),
-                                       nsDependentCString(aProtocolName));
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCFatalErrorMsg"),
-                                       nsDependentCString(aMsg));
+    CrashReporter::AnnotateCrashReport(
+      CrashReporter::Annotation::IPCFatalErrorProtocol,
+      nsDependentCString(aProtocolName));
+    CrashReporter::AnnotateCrashReport(
+      CrashReporter::Annotation::IPCFatalErrorMsg,
+      nsDependentCString(aMsg));
     AnnotateSystemError();
     MOZ_CRASH("IPC FatalError in the parent process!");
   } else {
     formattedMessage.AppendLiteral("\". abort()ing as a result.");
     MOZ_CRASH_UNSAFE_OOL(formattedMessage.get());
   }
 }
 
--- a/ipc/glue/ProtocolUtils.h
+++ b/ipc/glue/ProtocolUtils.h
@@ -25,16 +25,17 @@
 #include "mozilla/ipc/MessageLink.h"
 #include "mozilla/LinkedList.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/MozPromise.h"
 #include "mozilla/Mutex.h"
 #include "mozilla/NotNull.h"
 #include "mozilla/UniquePtr.h"
 #include "MainThreadUtils.h"
+#include "nsICrashReporter.h"
 #include "nsILabelableRunnable.h"
 
 #if defined(ANDROID) && defined(DEBUG)
 #include <android/log.h>
 #endif
 
 template<typename T> class nsTHashtable;
 template<typename T> class nsPtrHashKey;
@@ -708,19 +709,19 @@ private:
 
     bool mValid;
     mozilla::ipc::Transport::Mode mMode;
     TransportDescriptor mTransport;
     ProcessId mMyPid, mOtherPid;
 };
 
 #if defined(XP_MACOSX)
-void AnnotateCrashReportWithErrno(const char* tag, int error);
+void AnnotateCrashReportWithErrno(CrashReporter::Annotation tag, int error);
 #else
-static inline void AnnotateCrashReportWithErrno(const char* tag, int error)
+static inline void AnnotateCrashReportWithErrno(CrashReporter::Annotation tag, int error)
 {}
 #endif
 
 // This function is used internally to create a pair of Endpoints. See the
 // comment above Endpoint for a description of how it might be used.
 template<class PFooParent, class PFooChild>
 nsresult
 CreateEndpoints(const PrivateIPDLInterface& aPrivate,
@@ -730,17 +731,18 @@ CreateEndpoints(const PrivateIPDLInterfa
                 Endpoint<PFooChild>* aChildEndpoint)
 {
   MOZ_RELEASE_ASSERT(aParentDestPid);
   MOZ_RELEASE_ASSERT(aChildDestPid);
 
   TransportDescriptor parentTransport, childTransport;
   nsresult rv;
   if (NS_FAILED(rv = CreateTransport(aParentDestPid, &parentTransport, &childTransport))) {
-    AnnotateCrashReportWithErrno("IpcCreateEndpointsNsresult", int(rv));
+    AnnotateCrashReportWithErrno(
+      CrashReporter::Annotation::IpcCreateEndpointsNsresult, int(rv));
     return rv;
   }
 
   *aParentEndpoint = Endpoint<PFooParent>(aPrivate, mozilla::ipc::Transport::MODE_SERVER,
                                           parentTransport, aParentDestPid, aChildDestPid);
 
   *aChildEndpoint = Endpoint<PFooChild>(aPrivate, mozilla::ipc::Transport::MODE_CLIENT,
                                         childTransport, aChildDestPid, aParentDestPid);
--- a/ipc/glue/Transport_posix.cpp
+++ b/ipc/glue/Transport_posix.cpp
@@ -35,21 +35,23 @@ CreateTransport(base::ProcessId aProcIdO
   if (fd1 < 0 || fd2 < 0) {
     return NS_ERROR_TRANSPORT_INIT;
   }
 
   // The Transport closes these fds when it goes out of scope, so we
   // dup them here
   fd1 = dup(fd1);
   if (fd1 < 0) {
-    AnnotateCrashReportWithErrno("IpcCreateTransportDupErrno", errno);
+    AnnotateCrashReportWithErrno(
+      CrashReporter::Annotation::IpcCreateTransportDupErrno, errno);
   }
   fd2 = dup(fd2);
   if (fd2 < 0) {
-    AnnotateCrashReportWithErrno("IpcCreateTransportDupErrno", errno);
+    AnnotateCrashReportWithErrno(
+      CrashReporter::Annotation::IpcCreateTransportDupErrno, errno);
   }
 
   if (fd1 < 0 || fd2 < 0) {
     HANDLE_EINTR(close(fd1));
     HANDLE_EINTR(close(fd2));
     return NS_ERROR_DUPLICATE_HANDLE;
   }
 
--- a/ipc/mscom/COMPtrHolder.h
+++ b/ipc/mscom/COMPtrHolder.h
@@ -205,18 +205,19 @@ struct ParamTraits<mozilla::mscom::COMPt
         return false;
       }
     }
 
     paramType::EnvType env;
 
     mozilla::mscom::ProxyStream proxyStream(_IID, buf.get(), length, &env);
     if (!proxyStream.IsValid()) {
-      CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProxyStreamValid"),
-                                         NS_LITERAL_CSTRING("false"));
+      CrashReporter::AnnotateCrashReport(
+        CrashReporter::Annotation::ProxyStreamValid,
+        NS_LITERAL_CSTRING("false"));
       return false;
     }
 
     typename paramType::COMPtrType ptr;
     if (!proxyStream.GetInterface(mozilla::mscom::getter_AddRefs(ptr))) {
       return false;
     }
 
--- a/ipc/mscom/ProxyStream.cpp
+++ b/ipc/mscom/ProxyStream.cpp
@@ -39,17 +39,18 @@ ProxyStream::ProxyStream()
 // reconstructing the stream from a buffer anyway.
 ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
                          const int aInitBufSize, Environment* aEnv)
   : mGlobalLockedBuf(nullptr)
   , mHGlobal(nullptr)
   , mBufSize(aInitBufSize)
   , mPreserveStream(false)
 {
-  NS_NAMED_LITERAL_CSTRING(kCrashReportKey, "ProxyStreamUnmarshalStatus");
+  CrashReporter::Annotation kCrashReportKey =
+    CrashReporter::Annotation::ProxyStreamUnmarshalStatus;
 
   if (!aInitBufSize) {
     CrashReporter::AnnotateCrashReport(kCrashReportKey,
                                        NS_LITERAL_CSTRING("!aInitBufSize"));
     // We marshaled a nullptr. Nothing else to do here.
     return;
   }
 
@@ -131,43 +132,40 @@ ProxyStream::ProxyStream(REFIID aIID, co
     EnsureMTA mta(marshalFn);
   }
 
   mStream = nullptr;
 
   if (FAILED(unmarshalResult) || !mUnmarshaledProxy) {
     nsPrintfCString hrAsStr("0x%08X", unmarshalResult);
     CrashReporter::AnnotateCrashReport(
-        NS_LITERAL_CSTRING("CoUnmarshalInterfaceResult"), hrAsStr);
+        CrashReporter::Annotation::CoUnmarshalInterfaceResult, hrAsStr);
     AnnotateInterfaceRegistration(aIID);
     if (!mUnmarshaledProxy) {
       CrashReporter::AnnotateCrashReport(kCrashReportKey,
                                          NS_LITERAL_CSTRING("!mUnmarshaledProxy"));
     }
 
 #if defined(ACCESSIBILITY)
     AnnotateClassRegistration(CLSID_AccessibleHandler);
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("UnmarshalActCtx"),
-                                       strActCtx);
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("UnmarshalActCtxManifestPath"),
-                                       NS_ConvertUTF16toUTF8(manifestPath));
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("A11yHandlerRegistered"),
-                                       a11y::IsHandlerRegistered() ?
-                                       NS_LITERAL_CSTRING("true") :
-                                       NS_LITERAL_CSTRING("false"));
+    CrashReporter::AnnotateCrashReport(
+      CrashReporter::Annotation::UnmarshalActCtx, strActCtx);
+    CrashReporter::AnnotateCrashReport(
+      CrashReporter::Annotation::UnmarshalActCtxManifestPath,
+      NS_ConvertUTF16toUTF8(manifestPath));
+    CrashReporter::AnnotateCrashReport(
+      CrashReporter::Annotation::A11yHandlerRegistered,
+      a11y::IsHandlerRegistered() ? NS_LITERAL_CSTRING("true")
+                                  : NS_LITERAL_CSTRING("false"));
 
-    nsAutoCString strExpectedStreamLen;
-    strExpectedStreamLen.AppendInt(expectedStreamLen);
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ExpectedStreamLen"),
-                                       strExpectedStreamLen);
+    CrashReporter::AnnotateCrashReport(
+      CrashReporter::Annotation::ExpectedStreamLen, expectedStreamLen);
 
-    nsAutoCString actualStreamLen;
-    actualStreamLen.AppendInt(aInitBufSize);
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ActualStreamLen"),
-                                       actualStreamLen);
+    CrashReporter::AnnotateCrashReport(
+      CrashReporter::Annotation::ActualStreamLen, aInitBufSize);
 #endif // defined(ACCESSIBILITY)
   }
 }
 
 ProxyStream::ProxyStream(ProxyStream&& aOther)
   : mGlobalLockedBuf(nullptr)
   , mHGlobal(nullptr)
   , mBufSize(0)
@@ -355,69 +353,66 @@ ProxyStream::ProxyStream(REFIID aIID, IU
   } else {
     // When marshaling in child processes, we want to force the MTA.
     EnsureMTA mta(marshalFn);
   }
 
   if (FAILED(createStreamResult)) {
     nsPrintfCString hrAsStr("0x%08X", createStreamResult);
     CrashReporter::AnnotateCrashReport(
-        NS_LITERAL_CSTRING("CreateStreamOnHGlobalFailure"),
-        hrAsStr);
+      CrashReporter::Annotation::CreateStreamOnHGlobalFailure, hrAsStr);
   }
 
   if (FAILED(marshalResult)) {
     AnnotateInterfaceRegistration(aIID);
     nsPrintfCString hrAsStr("0x%08X", marshalResult);
     CrashReporter::AnnotateCrashReport(
-        NS_LITERAL_CSTRING("CoMarshalInterfaceFailure"), hrAsStr);
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("MarshalActCtxManifestPath"),
-                                       NS_ConvertUTF16toUTF8(manifestPath));
+      CrashReporter::Annotation::CoMarshalInterfaceFailure, hrAsStr);
+    CrashReporter::AnnotateCrashReport(
+      CrashReporter::Annotation::MarshalActCtxManifestPath,
+      NS_ConvertUTF16toUTF8(manifestPath));
   }
 
   if (FAILED(statResult)) {
     nsPrintfCString hrAsStr("0x%08X", statResult);
-    CrashReporter::AnnotateCrashReport(
-        NS_LITERAL_CSTRING("StatFailure"),
-        hrAsStr);
+    CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::StatFailure,
+                                       hrAsStr);
   }
 
   if (FAILED(getHGlobalResult)) {
     nsPrintfCString hrAsStr("0x%08X", getHGlobalResult);
     CrashReporter::AnnotateCrashReport(
-        NS_LITERAL_CSTRING("GetHGlobalFromStreamFailure"),
-        hrAsStr);
+      CrashReporter::Annotation::GetHGlobalFromStreamFailure, hrAsStr);
   }
 
   mStream = mozilla::Move(stream);
 
   if (streamSize) {
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProxyStreamSizeFrom"),
-                                       NS_LITERAL_CSTRING("IStream::Stat"));
+    CrashReporter::AnnotateCrashReport(
+      CrashReporter::Annotation::ProxyStreamSizeFrom,
+      NS_LITERAL_CSTRING("IStream::Stat"));
     mBufSize = streamSize;
   }
 
   if (!hglobal) {
     return;
   }
 
   mGlobalLockedBuf = reinterpret_cast<BYTE*>(::GlobalLock(hglobal));
   mHGlobal = hglobal;
 
   // If we couldn't get the stream size directly from mStream, we may use
   // the size of the memory block allocated by the HGLOBAL, though it might
   // be larger than the actual stream size.
   if (!streamSize) {
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProxyStreamSizeFrom"),
-                                       NS_LITERAL_CSTRING("GlobalSize"));
+    CrashReporter::AnnotateCrashReport(
+      CrashReporter::Annotation::ProxyStreamSizeFrom,
+      NS_LITERAL_CSTRING("GlobalSize"));
     mBufSize = static_cast<int>(::GlobalSize(hglobal));
   }
 
-  nsAutoCString strBufSize;
-  strBufSize.AppendInt(mBufSize);
-
-  CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProxyStreamSize"),
-                                     strBufSize);
+  CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::ProxyStreamSize,
+                                     mBufSize);
 }
 
 } // namespace mscom
 } // namespace mozilla
 
--- a/ipc/mscom/RegistrationAnnotator.cpp
+++ b/ipc/mscom/RegistrationAnnotator.cpp
@@ -371,26 +371,25 @@ AnnotateInterfaceRegistration(REFIID aIi
   json.EndObject();
 
   json.StartObjectProperty("HKCU", style);
   AnnotateInterfaceRegistrationForHive(json, HKEY_CURRENT_USER, aIid, style);
   json.EndObject();
 
   json.End();
 
-  nsAutoCString annotationKey;
-  annotationKey.AppendLiteral("InterfaceRegistrationInfo");
+  CrashReporter::Annotation annotationKey;
   if (XRE_IsParentProcess()) {
-    annotationKey.AppendLiteral("Parent");
+    annotationKey = CrashReporter::Annotation::InterfaceRegistrationInfoParent;
   } else {
-    annotationKey.AppendLiteral("Child");
+    annotationKey = CrashReporter::Annotation::InterfaceRegistrationInfoChild;
   }
-
-  CrashReporter::AnnotateCrashReport(annotationKey,
-                                     static_cast<CStringWriter*>(json.WriteFunc())->Get());
+  CrashReporter::AnnotateCrashReport(
+    annotationKey,
+    static_cast<CStringWriter*>(json.WriteFunc())->Get());
 }
 
 void
 AnnotateClassRegistration(REFCLSID aClsid)
 {
 #if defined(DEBUG)
   const JSONWriter::CollectionStyle style = JSONWriter::MultiLineStyle;
 #else
@@ -409,22 +408,21 @@ AnnotateClassRegistration(REFCLSID aClsi
   json.EndObject();
 
   json.StartObjectProperty("HKCU", style);
   AnnotateClsidRegistrationForHive(json, HKEY_CURRENT_USER, strClsid, style);
   json.EndObject();
 
   json.End();
 
-  nsAutoCString annotationKey;
-  annotationKey.AppendLiteral("ClassRegistrationInfo");
+  CrashReporter::Annotation annotationKey;
   if (XRE_IsParentProcess()) {
-    annotationKey.AppendLiteral("Parent");
+    annotationKey = CrashReporter::Annotation::ClassRegistrationInfoParent;
   } else {
-    annotationKey.AppendLiteral("Child");
+    annotationKey = CrashReporter::Annotation::ClassRegistrationInfoChild;
   }
 
   CrashReporter::AnnotateCrashReport(annotationKey,
                                      static_cast<CStringWriter*>(json.WriteFunc())->Get());
 }
 
 } // namespace mscom
 } // namespace mozilla
--- a/toolkit/crashreporter/CrashAnnotations.yaml
+++ b/toolkit/crashreporter/CrashAnnotations.yaml
@@ -8,32 +8,50 @@
 # Additionally a field can have the following optional fields:
 # - altname: A string that will be used when writing out the annotation to the
 #   .extra file instead of the annotation name
 # - ping: A boolean that indicates whether the annotation is whitelisted for
 #   going into the crash ping, if not specified this defaults to false
 # - content: A boolean that indicates whether the field will be included in
 #   subprocess reports, if not specified this defaults to true
 
+A11yHandlerRegistered:
+  description: >
+    Set to "true" if the accessibility handler is registered, "false" otherwise.
+  type: string
+
 Accessibility:
   description: >
     Set to "Active" by the accessibility service when it is active.
   type: string
 
 AccessibilityClient:
   description: >
     Accessibility client ID.
   type: string
 
 AccessibilityInProcClient:
   description: >
     Hexadecimal mask of in-process accessibility consumers, see
     accessible/windows/msaa/Compatibility.h for the mappings.
   type: string
 
+ActualStreamLen:
+  description: >
+    Actual length of an IPC proxy stream.
+  type: integer
+
+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
+
 AsyncShutdownModule:
   description: >
     Holds the contents of the AsyncShutdown.js script
   type: string
 
 AvailablePageFile:
   description: >
     Windows-only, maximum amount of memory that can be committed.  This
@@ -75,58 +93,229 @@ BreakpadReserveAddress:
     Address of the buffer reserved by Breakpad.
   type: string
 
 BreakpadReserveSize:
   description: >
     Size of the buffer reserved by Breakpad.
   type: string
 
+ClassRegistrationInfoChild:
+  description: >
+    Microsoft COM class registration annotation for the child process.
+  type: string
+
+ClassRegistrationInfoParent:
+  description: >
+    Microsoft COM class registration annotation for the parent process.
+  type: string
+
+CoMarshalInterfaceFailure:
+  description: >
+    Annotation describing the error returned by trying to marshal an object
+    via CoMarshalInterface during the creation of an IPC proxy stream.
+  type: string
+
 ContainsMemoryReport:
   description: >
     Indicates that the crash dump contains a memory report.
   type: boolean
   ping: true
 
+ContentSandboxCapabilities:
+  description: >
+    List of capabilities of the content process sandbox.
+  type: strings
+
+ContentSandboxEnabled:
+  description: >
+    Set to 1 when content process sandboxing is enabled.
+  type: boolean
+
+ContentSandboxCapable:
+  description: >
+    Set to 1 if the client is capable of content sandboxing.
+  type: boolean
+
+ContentSandboxLevel:
+  description: >
+    Content sandbox level.
+  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
+
+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
+
 CrashTime:
   description: >
     Crash time in seconds since the Epoch.
   type: string
   ping: true
 
+CreateStreamOnHGlobalFailure:
+  description: >
+    Set when failing to obtain a global memory handle during the creation of an
+    IPC proxy stream.
+  type: string
+
 DOMIPCEnabled:
   description: >
     Set to 1 when a tab is running in a content process
   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:
+  description: >
+    Expected length of an IPC proxy stream.
+  type: integer
+
+FlashProcessDump:
+  description: >
+    Type of process the flash plugin is running in, can be either "Broker" or
+    "Sandbox".
+  type: string
+
+GetHGlobalFromStreamFailure:
+  description: >
+    Error returned when invoking GetHGlobalFromStreamFailure() during the
+    creation of an IPC stream proxy.
+  type: string
+
+HangMonitorDescription:
+  description: >
+    Name of the hang monitor that generated the crash.
+  type: string
+
 IAccessibleConfig:
   description: >
     Set when something is seriously wrong with the IAccessible configuration in
     the computer's registry. The value is always set to "NoSystemTypeLibOrPS"
   type: string
 
 InstallTime:
   description: >
     The time when Firefox was installed expressed as seconds since the Epoch
   type: integer
 
+InterfaceRegistrationInfoChild:
+  description: >
+    Microsoft COM interface registration annotation for the child process.
+  type: string
+
+InterfaceRegistrationInfoParent:
+  description: >
+    Microsoft COM interface registration annotation for the parent process.
+  type: string
+
+ipc_channel_error:
+  description: >
+    Set before a content process crashes because of an IPC channel error, holds
+    a description of the error.
+  type: string
+  ping: true
+
+IpcCreateEndpointsNsresult:
+  description: >
+    errno value retrieved after failing to create an IPC transport object.
+  type: integer
+
+IpcCreatePipeCloExecErrno:
+  description: >
+    errno value retrieved after failing to set the O_CLOEXEC flag on a pipe
+    used for IPC.
+  type: integer
+
+IpcCreatePipeFcntlErrno:
+  description: >
+    errno value retrieved after a call to fcntl() on a pipe used for IPC failed.
+  type: integer
+
+IpcCreatePipeSocketPairErrno:
+  description: >
+    errno value retrieved after a socketpair() call failed while creating an IPC
+    transport object.
+  type: integer
+
+IpcCreateTransportDupErrno:
+  description: >
+    errno value retrieved after a dup() call failed while creating an IPC
+    transport object.
+  type: integer
+
+IPCFatalErrorMsg:
+  description: >
+    Describes a fatal error that occurred during IPC operation.
+  type: string
+
+IPCFatalErrorProtocol:
+  description: >
+    Name of the protocol used by IPC when a fatal error occurred.
+  type: string
+
+IPCMessageName:
+  description: >
+    Name of the IPC message that caused a crash because it was too large.
+  type: string
+
+IPCMessageSize:
+  description: >
+    Size of the IPC message that caused a crash because it was too large.
+  type: integer
+
+IPCReadErrorReason:
+  description: >
+    Reason why reading an object via IPC failed.
+  type: string
+
+IPCShutdownState:
+  description: >
+    IPC shutdown state, can be set to either "RecvShutdown" or
+    "SendFinishShutdown" by a content process while it's shutting down.
+  type: string
+
+IPCSystemError:
+  description: >
+    Description of the last system error that occurred during IPC operation.
+  type: string
+
+IPCTransportFailureReason:
+  description: >
+    Reason why creating an IPC channel failed.
+  type: string
+
 IsGarbageCollecting:
   description: >
     If true then the JavaScript garbage collector was running when the crash
     occurred.
   type: boolean
   ping: true
 
+MarshalActCtxManifestPath:
+  description: >
+    Proxy stream marshalling current activation context manifest path.
+  type: string
+
 MozCrashReason:
   description: >
     Plaintext description of why Firefox crashed, this is usually set by
     assertions and the like.
   type: string
   ping: true
 
 Notes:
@@ -134,34 +323,94 @@ Notes:
     Miscellaneous notes that can be appended to a crash.
   type: string
 
 nsAsyncShutdownComponent:
   description: >
     Holds the contents of the nsAsyncShutdown.js script
   type: string
 
+NumberOfProcessors:
+  description: >
+    Number of logical processors in the system.
+  type: integer
+
 OOMAllocationSize:
   description: >
     Size of the allocation that caused an out-of-memory condition.
   type: string
   ping: true
 
+PluginCpuUsage:
+  description: >
+    CPU usage of the plugin process.
+  type: string
+
+PluginFilename:
+  description: >
+    Plugin filename, only the process holding the plugin has this annotation.
+  type: string
+
 PluginHang:
   description: >
     The presence of this annotation indicates that this crash was generated in
     response to a plugin hanging.
   type: boolean
 
+PluginHangUIDuration:
+  description: >
+    Duration in milliseconds of the plugin hang that caused this crash.
+  type: integer
+
+PluginName:
+  description: >
+    Display name of a plugin, only the process holding the plugin has this
+    annotation.
+  type: string
+
+PluginVersion:
+  description: >
+    Version of a plugin, only the process holding the plugin has this
+    annotation.
+  type: string
+
 ProcessType:
   description: >
     Type of the process that crashed, can hold the values "content", "plugin" or
     "gpu" currently.
   type: string
 
+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
+    either Stream::Stat or GlobalSize.
+  type: string
+
+ProxyStreamUnmarshalStatus:
+  description: >
+    Status of the proxy stream unmarshalling, see ipc/mscom/ProxyStream.cpp for
+    the various value this annotation can take.
+  type: string
+
+ProxyStreamValid:
+  description: >
+    Set to "false" when encountering an invalid IPC proxy stream.
+  type: string
+
+RemoteType:
+  description: >
+    Type of the content process, can be set to "web", "file" or "extension".
+  type: string
+  ping: true
+
 SecondsSinceLastCrash:
   description: >
     Time in seconds since the last crash occurred.
   type: string
   ping: true
 
 ServerURL:
   description: >
@@ -169,16 +418,22 @@ ServerURL:
   type: string
 
 StartupTime:
   description: >
     The time when Firefox was launched expressed in seconds since the Epoch.
   type: integer
   content: false
 
+StatFailure:
+  description: >
+    Error returned when invoking IStream's Stat function during the creation
+    of an IPC proxy stream.
+  type: string
+
 SystemMemoryUsePercentage:
   description: >
     Windows-only, percentage of physical memory in use. This annotation is
     populated with the contents of the MEMORYSTATUSEX's structure dwMemoryLoad
     field.
   type: integer
   ping: true
 
@@ -227,20 +482,36 @@ TotalPhysicalMemory:
 TotalVirtualMemory:
   description: >
     Windows-only, size of the virtual address space. This annotation is
     populated with the contents of the MEMORYSTATUSEX's structure
     ullTotalVirtual field.
   type: string
   ping: true
 
+UnmarshalActCtx:
+  description: >
+    Proxy stream unmarshalling current activation context.
+  type: string
+
+UnmarshalActCtxManifestPath:
+  description: >
+    Proxy stream unmarshalling current activation context manifest path.
+  type: string
+
 UptimeTS:
   description: >
     Uptime in seconds. This annotation uses a string instead of an integer
     because it has a fractional component.
   type: string
   ping: true
 
+URL:
+  description: >
+    URL being loaded.
+  type: string
+  content: false
+
 User32BeforeBlocklist:
   description: >
     Set to 1 if user32.dll was loaded before we could install the DLL blocklist.
   type: boolean
   ping: true
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -4474,34 +4474,33 @@ void AddSandboxAnnotations()
 {
   // Include the sandbox content level, regardless of platform
   int level = GetEffectiveContentSandboxLevel();
 
   nsAutoCString levelString;
   levelString.AppendInt(level);
 
   CrashReporter::AnnotateCrashReport(
-    NS_LITERAL_CSTRING("ContentSandboxLevel"), levelString);
+    CrashReporter::Annotation::ContentSandboxLevel, levelString);
 
   // Include whether or not this instance is capable of content sandboxing
   bool sandboxCapable = false;
 
 #if defined(XP_WIN)
   // All supported Windows versions support some level of content sandboxing
   sandboxCapable = true;
 #elif defined(XP_MACOSX)
   // All supported OS X versions are capable
   sandboxCapable = true;
 #elif defined(XP_LINUX)
   sandboxCapable = SandboxInfo::Get().CanSandboxContent();
 #endif
 
   CrashReporter::AnnotateCrashReport(
-    NS_LITERAL_CSTRING("ContentSandboxCapable"),
-    sandboxCapable ? NS_LITERAL_CSTRING("1") : NS_LITERAL_CSTRING("0"));
+    CrashReporter::Annotation::ContentSandboxCapable, sandboxCapable);
 }
 #endif /* MOZ_CONTENT_SANDBOX */
 
 /*
  * XRE_mainRun - Command line startup, profile migration, and
  * the calling of appStartup->Run().
  */
 nsresult
@@ -4858,17 +4857,17 @@ XREMain::XRE_mainRun()
   Telemetry::Accumulate(Telemetry::SANDBOX_CONTENT_ENABLED,
                         sandboxInfo.Test(SandboxInfo::kEnabledForContent));
   Telemetry::Accumulate(Telemetry::SANDBOX_MEDIA_ENABLED,
                         sandboxInfo.Test(SandboxInfo::kEnabledForMedia));
   nsAutoCString flagsString;
   flagsString.AppendInt(sandboxInfo.AsInteger());
 
   CrashReporter::AnnotateCrashReport(
-    NS_LITERAL_CSTRING("ContentSandboxCapabilities"), flagsString);
+    CrashReporter::Annotation::ContentSandboxCapabilities, flagsString);
 #endif /* MOZ_SANDBOX && XP_LINUX */
 
 #if defined(MOZ_CONTENT_SANDBOX)
   AddSandboxAnnotations();
 #endif /* MOZ_CONTENT_SANDBOX */
 
   {
     rv = appStartup->Run();
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -312,20 +312,18 @@ SetTaskbarGroupId(const nsString& aId)
 #endif
 
 #if defined(MOZ_CONTENT_SANDBOX)
 void
 AddContentSandboxLevelAnnotation()
 {
   if (XRE_GetProcessType() == GeckoProcessType_Content) {
     int level = GetEffectiveContentSandboxLevel();
-    nsAutoCString levelString;
-    levelString.AppendInt(level);
     CrashReporter::AnnotateCrashReport(
-      NS_LITERAL_CSTRING("ContentSandboxLevel"), levelString);
+      CrashReporter::Annotation::ContentSandboxLevel, level);
   }
 }
 #endif /* MOZ_CONTENT_SANDBOX */
 
 namespace {
 
 int GetDebugChildPauseTime() {
   auto pauseStr = PR_GetEnv("MOZ_DEBUG_CHILD_PAUSE");