Bug 1384560 - Annotate crash reports with accessibility client information. r=aklotz

MozReview-Commit-ID: LhxqeR6NFR6
This commit is contained in:
Jim Mathies 2017-08-02 09:28:37 -05:00
Родитель dcfc353eae
Коммит 55d2512f30
3 изменённых файлов: 29 добавлений и 9 удалений

Просмотреть файл

@ -9,6 +9,7 @@
#include "mozilla/WindowsVersion.h"
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#include "nsPrintfCString.h"
#endif // defined(MOZ_CRASHREPORTER)
#include "nsUnicharUtils.h"
#include "nsWindowsDllInterceptor.h"
@ -174,6 +175,12 @@ Compatibility::Init()
if (sConsumers != Compatibility::UNKNOWN)
sConsumers ^= Compatibility::UNKNOWN;
#ifdef MOZ_CRASHREPORTER
CrashReporter::
AnnotateCrashReport(NS_LITERAL_CSTRING("AccessibilityInProcClient"),
nsPrintfCString("0x%X", sConsumers));
#endif
// Gather telemetry
uint32_t temp = sConsumers;
for (int i = 0; temp; i++) {

Просмотреть файл

@ -24,6 +24,10 @@
#include "mozilla/Telemetry.h"
#endif // defined(MOZ_TELEMETRY_REPORTING)
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include <oaidl.h>
#if !defined(STATE_SYSTEM_NORMAL)
@ -258,7 +262,7 @@ LazyInstantiator::ShouldInstantiate(const DWORD aClientTid)
}
*/
#if defined(MOZ_TELEMETRY_REPORTING)
#if defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
if (!mTelemetryThread) {
// Call GatherTelemetry on a background thread because it does I/O on
// the executable file to retrieve version information.
@ -271,11 +275,12 @@ LazyInstantiator::ShouldInstantiate(const DWORD aClientTid)
new AccumulateRunnable(this)));
NS_NewThread(getter_AddRefs(mTelemetryThread), runnable);
}
#endif // defined(MOZ_TELEMETRY_REPORTING)
#endif // defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
return true;
}
#if defined(MOZ_TELEMETRY_REPORTING)
#if defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
/**
* Appends version information in the format "|a.b.c.d".
* If there is no version information, we append nothing.
@ -354,7 +359,15 @@ LazyInstantiator::AccumulateTelemetry(const nsString& aValue)
MOZ_ASSERT(NS_IsMainThread());
if (!aValue.IsEmpty()) {
Telemetry::ScalarSet(Telemetry::ScalarID::A11Y_INSTANTIATORS, aValue);
#if defined(MOZ_TELEMETRY_REPORTING)
Telemetry::ScalarSet(Telemetry::ScalarID::A11Y_INSTANTIATORS,
aValue);
#endif // defined(MOZ_TELEMETRY_REPORTING)
#if defined(MOZ_CRASHREPORTER)
CrashReporter::
AnnotateCrashReport(NS_LITERAL_CSTRING("AccessibilityClient"),
NS_ConvertUTF16toUTF8(aValue));
#endif // defined(MOZ_CRASHREPORTER)
}
if (mTelemetryThread) {
@ -362,7 +375,7 @@ LazyInstantiator::AccumulateTelemetry(const nsString& aValue)
mTelemetryThread = nullptr;
}
}
#endif // defined(MOZ_TELEMETRY_REPORTING)
#endif // defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
RootAccessibleWrap*
LazyInstantiator::ResolveRootAccWrap()

Просмотреть файл

@ -86,7 +86,7 @@ private:
bool ShouldInstantiate(const DWORD aClientTid);
bool GetClientExecutableName(const DWORD aClientTid, nsIFile** aOutClientExe);
#if defined(MOZ_TELEMETRY_REPORTING)
#if defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
class AccumulateRunnable final : public Runnable
{
public:
@ -119,7 +119,7 @@ private:
void AppendVersionInfo(nsIFile* aClientExe, nsAString& aStrToAppend);
void GatherTelemetry(nsIFile* aClientExe, AccumulateRunnable* aRunnable);
void AccumulateTelemetry(const nsString& aValue);
#endif // defined(MOZ_TELEMETRY_REPORTING)
#endif // defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
/**
* @return S_OK if we have a valid mRealRoot to invoke methods on
@ -151,9 +151,9 @@ private:
RootAccessibleWrap* mWeakRootAccWrap;
IAccessible* mWeakAccessible;
IDispatch* mWeakDispatch;
#if defined(MOZ_TELEMETRY_REPORTING)
#if defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
nsCOMPtr<nsIThread> mTelemetryThread;
#endif // defined(MOZ_TELEMETRY_REPORTING)
#endif // defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
};
} // namespace a11y