Bug 1348273 - Convert the docshell and XPConnect-related annotations; r?bz
MozReview-Commit-ID: 7ACJI5xWOsa
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -1804,18 +1804,18 @@ nsDocShell::GetUseRemoteTabs(bool* aUseR
*aUseRemoteTabs = mUseRemoteTabs;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::SetRemoteTabs(bool aUseRemoteTabs)
{
if (aUseRemoteTabs) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("DOMIPCEnabled"),
- NS_LITERAL_CSTRING("1"));
+ CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::DOMIPCEnabled,
+ true);
}
mUseRemoteTabs = aUseRemoteTabs;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::SetAffectPrivateSessionLifetime(bool aAffectLifetime)
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -15,16 +15,17 @@
#ifdef XP_WIN
#include <windows.h>
#endif
#include "jsapi.h"
#include "js/Printf.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
+#include "nsExceptionHandler.h"
#include "nsIComponentManager.h"
#include "mozilla/Module.h"
#include "nsIFile.h"
#include "mozJSComponentLoader.h"
#include "mozJSLoaderUtils.h"
#include "nsIXPConnect.h"
#include "nsIObserverService.h"
#include "nsIScriptSecurityManager.h"
@@ -51,20 +52,16 @@
#include "mozilla/ResultExtensions.h"
#include "mozilla/ScriptPreloader.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/UniquePtrExtensions.h"
#include "mozilla/Unused.h"
-#ifdef MOZ_CRASHREPORTER
-#include "mozilla/ipc/CrashReporterClient.h"
-#endif
-
using namespace mozilla;
using namespace mozilla::scache;
using namespace mozilla::loader;
using namespace xpc;
using namespace JS;
static const char kObserverServiceContractID[] = "@mozilla.org/observer-service;1";
@@ -358,51 +355,47 @@ ResolveModuleObjectProperty(JSContext* a
}
if (found) {
return lexical;
}
}
return aModObj;
}
-#ifdef MOZ_CRASHREPORTER
static mozilla::Result<nsCString, nsresult> ReadScript(ComponentLoaderInfo& aInfo);
static nsresult
-AnnotateScriptContents(const nsACString& aName, const nsACString& aURI)
+AnnotateScriptContents(CrashReporter::Annotation aName, const nsACString& aURI)
{
ComponentLoaderInfo info(aURI);
nsCString str;
MOZ_TRY_VAR(str, ReadScript(info));
// The crash reporter won't accept any strings with embedded nuls. We
// shouldn't have any here, but if we do because of data corruption, we
// still want the annotation. So replace any embedded nuls before
// annotating.
str.ReplaceSubstring(NS_LITERAL_CSTRING("\0"), NS_LITERAL_CSTRING("\\0"));
CrashReporter::AnnotateCrashReport(aName, str);
return NS_OK;
}
-#endif // defined MOZ_CRASHREPORTER
nsresult
mozJSComponentLoader::AnnotateCrashReport()
{
-#ifdef MOZ_CRASHREPORTER
Unused << AnnotateScriptContents(
- NS_LITERAL_CSTRING("nsAsyncShutdownComponent"),
+ CrashReporter::Annotation::nsAsyncShutdownComponent,
NS_LITERAL_CSTRING("resource://gre/components/nsAsyncShutdown.js"));
Unused << AnnotateScriptContents(
- NS_LITERAL_CSTRING("AsyncShutdownModule"),
+ CrashReporter::Annotation::AsyncShutdownModule,
NS_LITERAL_CSTRING("resource://gre/modules/AsyncShutdown.jsm"));
-#endif // defined MOZ_CRASHREPORTER
return NS_OK;
}
const mozilla::Module*
mozJSComponentLoader::LoadModule(FileLocation& aFile)
{
if (!NS_IsMainThread()) {
--- a/toolkit/crashreporter/CrashAnnotations.yaml
+++ b/toolkit/crashreporter/CrashAnnotations.yaml
@@ -24,16 +24,21 @@ AccessibilityClient:
type: string
AccessibilityInProcClient:
description: >
Hexadecimal mask of in-process accessibility consumers, see
accessible/windows/msaa/Compatibility.h for the mappings.
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
annotation is populated with the contents of the MEMORYSTATUSEX's structure
ullAvailPageFile field.
type: string
ping: true
@@ -82,16 +87,21 @@ ContainsMemoryReport:
ping: true
CrashTime:
description: >
Crash time in seconds since the Epoch.
type: string
ping: true
+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
IAccessibleConfig:
@@ -119,16 +129,21 @@ MozCrashReason:
type: string
ping: true
Notes:
description: >
Miscellaneous notes that can be appended to a crash.
type: string
+nsAsyncShutdownComponent:
+ description: >
+ Holds the contents of the nsAsyncShutdown.js script
+ type: string
+
OOMAllocationSize:
description: >
Size of the allocation that caused an out-of-memory condition.
type: string
ping: true
PluginHang:
description: >