Bug 1530531: Add a command line option to the launcher process that forces it to log errors to the Windows event log; r=mhowell

Differential Revision: https://phabricator.services.mozilla.com/D21099

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Aaron Klotz 2019-02-25 23:11:20 +00:00
parent 3b28460f33
commit 2d60c7faf4
3 changed files with 15 additions and 2 deletions

View File

@ -57,6 +57,7 @@ static const wchar_t kUrl[] = TELEMETRY_BASE_URL TELEMETRY_NAMESPACE
static const uint32_t kGuidCharLenWithNul = 39;
static const uint32_t kGuidCharLenNoBracesNoNul = 36;
static const mozilla::StaticXREAppData* gAppData;
static bool gForceEventLog = false;
namespace {
@ -670,7 +671,7 @@ static unsigned __stdcall SendPingThread(void* aContext) {
mozilla::UniquePtr<PingThreadContext> context(
reinterpret_cast<PingThreadContext*>(aContext));
if (!DoSendPing(*context)) {
if (!DoSendPing(*context) || gForceEventLog) {
PostErrorToLog(context->mLauncherError);
}
@ -724,7 +725,7 @@ void HandleLauncherError(const LauncherError& aError) {
Unused << regInfo.DisableDueToFailure();
#endif // defined(MOZ_LAUNCHER_PROCESS)
if (SendPing(aError)) {
if (SendPing(aError) && !gForceEventLog) {
return;
}
@ -735,4 +736,8 @@ void SetLauncherErrorAppData(const StaticXREAppData& aAppData) {
gAppData = &aAppData;
}
void SetLauncherErrorForceEventLog() {
gForceEventLog = true;
}
} // namespace mozilla

View File

@ -44,6 +44,8 @@ struct StaticXREAppData;
void SetLauncherErrorAppData(const StaticXREAppData& aAppData);
void SetLauncherErrorForceEventLog();
} // namespace mozilla
#endif // mozilla_ErrorHandler_h

View File

@ -216,6 +216,12 @@ Maybe<int> LauncherMain(int& argc, wchar_t* argv[],
const StaticXREAppData& aAppData) {
SetLauncherErrorAppData(aAppData);
if (CheckArg(argc, argv, L"log-launcher-error",
static_cast<const wchar_t**>(nullptr),
mozilla::CheckArgFlag::RemoveArg) == ARG_FOUND) {
SetLauncherErrorForceEventLog();
}
Maybe<bool> runAsLauncher = RunAsLauncherProcess(argc, argv);
if (!runAsLauncher || !runAsLauncher.value()) {
return Nothing();