Bug 1402519 - Remove MOZ_CRASHREPORTER directives from js; r=nbp
authorGabriele Svelto <gsvelto@mozilla.com>
Tue, 10 Oct 2017 12:10:33 +0200
changeset 393530 bba47232913a15b019bd9def26c8a4aeb73e46e6
parent 393529 5690f4b488028760c1dbc44296decba18291455a
child 393531 42ddee4785ed0308b4f4d13c149bf40535fe25ca
push id32962
push useraiakab@mozilla.com
push dateFri, 24 Nov 2017 10:01:11 +0000
treeherdermozilla-central@f2e36fbb90fa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1402519
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1402519 - Remove MOZ_CRASHREPORTER directives from js; r=nbp MozReview-Commit-ID: DPa3IW4nwlM
js/xpconnect/src/XPCJSRuntime.cpp
js/xpconnect/src/XPCShellImpl.cpp
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -13,16 +13,17 @@
 #include "xpcpublic.h"
 #include "XPCWrapper.h"
 #include "XPCJSMemoryReporter.h"
 #include "WrapperFactory.h"
 #include "mozJSComponentLoader.h"
 #include "nsAutoPtr.h"
 #include "nsNetUtil.h"
 
+#include "nsExceptionHandler.h"
 #include "nsIMemoryInfoDumper.h"
 #include "nsIMemoryReporter.h"
 #include "nsIObserverService.h"
 #include "nsIDebug2.h"
 #include "nsIDocShell.h"
 #include "nsIRunnable.h"
 #include "amIAddonManager.h"
 #include "nsPIDOMWindow.h"
@@ -55,20 +56,16 @@
 #include "nsGlobalWindow.h"
 #include "nsAboutProtocolUtils.h"
 
 #include "GeckoProfiler.h"
 #include "nsIInputStream.h"
 #include "nsIXULRuntime.h"
 #include "nsJSPrincipals.h"
 
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
 #ifdef XP_WIN
 #include <windows.h>
 #endif
 
 using namespace mozilla;
 using namespace xpc;
 using namespace JS;
 using mozilla::dom::PerThreadAtomCache;
@@ -747,19 +744,17 @@ xpc_UnmarkSkippableJSHolders()
 XPCJSRuntime::GCSliceCallback(JSContext* cx,
                               JS::GCProgress progress,
                               const JS::GCDescription& desc)
 {
     XPCJSRuntime* self = nsXPConnect::GetRuntimeInstance();
     if (!self)
         return;
 
-#ifdef MOZ_CRASHREPORTER
     CrashReporter::SetGarbageCollecting(progress == JS::GC_CYCLE_BEGIN);
-#endif
 
     if (self->mPrevGCSliceCallback)
         (*self->mPrevGCSliceCallback)(cx, progress, desc);
 }
 
 /* static */ void
 XPCJSRuntime::DoCycleCollectionCallback(JSContext* cx)
 {
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -8,16 +8,17 @@
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "jsprf.h"
 #include "mozilla/ChaosMode.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/Preferences.h"
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
+#include "nsExceptionHandler.h"
 #include "nsIServiceManager.h"
 #include "nsIFile.h"
 #include "nsString.h"
 #include "nsIDirectoryService.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nscore.h"
 #include "nsArrayEnumerator.h"
@@ -56,21 +57,16 @@
 #include <errno.h>
 #ifdef HAVE_IO_H
 #include <io.h>     /* for isatty() */
 #endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>     /* for isatty() */
 #endif
 
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#include "nsICrashReporter.h"
-#endif
-
 #ifdef ENABLE_TESTS
 #include "xpctest_private.h"
 #endif
 
 using namespace mozilla;
 using namespace JS;
 using mozilla::dom::AutoJSAPI;
 using mozilla::dom::AutoEntryScript;
@@ -1188,27 +1184,25 @@ XRE_XPCShellMain(int argc, char** argv, 
                 return 1;
             }
             XRE_AddManifestLocation(NS_APP_LOCATION, lf);
 
             argc -= 2;
             argv += 2;
         }
 
-#ifdef MOZ_CRASHREPORTER
         const char* val = getenv("MOZ_CRASHREPORTER");
         if (val && *val && !CrashReporter::IsDummy()) {
             rv = CrashReporter::SetExceptionHandler(greDir, true);
             if (NS_FAILED(rv)) {
                 printf("CrashReporter::SetExceptionHandler failed!\n");
                 return 1;
             }
             MOZ_ASSERT(CrashReporter::GetEnabled());
         }
-#endif
 
         if (argc > 1 && !strcmp(argv[1], "--greomni")) {
             nsCOMPtr<nsIFile> greOmni;
             nsCOMPtr<nsIFile> appOmni;
             XRE_GetFileFromPath(argv[2], getter_AddRefs(greOmni));
             if (argc > 3 && !strcmp(argv[3], "--appomni")) {
                 XRE_GetFileFromPath(argv[4], getter_AddRefs(appOmni));
                 argc-=2;
@@ -1390,21 +1384,20 @@ XRE_XPCShellMain(int argc, char** argv, 
 
     if (!XRE_ShutdownTestShell())
         NS_ERROR("problem shutting down testshell");
 
     // no nsCOMPtrs are allowed to be alive when you call NS_ShutdownXPCOM
     rv = NS_ShutdownXPCOM( nullptr );
     MOZ_ASSERT(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
 
-#ifdef MOZ_CRASHREPORTER
     // Shut down the crashreporter service to prevent leaking some strings it holds.
-    if (CrashReporter::GetEnabled())
+    if (CrashReporter::GetEnabled()) {
         CrashReporter::UnsetExceptionHandler();
-#endif
+    }
 
 #ifdef MOZ_GECKO_PROFILER
     // This must precede NS_LogTerm(), otherwise xpcshell return non-zero
     // during some tests, which causes failures.
     profiler_shutdown();
 #endif
 
     NS_LogTerm();