Bug 1402519 - Remove MOZ_CRASHREPORTER directives from layout; r?dbaron
MozReview-Commit-ID: 4hCfUa0TgLw
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -20,16 +20,17 @@
#include "nsCSSParser.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSRuleProcessor.h"
#include "nsCSSRules.h"
#include "nsContentUtils.h"
#include "nsDOMTokenList.h"
#include "nsDeviceContext.h"
#include "nsIContentInlines.h"
+#include "nsICrashReporter.h"
#include "nsIDOMNode.h"
#include "nsIDocumentInlines.h"
#include "nsILoadContext.h"
#include "nsIFrame.h"
#include "nsIMemoryReporter.h"
#include "nsINode.h"
#include "nsIPresShell.h"
#include "nsIPresShellInlines.h"
@@ -70,20 +71,16 @@
#include "mozilla/dom/HTMLBodyElement.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/URLExtraData.h"
#if defined(MOZ_MEMORY)
# include "mozmemory.h"
#endif
-#ifdef MOZ_CRASHREPORTER
-#include "nsICrashReporter.h"
-#endif
-
using namespace mozilla;
using namespace mozilla::css;
using namespace mozilla::dom;
#define SERVO_ARC_TYPE(name_, type_) \
already_AddRefed<type_> \
type_##Strong::Consume() { \
RefPtr<type_> result; \
@@ -2830,34 +2827,30 @@ Gecko_ReportUnexpectedCSSError(ErrorRepo
nsDependentCSubstring sourceValue(source, sourceLen);
reporter->OutputError(lineNumber, colNumber, sourceValue);
}
void
Gecko_AddBufferToCrashReport(const void* addr, size_t len)
{
MOZ_ASSERT(NS_IsMainThread());
-#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsICrashReporter> cr = do_GetService("@mozilla.org/toolkit/crash-reporter;1");
NS_ENSURE_TRUE_VOID(cr);
cr->RegisterAppMemory((uint64_t) addr, len);
-#endif
}
void
Gecko_AnnotateCrashReport(const char* key_str, const char* value_str)
{
MOZ_ASSERT(NS_IsMainThread());
nsDependentCString key(key_str);
nsDependentCString value(value_str);
-#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsICrashReporter> cr = do_GetService("@mozilla.org/toolkit/crash-reporter;1");
NS_ENSURE_TRUE_VOID(cr);
cr->AnnotateCrashReport(key, value);
-#endif
}
void
Gecko_ContentList_AppendAll(
nsSimpleContentList* aList,
const Element** aElements,
size_t aLength)
{
--- a/layout/style/nsLayoutStylesheetCache.cpp
+++ b/layout/style/nsLayoutStylesheetCache.cpp
@@ -4,45 +4,42 @@
* 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 "nsLayoutStylesheetCache.h"
#include "nsAppDirectoryServiceDefs.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/MemoryReporting.h"
+#include "mozilla/Omnijar.h"
#include "mozilla/Preferences.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/css/Loader.h"
#include "mozilla/dom/SRIMetadata.h"
#include "MainThreadUtils.h"
#include "nsColor.h"
+#include "nsDirectoryServiceDefs.h"
+#include "nsDirectoryService.h"
+#include "nsExceptionHandler.h"
+#include "nsIChromeRegistry.h"
#include "nsIConsoleService.h"
#include "nsIFile.h"
+#include "nsIObserverService.h"
+#include "nsISimpleEnumerator.h"
+#include "nsISubstitutingProtocolHandler.h"
+#include "nsIXULRuntime.h"
#include "nsNetUtil.h"
-#include "nsIObserverService.h"
-#include "nsServiceManagerUtils.h"
-#include "nsIXULRuntime.h"
#include "nsPresContext.h"
#include "nsPrintfCString.h"
+#include "nsServiceManagerUtils.h"
#include "nsXULAppAPI.h"
+#include "nsZipArchive.h"
-// Includes for the crash report annotation in ErrorLoadingSheet.
-#ifdef MOZ_CRASHREPORTER
-#include "mozilla/Omnijar.h"
-#include "nsDirectoryService.h"
-#include "nsDirectoryServiceDefs.h"
-#include "nsExceptionHandler.h"
-#include "nsIChromeRegistry.h"
-#include "nsISimpleEnumerator.h"
-#include "nsISubstitutingProtocolHandler.h"
#include "zlib.h"
-#include "nsZipArchive.h"
-#endif
using namespace mozilla;
using namespace mozilla::css;
static bool sNumberControlEnabled;
#define NUMBER_CONTROL_PREF "dom.forms.number"
@@ -472,17 +469,16 @@ nsLayoutStylesheetCache::LoadSheetFile(n
if (!exists) return;
nsCOMPtr<nsIURI> uri;
NS_NewFileURI(getter_AddRefs(uri), aFile);
LoadSheet(uri, aSheet, aParsingMode, aFailureAction);
}
-#ifdef MOZ_CRASHREPORTER
static inline nsresult
ComputeCRC32(nsIFile* aFile, uint32_t* aResult)
{
PRFileDesc* fd;
nsresult rv = aFile->OpenNSPRFileDesc(PR_RDONLY, 0, &fd);
NS_ENSURE_SUCCESS(rv, rv);
uint32_t crc = crc32(0, nullptr, 0);
@@ -749,35 +745,32 @@ AnnotateCrashReport(nsIURI* aURI)
}
} else {
annotation.AppendLiteral("No GRE omnijar\n");
}
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("SheetLoadFailure"),
NS_ConvertUTF16toUTF8(annotation));
}
-#endif
static void
ErrorLoadingSheet(nsIURI* aURI, const char* aMsg, FailureAction aFailureAction)
{
nsPrintfCString errorMessage("%s loading built-in stylesheet '%s'",
aMsg,
aURI ? aURI->GetSpecOrDefault().get() : "");
if (aFailureAction == eLogToConsole) {
nsCOMPtr<nsIConsoleService> cs = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (cs) {
cs->LogStringMessage(NS_ConvertUTF8toUTF16(errorMessage).get());
return;
}
}
-#ifdef MOZ_CRASHREPORTER
AnnotateCrashReport(aURI);
-#endif
NS_RUNTIMEABORT(errorMessage.get());
}
void
nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI,
RefPtr<StyleSheet>* aSheet,
SheetParsingMode aParsingMode,
FailureAction aFailureAction)
@@ -794,19 +787,17 @@ nsLayoutStylesheetCache::LoadSheet(nsIUR
if (!loader) {
loader = new Loader(mBackendType, nullptr);
if (!loader) {
ErrorLoadingSheet(aURI, "no Loader", eCrash);
return;
}
}
-#ifdef MOZ_CRASHREPORTER
nsZipArchive::sFileCorruptedReason = nullptr;
-#endif
nsresult rv = loader->LoadSheetSync(aURI, aParsingMode, true, aSheet);
if (NS_FAILED(rv)) {
ErrorLoadingSheet(aURI,
nsPrintfCString("LoadSheetSync failed with error %" PRIx32, static_cast<uint32_t>(rv)).get(),
aFailureAction);
}
}