Bug 1402519 - Remove MOZ_CRASHREPORTER directives from accessible; r=surkov
☠☠ backed out by ffc12802d558 ☠ ☠
authorGabriele Svelto <gsvelto@mozilla.com>
Tue, 10 Oct 2017 12:01:02 +0200
changeset 702182 24e0dcd018987af240baa09fd8d3112fae9913e3
parent 702181 f8fdf450613ff65c9574a172dfee97995349998a
child 702183 8d01c14ac1cae6a43244fae77527bf0ae1d414fd
push id90414
push usermozilla@noorenberghe.ca
push dateWed, 22 Nov 2017 21:44:13 +0000
reviewerssurkov
bugs1402519
milestone59.0a1
Bug 1402519 - Remove MOZ_CRASHREPORTER directives from accessible; r=surkov MozReview-Commit-ID: F4eVp4Pcl8I
accessible/base/nsAccessibilityService.cpp
accessible/windows/msaa/Compatibility.cpp
accessible/windows/msaa/LazyInstantiator.cpp
accessible/windows/msaa/LazyInstantiator.h
--- a/accessible/base/nsAccessibilityService.cpp
+++ b/accessible/base/nsAccessibilityService.cpp
@@ -48,20 +48,17 @@
 #include "HTMLWin32ObjectAccessible.h"
 #include "mozilla/StaticPtr.h"
 #endif
 
 #ifdef A11Y_LOG
 #include "Logging.h"
 #endif
 
-#ifdef MOZ_CRASHREPORTER
 #include "nsExceptionHandler.h"
-#endif
-
 #include "nsImageFrame.h"
 #include "nsINamed.h"
 #include "nsIObserverService.h"
 #include "nsLayoutUtils.h"
 #include "nsPluginFrame.h"
 #include "SVGGeometryFrame.h"
 #include "nsTreeBodyFrame.h"
 #include "nsTreeColumns.h"
@@ -1364,21 +1361,19 @@ nsAccessibilityService::Init()
 #else
     gApplicationAccessible = new ApplicationAccessible();
 #endif // defined(XP_WIN)
   }
 
   NS_ADDREF(gApplicationAccessible); // will release in Shutdown()
   gApplicationAccessible->Init();
 
-#ifdef MOZ_CRASHREPORTER
   CrashReporter::
     AnnotateCrashReport(NS_LITERAL_CSTRING("Accessibility"),
                         NS_LITERAL_CSTRING("Active"));
-#endif
 
 #ifdef XP_WIN
   sPendingPlugins = new nsTArray<nsCOMPtr<nsIContent> >;
   sPluginTimers = new nsTArray<nsCOMPtr<nsITimer> >;
 #endif
 
   // Now its safe to start platform accessibility.
   if (XRE_IsParentProcess())
--- a/accessible/windows/msaa/Compatibility.cpp
+++ b/accessible/windows/msaa/Compatibility.cpp
@@ -2,20 +2,18 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "Compatibility.h"
 
 #include "mozilla/WindowsVersion.h"
-#if defined(MOZ_CRASHREPORTER)
 #include "nsExceptionHandler.h"
 #include "nsPrintfCString.h"
-#endif // defined(MOZ_CRASHREPORTER)
 #include "nsUnicharUtils.h"
 #include "nsWindowsDllInterceptor.h"
 #include "nsWinUtils.h"
 #include "Statistics.h"
 
 #include "mozilla/Preferences.h"
 
 #include <shlobj.h>
@@ -214,21 +212,19 @@ Compatibility::HasKnownNonUiaConsumer()
 }
 
 void
 Compatibility::Init()
 {
   // Note we collect some AT statistics/telemetry here for convenience.
   InitConsumers();
 
-#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++) {
     if (temp & 0x1)
       statistics::A11yConsumers(i);
 
     temp >>= 1;
@@ -406,23 +402,21 @@ UseIAccessibleProxyStub()
     return false;
   }
 
   // Otherwise we try the proxy/stub
   if (IsIAccessiblePSRegistered()) {
     return true;
   }
 
-#if defined(MOZ_CRASHREPORTER)
   // If we reach this point then something is seriously wrong with the
   // IAccessible configuration in the computer's registry. Let's annotate this
   // so that we can easily determine this condition during crash analysis.
   CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IAccessibleConfig"),
                                      NS_LITERAL_CSTRING("NoSystemTypeLibOrPS"));
-#endif // defined(MOZ_CRASHREPORTER)
   return false;
 }
 
 #endif // !defined(HAVE_64BIT_BUILD)
 
 uint16_t
 Compatibility::GetActCtxResourceId()
 {
--- a/accessible/windows/msaa/LazyInstantiator.cpp
+++ b/accessible/windows/msaa/LazyInstantiator.cpp
@@ -12,29 +12,26 @@
 #include "mozilla/a11y/Platform.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/mscom/MainThreadRuntime.h"
 #include "mozilla/mscom/Registration.h"
 #include "mozilla/UniquePtr.h"
 #include "nsAccessibilityService.h"
 #include "nsWindowsHelpers.h"
 #include "nsCOMPtr.h"
+#include "nsExceptionHandler.h"
 #include "nsIFile.h"
 #include "nsXPCOM.h"
 #include "RootAccessibleWrap.h"
 #include "WinUtils.h"
 
 #if defined(MOZ_TELEMETRY_REPORTING)
 #include "mozilla/Telemetry.h"
 #endif // defined(MOZ_TELEMETRY_REPORTING)
 
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
 #include <oaidl.h>
 
 #if !defined(STATE_SYSTEM_NORMAL)
 #define STATE_SYSTEM_NORMAL (0)
 #endif // !defined(STATE_SYSTEM_NORMAL)
 
 /**
  * Because our wrapped accessible is cycle-collected, we can't safely AddRef()
@@ -300,35 +297,35 @@ LazyInstantiator::ShouldInstantiate(cons
 
   // Store full path to executable for support purposes.
   nsAutoString filePath;
   nsresult rv = clientExe->GetPath(filePath);
   if (NS_SUCCEEDED(rv)) {
     a11y::SetInstantiator(filePath);
   }
 
-#if defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
+#if defined(MOZ_TELEMETRY_REPORTING)
   if (!mTelemetryThread) {
     // Call GatherTelemetry on a background thread because it does I/O on
     // the executable file to retrieve version information.
     nsCOMPtr<nsIRunnable> runnable(
         NewRunnableMethod<nsCOMPtr<nsIFile>, RefPtr<AccumulateRunnable>>(
                                              "LazyInstantiator::GatherTelemetry",
                                              this,
                                              &LazyInstantiator::GatherTelemetry,
                                              clientExe,
                                              new AccumulateRunnable(this)));
     NS_NewThread(getter_AddRefs(mTelemetryThread), runnable);
   }
-#endif // defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
+#endif // defined(MOZ_TELEMETRY_REPORTING)
 
   return true;
 }
 
-#if defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
+#if defined(MOZ_TELEMETRY_REPORTING)
 /**
  * Appends version information in the format "|a.b.c.d".
  * If there is no version information, we append nothing.
  */
 void
 LazyInstantiator::AppendVersionInfo(nsIFile* aClientExe,
                                     nsAString& aStrToAppend)
 {
@@ -401,29 +398,27 @@ LazyInstantiator::AccumulateTelemetry(co
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (!aValue.IsEmpty()) {
 #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) {
     mTelemetryThread->Shutdown();
     mTelemetryThread = nullptr;
   }
 }
-#endif // defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
+#endif // defined(MOZ_TELEMETRY_REPORTING)
 
 RootAccessibleWrap*
 LazyInstantiator::ResolveRootAccWrap()
 {
   Accessible* acc = widget::WinUtils::GetRootAccessibleForHWND(mHwnd);
   if (!acc || !acc->IsRoot()) {
     return nullptr;
   }
--- a/accessible/windows/msaa/LazyInstantiator.h
+++ b/accessible/windows/msaa/LazyInstantiator.h
@@ -82,17 +82,17 @@ public:
 private:
   explicit LazyInstantiator(HWND aHwnd);
   ~LazyInstantiator();
 
   bool IsBlockedInjection();
   bool ShouldInstantiate(const DWORD aClientTid);
 
   bool GetClientExecutableName(const DWORD aClientTid, nsIFile** aOutClientExe);
-#if defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
+#if defined(MOZ_TELEMETRY_REPORTING)
   class AccumulateRunnable final : public Runnable
   {
   public:
     explicit AccumulateRunnable(LazyInstantiator* aObj)
       : Runnable("mozilla::a11y::LazyInstantiator::AccumulateRunnable")
       , mObj(aObj)
     {
       MOZ_ASSERT(NS_IsMainThread());
@@ -115,17 +115,17 @@ private:
     nsString                              mData;
   };
 
   friend class AccumulateRunnable;
 
   void AppendVersionInfo(nsIFile* aClientExe, nsAString& aStrToAppend);
   void GatherTelemetry(nsIFile* aClientExe, AccumulateRunnable* aRunnable);
   void AccumulateTelemetry(const nsString& aValue);
-#endif // defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
+#endif // defined(MOZ_TELEMETRY_REPORTING)
 
   /**
    * @return S_OK if we have a valid mRealRoot to invoke methods on
    */
   HRESULT MaybeResolveRoot();
 
   /**
    * @return S_OK if we have a valid mWeakDispatch to invoke methods on
@@ -147,18 +147,18 @@ private:
    * are interfaces that come from objects that we aggregate. Aggregated object
    * interfaces share refcount methods with ours, so if we were to hold strong
    * references to them, we would be holding strong references to ourselves,
    * creating a cycle.
    */
   RootAccessibleWrap* mWeakRootAccWrap;
   IAccessible*        mWeakAccessible;
   IDispatch*          mWeakDispatch;
-#if defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
+#if defined(MOZ_TELEMETRY_REPORTING)
   nsCOMPtr<nsIThread> mTelemetryThread;
-#endif // defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
+#endif // defined(MOZ_TELEMETRY_REPORTING)
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif // mozilla_a11y_LazyInstantiator_h