No more #ifdef MOZ_CRASHREPORTER directives needed when using crash reporter functions

Gabriele Svelto gsvelto at
Fri Nov 24 10:55:07 UTC 2017

[cross-posting to firefox-dev]

 Fellow mozillians,
bug 1402519 [1] just landed and it introduces a dummy implementation of
the crash reporter which is built when configuring with
--disable-crash-reporter. This removes the need for bracketing calls to
the crash reporter with #ifdef MOZ_CRASHREPORTER / #endif preprocessor
directives. You can now freely use the crash reporter methods without
worrying about it being enabled at compiler time or not.

I've also removed all the existing directives and only a few remain
where they are actually needed. JavaScript consumers should be
unaffected save for the following pattern which was used in a few places
to detect if the crash reporter had been compiled:

if ("nsICrashReporter" in Ci &&
    Services.appinfo instanceof Ci.nsICrashReporter) {
    // Crash reporter is enabled

This doesn't work anymore as the nsICrashReporter interface is always
present. You can replace it with:

if (AppConstants.MOZ_CRASHREPORTER) {
  // Crash reporter is enabled

This touched a lot of places in the code so if anything crash-related
seems wrong please let me know.


[1] Use a dummy crashreporter implementation when building with

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the firefox-dev mailing list