diff options
131 files changed, 39 insertions, 4139 deletions
diff --git a/Makefile.in b/Makefile.in index f196af545..26cd688d4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -299,13 +299,6 @@ MAKE_SYM_STORE_ARGS += --install-manifest=$(DEPTH)/_build_manifests/install/dist SYM_STORE_SOURCE_DIRS := $(topsrcdir) -ifdef MOZ_CRASHREPORTER -include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk - -SYMBOL_INDEX_NAME = \ - $(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_TARGET)-$(BUILDID)-$(CPU_ARCH)-symbols.txt -endif - .PHONY: generatesymbols generatesymbols: echo building symbol store @@ -337,18 +330,9 @@ symbolsarchive: generatesymbols cd $(DIST)/crashreporter-symbols && \ zip -r5D '../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' . -i '*.sym' -i '*.txt' -ifdef MOZ_CRASHREPORTER -buildsymbols: symbolsfullarchive symbolsarchive -else buildsymbols: -endif uploadsymbols: -ifdef MOZ_CRASHREPORTER -ifdef SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE - $(PYTHON) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' -endif -endif .PHONY: update-packaging update-packaging: diff --git a/accessible/base/nsAccessibilityService.cpp b/accessible/base/nsAccessibilityService.cpp index 2590969a0..46d4dde01 100644 --- a/accessible/base/nsAccessibilityService.cpp +++ b/accessible/base/nsAccessibilityService.cpp @@ -53,10 +53,6 @@ #include "Logging.h" #endif -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif - #include "nsImageFrame.h" #include "nsIObserverService.h" #include "nsLayoutUtils.h" @@ -1283,12 +1279,6 @@ nsAccessibilityService::Init() 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> >; diff --git a/accessible/windows/msaa/IUnknownImpl.cpp b/accessible/windows/msaa/IUnknownImpl.cpp index c74f86e33..c5e614b60 100644 --- a/accessible/windows/msaa/IUnknownImpl.cpp +++ b/accessible/windows/msaa/IUnknownImpl.cpp @@ -9,10 +9,6 @@ #include "nsDebug.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif - namespace mozilla { namespace a11y { diff --git a/browser/base/content/browser-plugins.js b/browser/base/content/browser-plugins.js index ad070df12..c1bc65860 100644 --- a/browser/base/content/browser-plugins.js +++ b/browser/base/content/browser-plugins.js @@ -63,9 +63,7 @@ var gPluginHandler = { msg.data.pluginID); break; case "PluginContent:SubmitReport": - if (AppConstants.MOZ_CRASHREPORTER) { - this.submitReport(msg.data.runID, msg.data.keyVals, msg.data.submitURLOptIn); - } + // Nothing to do here break; case "PluginContent:LinkClickCallback": switch (msg.data.name) { @@ -98,11 +96,8 @@ var gPluginHandler = { }, submitReport: function submitReport(runID, keyVals, submitURLOptIn) { - if (!AppConstants.MOZ_CRASHREPORTER) { - return; - } - Services.prefs.setBoolPref("dom.ipc.plugins.reportCrashURL", submitURLOptIn); - PluginCrashReporter.submitCrashReport(runID, keyVals); + /*** STUB ***/ + return; }, // Callback for user clicking a "reload page" link @@ -461,18 +456,7 @@ var gPluginHandler = { // If we don't have a minidumpID, we can't (or didn't) submit anything. // This can happen if the plugin is killed from the task manager. - let state; - if (!AppConstants.MOZ_CRASHREPORTER || !gCrashReporter.enabled) { - // This state tells the user that crash reporting is disabled, so we - // cannot send a report. - state = "noSubmit"; - } else if (!pluginDumpID) { - // This state tells the user that there is no crash report available. - state = "noReport"; - } else { - // This state asks the user to submit a crash report. - state = "please"; - } + let state = "noSubmit"; let mm = window.getGroupMessageManager("browsers"); mm.broadcastAsyncMessage("BrowserPlugins:NPAPIPluginProcessCrashed", @@ -513,22 +497,6 @@ var gPluginHandler = { callback: function() { browser.reload(); }, }]; - if (AppConstants.MOZ_CRASHREPORTER && - PluginCrashReporter.hasCrashReport(pluginID)) { - let submitLabel = gNavigatorBundle.getString("crashedpluginsMessage.submitButton.label"); - let submitKey = gNavigatorBundle.getString("crashedpluginsMessage.submitButton.accesskey"); - let submitButton = { - label: submitLabel, - accessKey: submitKey, - popup: null, - callback: () => { - PluginCrashReporter.submitCrashReport(pluginID); - }, - }; - - buttons.push(submitButton); - } - notification = notificationBox.appendNotification(messageString, "plugin-crashed", iconURL, priority, buttons); diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index d41e94ae6..96a5d41a4 100755 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -61,11 +61,6 @@ Cu.import("resource://gre/modules/NotificationDB.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing", "resource://gre/modules/SafeBrowsing.jsm"); -if (AppConstants.MOZ_CRASHREPORTER) { - XPCOMUtils.defineLazyModuleGetter(this, "PluginCrashReporter", - "resource:///modules/ContentCrashHandlers.jsm"); -} - // lazy service getters [ ["Favicons", "@mozilla.org/browser/favicon-service;1", "mozIAsyncFavicons"], @@ -74,13 +69,6 @@ if (AppConstants.MOZ_CRASHREPORTER) { ["gDNSService", "@mozilla.org/network/dns-service;1", "nsIDNSService"], ].forEach(([name, cc, ci]) => XPCOMUtils.defineLazyServiceGetter(this, name, cc, ci)); -if (AppConstants.MOZ_CRASHREPORTER) { - XPCOMUtils.defineLazyServiceGetter(this, "gCrashReporter", - "@mozilla.org/xre/app-info;1", - "nsICrashReporter"); -} - - XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function() { let tmp = {}; Cu.import("resource://devtools/client/framework/ToolboxProcess.jsm", tmp); @@ -4582,23 +4570,6 @@ var XULBrowserWindow = { setTimeout(function () { XULBrowserWindow.asyncUpdateUI(); }, 0); else this.asyncUpdateUI(); - - if (AppConstants.MOZ_CRASHREPORTER && aLocationURI) { - let uri = aLocationURI.clone(); - try { - // If the current URI contains a username/password, remove it. - uri.userPass = ""; - } catch (ex) { /* Ignore failures on about: URIs. */ } - - try { - gCrashReporter.annotateCrashReport("URL", uri.spec); - } catch (ex) { - // Don't make noise when the crash reporter is built but not enabled. - if (ex.result != Components.results.NS_ERROR_NOT_INITIALIZED) { - throw ex; - } - } - } }, asyncUpdateUI: function () { diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index f97c173a0..448bb910d 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -70,15 +70,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "AlertsService", "@mozilla.org/alerts-s ["webrtcUI", "resource:///modules/webrtcUI.jsm"], ].forEach(([name, resource]) => XPCOMUtils.defineLazyModuleGetter(this, name, resource)); -if (AppConstants.MOZ_CRASHREPORTER) { - XPCOMUtils.defineLazyModuleGetter(this, "PluginCrashReporter", - "resource:///modules/ContentCrashHandlers.jsm"); - XPCOMUtils.defineLazyModuleGetter(this, "UnsubmittedCrashHandler", - "resource:///modules/ContentCrashHandlers.jsm"); - XPCOMUtils.defineLazyModuleGetter(this, "CrashSubmit", - "resource://gre/modules/CrashSubmit.jsm"); -} - XPCOMUtils.defineLazyGetter(this, "gBrandBundle", function() { return Services.strings.createBundle('chrome://branding/locale/brand.properties'); }); @@ -710,10 +701,6 @@ BrowserGlue.prototype = { } TabCrashHandler.init(); - if (AppConstants.MOZ_CRASHREPORTER) { - PluginCrashReporter.init(); - UnsubmittedCrashHandler.init(); - } Services.obs.notifyObservers(null, "browser-ui-startup-complete", ""); }, diff --git a/browser/components/preferences/in-content/advanced.js b/browser/components/preferences/in-content/advanced.js index 448a21dae..5f9458eee 100644 --- a/browser/components/preferences/in-content/advanced.js +++ b/browser/components/preferences/in-content/advanced.js @@ -40,9 +40,6 @@ var gAdvancedPane = { this.updateReadPrefs(); } this.updateOfflineApps(); - if (AppConstants.MOZ_CRASHREPORTER) { - this.initSubmitCrashes(); - } this.initTelemetry(); if (AppConstants.MOZ_TELEMETRY_REPORTING) { this.initSubmitHealthReport(); diff --git a/browser/components/preferences/in-content/advanced.xul b/browser/components/preferences/in-content/advanced.xul index facaaeaa9..4973f8e09 100644 --- a/browser/components/preferences/in-content/advanced.xul +++ b/browser/components/preferences/in-content/advanced.xul @@ -54,13 +54,6 @@ type="bool"/> #endif - <!-- Data Choices tab --> -#ifdef MOZ_CRASHREPORTER - <preference id="browser.crashReports.unsubmittedCheck.autoSubmit2" - name="browser.crashReports.unsubmittedCheck.autoSubmit2" - type="bool"/> -#endif - <!-- Network tab --> <preference id="browser.cache.disk.capacity" name="browser.cache.disk.capacity" @@ -233,22 +226,6 @@ </vbox> </groupbox> #endif -#ifdef MOZ_CRASHREPORTER - <groupbox> - <caption> - <checkbox id="automaticallySubmitCrashesBox" - preference="browser.crashReports.unsubmittedCheck.autoSubmit2" - label="&alwaysSubmitCrashReports.label;" - accesskey="&alwaysSubmitCrashReports.accesskey;"/> - </caption> - <hbox class="indent"> - <label flex="1">&crashReporterDesc2.label;</label> - <spacer flex="10"/> - <label id="crashReporterLearnMore" - class="text-link">&crashReporterLearnMore.label;</label> - </hbox> - </groupbox> -#endif </tabpanel> #endif diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 015daa8c7..71252bffc 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -781,28 +781,6 @@ bin/libfreebl_32int64_3.so @BINPATH@/maintenanceservice_installer.exe #endif -; [Crash Reporter] -; -#ifdef MOZ_CRASHREPORTER -@RESPATH@/components/CrashService.manifest -@RESPATH@/components/CrashService.js -@RESPATH@/components/toolkit_crashservice.xpt -#ifdef XP_MACOSX -@BINPATH@/crashreporter.app/ -#else -@BINPATH@/crashreporter@BIN_SUFFIX@ -@BINPATH@/minidump-analyzer@BIN_SUFFIX@ -@RESPATH@/crashreporter.ini -#ifdef XP_UNIX -@RESPATH@/Throbber-small.gif -#endif -#endif -@RESPATH@/browser/crashreporter-override.ini -#ifdef MOZ_CRASHREPORTER_INJECTOR -@BINPATH@/breakpadinjector.dll -#endif -#endif - @RESPATH@/components/dom_audiochannel.xpt ; Shutdown Terminator diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in index b3ecfd359..af200147f 100644 --- a/browser/locales/Makefile.in +++ b/browser/locales/Makefile.in @@ -165,11 +165,6 @@ else endif endif -ifdef MOZ_CRASHREPORTER -libs:: crashreporter-override.ini - $(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET) -endif - ident: @printf 'fx_revision ' @$(PYTHON) $(topsrcdir)/config/printconfigsetting.py \ diff --git a/browser/modules/ContentCrashHandlers.jsm b/browser/modules/ContentCrashHandlers.jsm index 2f755d142..488cc4f26 100644 --- a/browser/modules/ContentCrashHandlers.jsm +++ b/browser/modules/ContentCrashHandlers.jsm @@ -90,8 +90,6 @@ this.TabCrashHandler = { Services.telemetry .getHistogramById("FX_CONTENT_CRASH_DUMP_UNAVAILABLE") .add(1); - } else if (AppConstants.MOZ_CRASHREPORTER) { - this.childMap.set(childID, dumpID); } if (!this.flushCrashedBrowserQueue(childID)) { @@ -115,15 +113,6 @@ this.TabCrashHandler = { } } - // check for environment affecting crash reporting - let env = Cc["@mozilla.org/process/environment;1"] - .getService(Ci.nsIEnvironment); - let shutdown = env.exists("MOZ_CRASHREPORTER_SHUTDOWN"); - - if (shutdown) { - Services.startup.quit(Ci.nsIAppStartup.eForceQuit); - } - break; } case "oop-frameloader-crashed": { @@ -306,105 +295,10 @@ this.TabCrashHandler = { /** * Submits a crash report from about:tabcrashed, if the crash * reporter is enabled and a crash report can be found. - * - * @param aBrowser - * The <xul:browser> that the report was sent from. - * @param aFormData - * An Object with the following properties: - * - * includeURL (bool): - * Whether to include the URL that the user was on - * in the crashed tab before the crash occurred. - * URL (String) - * The URL that the user was on in the crashed tab - * before the crash occurred. - * emailMe (bool): - * Whether or not to include the user's email address - * in the crash report. - * email (String): - * The email address of the user. - * comments (String): - * Any additional comments from the user. - * - * Note that it is expected that all properties are set, - * even if they are empty. */ maybeSendCrashReport(message) { - if (!AppConstants.MOZ_CRASHREPORTER) { - return; - } - - if (!message.data.hasReport) { - // There was no report, so nothing to do. - return; - } - - let browser = message.target.browser; - - if (message.data.autoSubmit) { - // The user has opted in to autosubmitted backlogged - // crash reports in the future. - UnsubmittedCrashHandler.autoSubmit = true; - } - - let childID = this.browserMap.get(browser.permanentKey); - let dumpID = this.childMap.get(childID); - if (!dumpID) { - return; - } - - if (!message.data.sendReport) { - Services.telemetry.getHistogramById("FX_CONTENT_CRASH_NOT_SUBMITTED").add(1); - this.prefs.setBoolPref("sendReport", false); - return; - } - - let { - includeURL, - comments, - email, - emailMe, - URL, - } = message.data; - - let extraExtraKeyVals = { - "Comments": comments, - "Email": email, - "URL": URL, - }; - - // For the entries in extraExtraKeyVals, we only want to submit the - // extra data values where they are not the empty string. - for (let key in extraExtraKeyVals) { - let val = extraExtraKeyVals[key].trim(); - if (!val) { - delete extraExtraKeyVals[key]; - } - } - - // URL is special, since it's already been written to extra data by - // default. In order to make sure we don't send it, we overwrite it - // with the empty string. - if (!includeURL) { - extraExtraKeyVals["URL"] = ""; - } - - CrashSubmit.submit(dumpID, { - recordSubmission: true, - extraExtraKeyVals, - }).then(null, Cu.reportError); - - this.prefs.setBoolPref("sendReport", true); - this.prefs.setBoolPref("includeURL", includeURL); - this.prefs.setBoolPref("emailMe", emailMe); - if (emailMe) { - this.prefs.setCharPref("email", email); - } else { - this.prefs.setCharPref("email", ""); - } - - this.childMap.set(childID, null); // Avoid resubmission. - this.removeSubmitCheckboxesForSameCrash(childID); + /*** STUB ***/ + return; }, removeSubmitCheckboxesForSameCrash: function(childID) { @@ -518,17 +412,10 @@ this.TabCrashHandler = { /** * For some <xul:browser>, return a crash report dump ID for that browser * if we have been informed of one. Otherwise, return null. - * - * @param browser (<xul:browser) - * The browser to try to get the dump ID for - * @returns dumpID (String) */ getDumpID(browser) { - if (!AppConstants.MOZ_CRASHREPORTER) { - return null; - } - - return this.childMap.get(this.browserMap.get(browser.permanentKey)); + /*** STUB ***/ + return null; }, } diff --git a/browser/modules/PluginContent.jsm b/browser/modules/PluginContent.jsm index 1bbfa9a50..622d608bc 100644 --- a/browser/modules/PluginContent.jsm +++ b/browser/modules/PluginContent.jsm @@ -660,30 +660,8 @@ PluginContent.prototype = { }, submitReport: function submitReport(plugin) { - if (!AppConstants.MOZ_CRASHREPORTER) { - return; - } - if (!plugin) { - Cu.reportError("Attempted to submit crash report without an associated plugin."); - return; - } - if (!(plugin instanceof Ci.nsIObjectLoadingContent)) { - Cu.reportError("Attempted to submit crash report on plugin that does not" + - "implement nsIObjectLoadingContent."); - return; - } - - let runID = plugin.runID; - let submitURLOptIn = this.getPluginUI(plugin, "submitURLOptIn").checked; - let keyVals = {}; - let userComment = this.getPluginUI(plugin, "submitComment").value.trim(); - if (userComment) - keyVals.PluginUserComment = userComment; - if (submitURLOptIn) - keyVals.PluginContentURL = plugin.ownerDocument.URL; - - this.global.sendAsyncMessage("PluginContent:SubmitReport", - { runID, keyVals, submitURLOptIn }); + /*** STUB ***/ + return; }, reloadPage: function () { diff --git a/build/application.ini b/build/application.ini index 6b2e43a34..e60f86b69 100644 --- a/build/application.ini +++ b/build/application.ini @@ -54,8 +54,3 @@ MaxVersion=@GRE_MILESTONE@ EnableProfileMigrator=1 #endif -#if MOZ_CRASHREPORTER -[Crash Reporter] -Enabled=1 -ServerURL=https://crash-reports.mozilla.com/submit?id=@MOZ_APP_ID@&version=@MOZ_APP_VERSION@&buildid=@MOZ_BUILDID@ -#endif diff --git a/build/automation-build.mk b/build/automation-build.mk index e25f90c5d..6599cb032 100644 --- a/build/automation-build.mk +++ b/build/automation-build.mk @@ -48,11 +48,7 @@ else AUTOMATION_PPARGS += -DIS_DEBUG_BUILD=0 endif -ifdef MOZ_CRASHREPORTER -AUTOMATION_PPARGS += -DCRASHREPORTER=1 -else AUTOMATION_PPARGS += -DCRASHREPORTER=0 -endif ifdef MOZ_ASAN AUTOMATION_PPARGS += -DIS_ASAN=1 diff --git a/build/automation.py.in b/build/automation.py.in index 1c63977e8..83e718037 100644 --- a/build/automation.py.in +++ b/build/automation.py.in @@ -230,7 +230,6 @@ class Automation(object): if crashreporter and not debugger: env['MOZ_CRASHREPORTER_NO_REPORT'] = '1' - env['MOZ_CRASHREPORTER'] = '1' else: env['MOZ_CRASHREPORTER_DISABLE'] = '1' diff --git a/build/mobile/b2gautomation.py b/build/mobile/b2gautomation.py index d73edd419..e547bd6d2 100644 --- a/build/mobile/b2gautomation.py +++ b/build/mobile/b2gautomation.py @@ -157,7 +157,6 @@ class B2GRemoteAutomation(Automation): env = {} if crashreporter: - env['MOZ_CRASHREPORTER'] = '1' env['MOZ_CRASHREPORTER_NO_REPORT'] = '1' # We always hide the results table in B2G; it's much slower if we don't. diff --git a/build/mobile/remoteautomation.py b/build/mobile/remoteautomation.py index 1358e0dfe..26eedc85d 100644 --- a/build/mobile/remoteautomation.py +++ b/build/mobile/remoteautomation.py @@ -76,7 +76,6 @@ class RemoteAutomation(Automation): if crashreporter and not debugger: env['MOZ_CRASHREPORTER_NO_REPORT'] = '1' - env['MOZ_CRASHREPORTER'] = '1' else: env['MOZ_CRASHREPORTER_DISABLE'] = '1' @@ -215,36 +214,9 @@ class RemoteAutomation(Automation): if javaException: return True - # If crash reporting is disabled (MOZ_CRASHREPORTER!=1), we can't say - # anything. - if not self.CRASHREPORTER: - return False + # No crash reporting means we can't say anything. + return False - try: - dumpDir = tempfile.mkdtemp() - remoteCrashDir = posixpath.join(self._remoteProfile, 'minidumps') - if not self._devicemanager.dirExists(remoteCrashDir): - # If crash reporting is enabled (MOZ_CRASHREPORTER=1), the - # minidumps directory is automatically created when Fennec - # (first) starts, so its lack of presence is a hint that - # something went wrong. - print "Automation Error: No crash directory (%s) found on remote device" % remoteCrashDir - # Whilst no crash was found, the run should still display as a failure - return True - self._devicemanager.getDirectory(remoteCrashDir, dumpDir) - - logger = get_default_logger() - if logger is not None: - crashed = mozcrash.log_crashes(logger, dumpDir, symbolsPath, test=self.lastTestSeen) - else: - crashed = Automation.checkForCrashes(self, dumpDir, symbolsPath) - - finally: - try: - shutil.rmtree(dumpDir) - except: - print "WARNING: unable to remove directory: %s" % dumpDir - return crashed def buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs): # If remote profile is specified, use that instead diff --git a/build/moz.build b/build/moz.build index 8d86b52bf..f25e5cfa5 100644 --- a/build/moz.build +++ b/build/moz.build @@ -42,7 +42,7 @@ if CONFIG['MC_PALEMOON']: if CONFIG['MOZ_APP_PROFILE']: DEFINES['MOZ_APP_PROFILE'] = CONFIG['MOZ_APP_PROFILE'] -for var in ('MOZ_CRASHREPORTER', 'MOZ_PROFILE_MIGRATOR', +for var in ('MOZ_PROFILE_MIGRATOR', 'MOZ_APP_STATIC_INI'): if CONFIG[var]: DEFINES[var] = True diff --git a/caps/BasePrincipal.cpp b/caps/BasePrincipal.cpp index b768d5c1f..93ffcf129 100644 --- a/caps/BasePrincipal.cpp +++ b/caps/BasePrincipal.cpp @@ -7,9 +7,6 @@ #include "mozilla/BasePrincipal.h" #include "nsDocShell.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif #include "nsIAddonPolicyService.h" #include "nsIContentSecurityPolicy.h" #include "nsIEffectiveTLDService.h" @@ -149,10 +146,6 @@ OriginAttributes::CreateSuffix(nsACString& aStr) const if (!mAddonId.IsEmpty()) { if (mAddonId.FindCharInSet(dom::quota::QuotaManager::kReplaceChars) != kNotFound) { -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Crash_AddonId"), - NS_ConvertUTF16toUTF8(mAddonId)); -#endif MOZ_CRASH(); } params->Set(NS_LITERAL_STRING("addonId"), mAddonId); diff --git a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp index e7d362864..64d088bb4 100644 --- a/docshell/base/nsAboutRedirector.cpp +++ b/docshell/base/nsAboutRedirector.cpp @@ -50,9 +50,6 @@ static RedirEntry kRedirMap[] = { nsIAboutModule::ALLOW_SCRIPT }, { "config", "chrome://global/content/config.xul", 0 }, -#ifdef MOZ_CRASHREPORTER - { "crashes", "chrome://global/content/crashes.xhtml", 0 }, -#endif { "credits", "http://www.palemoon.org/Contributors.shtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 50641508d..58c182cbb 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -2289,13 +2289,6 @@ nsDocShell::GetUseRemoteTabs(bool* aUseRemoteTabs) NS_IMETHODIMP nsDocShell::SetRemoteTabs(bool aUseRemoteTabs) { -#ifdef MOZ_CRASHREPORTER - if (aUseRemoteTabs) { - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("DOMIPCEnabled"), - NS_LITERAL_CSTRING("1")); - } -#endif - mUseRemoteTabs = aUseRemoteTabs; return NS_OK; } diff --git a/docshell/build/nsDocShellModule.cpp b/docshell/build/nsDocShellModule.cpp index d43c305f9..f2c915b39 100644 --- a/docshell/build/nsDocShellModule.cpp +++ b/docshell/build/nsDocShellModule.cpp @@ -165,9 +165,6 @@ const mozilla::Module::ContractIDEntry kDocShellContracts[] = { { NS_ABOUT_MODULE_CONTRACTID_PREFIX "buildconfig", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "checkerboard", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "config", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, -#ifdef MOZ_CRASHREPORTER - { NS_ABOUT_MODULE_CONTRACTID_PREFIX "crashes", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, -#endif { NS_ABOUT_MODULE_CONTRACTID_PREFIX "credits", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, #ifdef MOZ_DEVTOOLS { NS_ABOUT_MODULE_CONTRACTID_PREFIX "debugging", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, diff --git a/dom/base/nsFrameMessageManager.cpp b/dom/base/nsFrameMessageManager.cpp index a4bba4856..049bc0a1a 100644 --- a/dom/base/nsFrameMessageManager.cpp +++ b/dom/base/nsFrameMessageManager.cpp @@ -51,10 +51,6 @@ #include <algorithm> #include "chrome/common/ipc_channel.h" // for IPC::Channel::kMaximumMessageSize -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif - #ifdef ANDROID #include <android/log.h> #endif diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index ca4acf114..75678ca96 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -585,11 +585,6 @@ ContentChild::Init(MessageLoop* aIOLoop, SendBackUpXResources(FileDescriptor(xSocketFd)); #endif -#ifdef MOZ_CRASHREPORTER - SendPCrashReporterConstructor(CrashReporter::CurrentThreadId(), - XRE_GetProcessType()); -#endif - SendGetProcessAttributes(&mID, &mIsForApp, &mIsForBrowser); InitProcessAttributes(); @@ -1439,18 +1434,6 @@ ContentChild::RecvSetProcessSandbox(const MaybeFileDesc& aBroker) sandboxEnabled = StartMacOSContentSandbox(); #endif -#if defined(MOZ_CRASHREPORTER) - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("ContentSandboxEnabled"), - sandboxEnabled? NS_LITERAL_CSTRING("1") : NS_LITERAL_CSTRING("0")); -#if defined(XP_LINUX) && !defined(OS_ANDROID) - nsAutoCString flagsString; - flagsString.AppendInt(SandboxInfo::Get().AsInteger()); - - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("ContentSandboxCapabilities"), flagsString); -#endif /* XP_LINUX && !OS_ANDROID */ -#endif /* MOZ_CRASHREPORTER */ #endif /* MOZ_CONTENT_SANDBOX */ return true; @@ -1740,11 +1723,7 @@ PCrashReporterChild* ContentChild::AllocPCrashReporterChild(const mozilla::dom::NativeThreadId& id, const uint32_t& processType) { -#ifdef MOZ_CRASHREPORTER - return new CrashReporterChild(); -#else return nullptr; -#endif } bool @@ -2159,16 +2138,6 @@ ContentChild::ProcessingError(Result aCode, const char* aReason) NS_RUNTIMEABORT("not reached"); } -#if defined(MOZ_CRASHREPORTER) && !defined(MOZ_B2G) - if (PCrashReporterChild* c = LoneManagedOrNullAsserts(ManagedPCrashReporterChild())) { - CrashReporterChild* crashReporter = - static_cast<CrashReporterChild*>(c); - nsDependentCString reason(aReason); - crashReporter->SendAnnotateCrashReport( - NS_LITERAL_CSTRING("ipc_channel_error"), - reason); - } -#endif NS_RUNTIMEABORT("Content child abort due to IPC error"); } @@ -2872,10 +2841,6 @@ ContentChild::RecvShutdown() // to wait for that event loop to finish. Otherwise we could prematurely // terminate an "unload" or "pagehide" event handler (which might be doing a // sync XHR, for example). -#if defined(MOZ_CRASHREPORTER) - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCShutdownState"), - NS_LITERAL_CSTRING("RecvShutdown")); -#endif nsCOMPtr<nsIThread> thread; nsresult rv = NS_GetMainThread(getter_AddRefs(thread)); if (NS_SUCCEEDED(rv) && thread) { @@ -2923,10 +2888,6 @@ ContentChild::RecvShutdown() // parent closes. StartForceKillTimer(); -#if defined(MOZ_CRASHREPORTER) - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCShutdownState"), - NS_LITERAL_CSTRING("SendFinishShutdown")); -#endif // Ignore errors here. If this fails, the parent will kill us after a // timeout. Unused << SendFinishShutdown(); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index ff40db8d7..73621df22 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -249,10 +249,6 @@ using namespace mozilla::system; #include "mozilla/widget/AudioSession.h" #endif -#ifdef MOZ_CRASHREPORTER -#include "nsThread.h" -#endif - #ifdef ACCESSIBILITY #include "nsAccessibilityService.h" #endif @@ -273,9 +269,6 @@ using base::KillProcess; using mozilla::ProfileGatherer; #endif -#ifdef MOZ_CRASHREPORTER -using namespace CrashReporter; -#endif using namespace mozilla::dom::power; using namespace mozilla::media; using namespace mozilla::embedding; @@ -1847,36 +1840,6 @@ ContentParent::ActorDestroy(ActorDestroyReason why) NS_LITERAL_CSTRING("content"), 1); props->SetPropertyAsBool(NS_LITERAL_STRING("abnormal"), true); - -#ifdef MOZ_CRASHREPORTER - // There's a window in which child processes can crash - // after IPC is established, but before a crash reporter - // is created. - if (PCrashReporterParent* p = LoneManagedOrNullAsserts(ManagedPCrashReporterParent())) { - CrashReporterParent* crashReporter = - static_cast<CrashReporterParent*>(p); - - // If we're an app process, always stomp the latest URI - // loaded in the child process with our manifest URL. We - // would rather associate the crashes with apps than - // random child windows loaded in them. - // - // XXX would be nice if we could get both ... - if (!mAppManifestURL.IsEmpty()) { - crashReporter->AnnotateCrashReport(NS_LITERAL_CSTRING("URL"), - NS_ConvertUTF16toUTF8(mAppManifestURL)); - } - - // if mCreatedPairedMinidumps is true, we've already generated - // parent/child dumps for dekstop crashes. - if (!mCreatedPairedMinidumps) { - crashReporter->GenerateCrashReport(this, nullptr); - } - - nsAutoString dumpID(crashReporter->ChildDumpID()); - props->SetPropertyAsAString(NS_LITERAL_STRING("dumpID"), dumpID); - } -#endif } nsAutoString cpId; cpId.AppendInt(static_cast<uint64_t>(this->ChildID())); @@ -3090,33 +3053,6 @@ ContentParent::KillHard(const char* aReason) mCalledKillHard = true; mForceKillTimer = nullptr; -#if defined(MOZ_CRASHREPORTER) && !defined(MOZ_B2G) - // We're about to kill the child process associated with this content. - // Something has gone wrong to get us here, so we generate a minidump - // of the parent and child for submission to the crash server. - if (PCrashReporterParent* p = LoneManagedOrNullAsserts(ManagedPCrashReporterParent())) { - CrashReporterParent* crashReporter = - static_cast<CrashReporterParent*>(p); - // GeneratePairedMinidump creates two minidumps for us - the main - // one is for the content process we're about to kill, and the other - // one is for the main browser process. That second one is the extra - // minidump tagging along, so we have to tell the crash reporter that - // it exists and is being appended. - nsAutoCString additionalDumps("browser"); - crashReporter->AnnotateCrashReport( - NS_LITERAL_CSTRING("additional_minidumps"), - additionalDumps); - nsDependentCString reason(aReason); - crashReporter->AnnotateCrashReport( - NS_LITERAL_CSTRING("ipc_channel_error"), - reason); - - // Generate the report and insert into the queue for submittal. - mCreatedPairedMinidumps = crashReporter->GenerateCompleteMinidump(this); - - Telemetry::Accumulate(Telemetry::SUBPROCESS_KILL_HARD, reason, 1); - } -#endif ProcessHandle otherProcessHandle; if (!base::OpenProcessHandle(OtherPid(), &otherProcessHandle)) { NS_ERROR("Failed to open child process when attempting kill."); @@ -3168,11 +3104,7 @@ PCrashReporterParent* ContentParent::AllocPCrashReporterParent(const NativeThreadId& tid, const uint32_t& processType) { -#ifdef MOZ_CRASHREPORTER - return new CrashReporterParent(); -#else return nullptr; -#endif } bool @@ -5001,9 +4933,6 @@ ContentParent::RecvNotifyPushSubscriptionModifiedObservers(const nsCString& aSco bool ContentParent::RecvNotifyLowMemory() { -#ifdef MOZ_CRASHREPORTER - nsThread::SaveMemoryReportNearOOM(nsThread::ShouldSaveMemoryReport::kForceReport); -#endif return true; } diff --git a/dom/ipc/CrashReporterParent.cpp b/dom/ipc/CrashReporterParent.cpp index fc627387f..677b29670 100644 --- a/dom/ipc/CrashReporterParent.cpp +++ b/dom/ipc/CrashReporterParent.cpp @@ -13,13 +13,6 @@ #include "mozilla/Telemetry.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#include "nsICrashService.h" -#include "mozilla/SyncRunnable.h" -#include "nsThreadUtils.h" -#endif - namespace mozilla { namespace dom { @@ -29,9 +22,6 @@ void CrashReporterParent::AnnotateCrashReport(const nsCString& key, const nsCString& data) { -#ifdef MOZ_CRASHREPORTER - mNotes.Put(key, data); -#endif } void @@ -49,9 +39,6 @@ CrashReporterParent::RecvAppendAppNotes(const nsCString& data) CrashReporterParent::CrashReporterParent() : -#ifdef MOZ_CRASHREPORTER - mNotes(4), -#endif mStartTime(::time(nullptr)) , mInitialized(false) { @@ -72,75 +59,5 @@ CrashReporterParent::SetChildData(const NativeThreadId& tid, mProcessType = GeckoProcessType(processType); } -#ifdef MOZ_CRASHREPORTER -bool -CrashReporterParent::GenerateCrashReportForMinidump(nsIFile* minidump, - const AnnotationTable* processNotes) -{ - if (!CrashReporter::GetIDFromMinidump(minidump, mChildDumpID)) { - return false; - } - - bool result = GenerateChildData(processNotes); - FinalizeChildData(); - return result; -} - -bool -CrashReporterParent::GenerateChildData(const AnnotationTable* processNotes) -{ - MOZ_ASSERT(mInitialized); - - if (mChildDumpID.IsEmpty()) { - NS_WARNING("problem with GenerateChildData: no child dump id yet!"); - return false; - } - - nsAutoCString type; - switch (mProcessType) { - case GeckoProcessType_Content: - type = NS_LITERAL_CSTRING("content"); - break; - case GeckoProcessType_Plugin: - case GeckoProcessType_GMPlugin: - type = NS_LITERAL_CSTRING("plugin"); - break; - default: - NS_ERROR("unknown process type"); - break; - } - mNotes.Put(NS_LITERAL_CSTRING("ProcessType"), type); - - char startTime[32]; - SprintfLiteral(startTime, "%lld", static_cast<long long>(mStartTime)); - mNotes.Put(NS_LITERAL_CSTRING("StartupTime"), nsDependentCString(startTime)); - - if (!mAppNotes.IsEmpty()) { - mNotes.Put(NS_LITERAL_CSTRING("Notes"), mAppNotes); - } - - // Append these notes to the end of the extra file based on the current - // dump id we obtained from CreatePairedMinidumps. - bool ret = CrashReporter::AppendExtraData(mChildDumpID, mNotes); - if (ret && processNotes) { - ret = CrashReporter::AppendExtraData(mChildDumpID, *processNotes); - } - - if (!ret) { - NS_WARNING("problem appending child data to .extra"); - } - return ret; -} - -void -CrashReporterParent::FinalizeChildData() -{ - MOZ_ASSERT(mInitialized); - - CrashReporterHost::NotifyCrashService(mProcessType, mChildDumpID, &mNotes); - mNotes.Clear(); -} -#endif - } // namespace dom } // namespace mozilla diff --git a/dom/ipc/CrashReporterParent.h b/dom/ipc/CrashReporterParent.h index 25824f279..71896c5c1 100644 --- a/dom/ipc/CrashReporterParent.h +++ b/dom/ipc/CrashReporterParent.h @@ -10,122 +10,16 @@ #include "mozilla/dom/PCrashReporterParent.h" #include "mozilla/dom/TabMessageUtils.h" #include "nsIFile.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#include "nsDataHashtable.h" -#endif namespace mozilla { namespace dom { class CrashReporterParent : public PCrashReporterParent { -#ifdef MOZ_CRASHREPORTER - typedef CrashReporter::AnnotationTable AnnotationTable; -#endif public: CrashReporterParent(); virtual ~CrashReporterParent(); -#ifdef MOZ_CRASHREPORTER - - /* - * Attempt to create a bare-bones crash report, along with extra process- - * specific annotations present in the given AnnotationTable. Calls - * GenerateChildData and FinalizeChildData. - * - * @returns true if successful, false otherwise. - */ - template<class Toplevel> - bool - GenerateCrashReport(Toplevel* t, const AnnotationTable* processNotes); - - /* - * Attempt to generate a parent/child pair of minidumps from the given - * toplevel actor. This calls CrashReporter::CreateMinidumpsAndPair to - * generate the minidumps. Crash reporter annotations set prior to this - * call will be saved via PairedDumpCallbackExtra into an .extra file - * under the proper crash id. AnnotateCrashReport annotations are not - * set in this call and the report is not finalized. - * - * @returns true if successful, false otherwise. - */ - template<class Toplevel> - bool - GeneratePairedMinidump(Toplevel* t); - - /* - * Attempts to take a minidump of the current process and pair that with - * a named minidump handed in by the caller. - * - * @param aTopLevel - top level actor this reporter is associated with. - * @param aMinidump - the minidump to associate with. - * @param aPairName - the name of the additional minidump. - * @returns true if successful, false otherwise. - */ - template<class Toplevel> - bool - GenerateMinidumpAndPair(Toplevel* aTopLevel, nsIFile* aMinidump, - const nsACString& aPairName); - - /** - * Apply child process annotations to an existing paired mindump generated - * with GeneratePairedMinidump. - * - * Be careful about calling generate apis immediately after this call, - * see FinalizeChildData. - * - * @param processNotes (optional) - Additional notes to append. Annotations - * stored in mNotes will also be applied. processNotes can be null. - * @returns true if successful, false otherwise. - */ - bool - GenerateChildData(const AnnotationTable* processNotes); - - /** - * Handles main thread finalization tasks after a report has been - * generated. Does the following: - * - register the finished report with the crash service manager - * - records telemetry related data about crashes - * - * Be careful about calling generate apis immediately after this call, - * if this api is called on a non-main thread it will fire off a runnable - * to complete its work async. - */ - void - FinalizeChildData(); - - /* - * Attempt to generate a full paired dump complete with any child - * annoations, and finalizes the report. Note this call is only valid - * on the main thread. Calling on a background thread will fail. - * - * @returns true if successful, false otherwise. - */ - template<class Toplevel> - bool - GenerateCompleteMinidump(Toplevel* t); - - /** - * Submits a raw minidump handed in, calls GenerateChildData and - * FinalizeChildData. Used by content plugins and gmp. - * - * @returns true if successful, false otherwise. - */ - bool - GenerateCrashReportForMinidump(nsIFile* minidump, - const AnnotationTable* processNotes); - - /* - * Instantiate a new crash reporter actor from a given parent that manages - * the protocol. - * - * @returns true if successful, false otherwise. - */ - template<class Toplevel> - static bool CreateCrashReporter(Toplevel* actor); -#endif // MOZ_CRASHREPORTER - /* * Initialize this reporter with data from the child process. */ @@ -160,14 +54,6 @@ public: virtual bool RecvAppendAppNotes(const nsCString& aData) override; -#ifdef MOZ_CRASHREPORTER - void - NotifyCrashService(); -#endif - -#ifdef MOZ_CRASHREPORTER - AnnotationTable mNotes; -#endif nsCString mAppNotes; nsString mChildDumpID; // stores the child main thread id @@ -178,128 +64,6 @@ public: bool mInitialized; }; -#ifdef MOZ_CRASHREPORTER -template<class Toplevel> -inline bool -CrashReporterParent::GeneratePairedMinidump(Toplevel* t) -{ - mozilla::ipc::ScopedProcessHandle child; -#ifdef XP_MACOSX - child = t->Process()->GetChildTask(); -#else - if (!base::OpenPrivilegedProcessHandle(t->OtherPid(), &child.rwget())) { - NS_WARNING("Failed to open child process handle."); - return false; - } -#endif - nsCOMPtr<nsIFile> childDump; - if (CrashReporter::CreateMinidumpsAndPair(child, - mMainThread, - NS_LITERAL_CSTRING("browser"), - nullptr, // pair with a dump of this process and thread - getter_AddRefs(childDump)) && - CrashReporter::GetIDFromMinidump(childDump, mChildDumpID)) { - return true; - } - return false; -} - -template<class Toplevel> -inline bool -CrashReporterParent::GenerateMinidumpAndPair(Toplevel* aTopLevel, - nsIFile* aMinidumpToPair, - const nsACString& aPairName) -{ - mozilla::ipc::ScopedProcessHandle childHandle; -#ifdef XP_MACOSX - childHandle = aTopLevel->Process()->GetChildTask(); -#else - if (!base::OpenPrivilegedProcessHandle(aTopLevel->OtherPid(), - &childHandle.rwget())) { - NS_WARNING("Failed to open child process handle."); - return false; - } -#endif - nsCOMPtr<nsIFile> targetDump; - if (CrashReporter::CreateMinidumpsAndPair(childHandle, - mMainThread, // child thread id - aPairName, - aMinidumpToPair, - getter_AddRefs(targetDump)) && - CrashReporter::GetIDFromMinidump(targetDump, mChildDumpID)) { - return true; - } - return false; -} - -template<class Toplevel> -inline bool -CrashReporterParent::GenerateCrashReport(Toplevel* t, - const AnnotationTable* processNotes) -{ - nsCOMPtr<nsIFile> crashDump; - if (t->TakeMinidump(getter_AddRefs(crashDump), nullptr) && - CrashReporter::GetIDFromMinidump(crashDump, mChildDumpID)) { - bool result = GenerateChildData(processNotes); - FinalizeChildData(); - return result; - } - return false; -} - -template<class Toplevel> -inline bool -CrashReporterParent::GenerateCompleteMinidump(Toplevel* t) -{ - mozilla::ipc::ScopedProcessHandle child; - if (!NS_IsMainThread()) { - NS_WARNING("GenerateCompleteMinidump can't be called on non-main thread."); - return false; - } - -#ifdef XP_MACOSX - child = t->Process()->GetChildTask(); -#else - if (!base::OpenPrivilegedProcessHandle(t->OtherPid(), &child.rwget())) { - NS_WARNING("Failed to open child process handle."); - return false; - } -#endif - nsCOMPtr<nsIFile> childDump; - if (CrashReporter::CreateMinidumpsAndPair(child, - mMainThread, - NS_LITERAL_CSTRING("browser"), - nullptr, // pair with a dump of this process and thread - getter_AddRefs(childDump)) && - CrashReporter::GetIDFromMinidump(childDump, mChildDumpID)) { - bool result = GenerateChildData(nullptr); - FinalizeChildData(); - return result; - } - return false; -} - -template<class Toplevel> -/* static */ bool -CrashReporterParent::CreateCrashReporter(Toplevel* actor) -{ -#ifdef MOZ_CRASHREPORTER - NativeThreadId id; - uint32_t processType; - PCrashReporterParent* p = - actor->CallPCrashReporterConstructor(&id, &processType); - if (p) { - static_cast<CrashReporterParent*>(p)->SetChildData(id, processType); - } else { - NS_ERROR("Error creating crash reporter actor"); - } - return !!p; -#endif - return false; -} - -#endif - } // namespace dom } // namespace mozilla diff --git a/dom/ipc/ProcessHangMonitor.cpp b/dom/ipc/ProcessHangMonitor.cpp index b574be61f..d46a1f5d5 100644 --- a/dom/ipc/ProcessHangMonitor.cpp +++ b/dom/ipc/ProcessHangMonitor.cpp @@ -27,9 +27,6 @@ #include "nsITabParent.h" #include "nsPluginHost.h" #include "nsThreadUtils.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif #include "base/task.h" #include "base/thread.h" @@ -556,16 +553,6 @@ HangMonitorParent::HangMonitorParent(ProcessHangMonitor* aMonitor) HangMonitorParent::~HangMonitorParent() { -#ifdef MOZ_CRASHREPORTER - MutexAutoLock lock(mBrowserCrashDumpHashLock); - - for (auto iter = mBrowserCrashDumpIds.Iter(); !iter.Done(); iter.Next()) { - nsString crashId = iter.UserData(); - if (!crashId.IsEmpty()) { - CrashReporter::DeleteMinidumpFilesForID(crashId); - } - } -#endif } void @@ -698,24 +685,6 @@ bool HangMonitorParent::TakeBrowserMinidump(const PluginHangData& aPhd, nsString& aCrashId) { -#ifdef MOZ_CRASHREPORTER - MutexAutoLock lock(mBrowserCrashDumpHashLock); - if (!mBrowserCrashDumpIds.Get(aPhd.pluginId(), &aCrashId)) { - nsCOMPtr<nsIFile> browserDump; - if (CrashReporter::TakeMinidump(getter_AddRefs(browserDump), true)) { - if (!CrashReporter::GetIDFromMinidump(browserDump, aCrashId) - || aCrashId.IsEmpty()) { - browserDump->Remove(false); - NS_WARNING("Failed to generate timely browser stack, " - "this is bad for plugin hang analysis!"); - } else { - mBrowserCrashDumpIds.Put(aPhd.pluginId(), aCrashId); - return true; - } - } - } -#endif // MOZ_CRASHREPORTER - return false; } @@ -840,11 +809,6 @@ HangMonitorParent::CleanupPluginHang(uint32_t aPluginId, bool aRemoveFiles) return; } mBrowserCrashDumpIds.Remove(aPluginId); -#ifdef MOZ_CRASHREPORTER - if (aRemoveFiles && !crashId.IsEmpty()) { - CrashReporter::DeleteMinidumpFilesForID(crashId); - } -#endif } void diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index f46a917d5..c8a0c6e3f 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -52,9 +52,6 @@ #include "nsEmbedCID.h" #include "nsGlobalWindow.h" #include <algorithm> -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif #include "nsFilePickerProxy.h" #include "mozilla/dom/Element.h" #include "nsGlobalWindow.h" @@ -1261,10 +1258,6 @@ TabChild::RecvLoadURL(const nsCString& aURI, NS_WARNING("WebNavigation()->LoadURI failed. Eating exception, what else can I do?"); } -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("URL"), aURI); -#endif - return true; } diff --git a/dom/ipc/TabMessageUtils.h b/dom/ipc/TabMessageUtils.h index cdb76099d..2933173d7 100644 --- a/dom/ipc/TabMessageUtils.h +++ b/dom/ipc/TabMessageUtils.h @@ -13,10 +13,6 @@ #include "nsPIDOMWindow.h" #include "nsCOMPtr.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif - namespace mozilla { namespace dom { struct RemoteDOMEvent @@ -28,12 +24,8 @@ struct RemoteDOMEvent bool ReadRemoteEvent(const IPC::Message* aMsg, PickleIterator* aIter, mozilla::dom::RemoteDOMEvent* aResult); -#ifdef MOZ_CRASHREPORTER -typedef CrashReporter::ThreadId NativeThreadId; -#else // unused in this case typedef int32_t NativeThreadId; -#endif } // namespace dom } // namespace mozilla diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp index 953dae3c6..f8e75e299 100644 --- a/dom/media/gmp/GMPChild.cpp +++ b/dom/media/gmp/GMPChild.cpp @@ -257,10 +257,6 @@ GMPChild::Init(const nsAString& aPluginPath, return false; } -#ifdef MOZ_CRASHREPORTER - SendPCrashReporterConstructor(CrashReporter::CurrentThreadId()); -#endif - mPluginPath = aPluginPath; mSandboxVoucherPath = aVoucherPath; diff --git a/dom/media/gmp/GMPParent.cpp b/dom/media/gmp/GMPParent.cpp index 75468ea9a..00bc97777 100644 --- a/dom/media/gmp/GMPParent.cpp +++ b/dom/media/gmp/GMPParent.cpp @@ -29,12 +29,6 @@ using mozilla::dom::CrashReporterParent; using mozilla::ipc::GeckoChildProcessHost; -#ifdef MOZ_CRASHREPORTER -#include "nsPrintfCString.h" -using CrashReporter::AnnotationTable; -using CrashReporter::GetIDFromMinidump; -#endif - #include "mozilla/Telemetry.h" #ifdef XP_WIN @@ -224,10 +218,6 @@ GMPParent::AbortWaitingForGMPAsyncShutdown(nsITimer* aTimer, void* aClosure) NS_WARNING("Timed out waiting for GMP async shutdown!"); GMPParent* parent = reinterpret_cast<GMPParent*>(aClosure); MOZ_ASSERT(parent->mService); -#if defined(MOZ_CRASHREPORTER) - parent->mService->SetAsyncShutdownPluginState(parent, 'G', - NS_LITERAL_CSTRING("Timed out waiting for async shutdown")); -#endif parent->mService->AsyncShutdownComplete(parent); } @@ -270,22 +260,8 @@ GMPParent::RecvPGMPContentChildDestroyed() { --mGMPContentChildCount; if (!IsUsed()) { -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'E', - NS_LITERAL_CSTRING("Last content child destroyed")); - } -#endif CloseIfUnused(); } -#if defined(MOZ_CRASHREPORTER) - else { - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'F', - nsPrintfCString("Content child destroyed, remaining: %u", mGMPContentChildCount)); - } - } -#endif return true; } @@ -307,38 +283,14 @@ GMPParent::CloseIfUnused() if (mAsyncShutdownRequired) { if (!mAsyncShutdownInProgress) { LOGD("%s: sending async shutdown notification", __FUNCTION__); -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'H', - NS_LITERAL_CSTRING("Sent BeginAsyncShutdown")); - } -#endif mAsyncShutdownInProgress = true; if (!SendBeginAsyncShutdown()) { -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'I', - NS_LITERAL_CSTRING("Could not send BeginAsyncShutdown - Aborting async shutdown")); - } -#endif AbortAsyncShutdown(); } else if (NS_FAILED(EnsureAsyncShutdownTimeoutSet())) { -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'J', - NS_LITERAL_CSTRING("Could not start timer after sending BeginAsyncShutdown - Aborting async shutdown")); - } -#endif AbortAsyncShutdown(); } } } else { -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'K', - NS_LITERAL_CSTRING("No (more) async-shutdown required")); - } -#endif // No async-shutdown, kill async-shutdown timer started in CloseActive(). AbortAsyncShutdown(); // Any async shutdown must be complete. Shutdown GMPStorage. @@ -385,29 +337,11 @@ GMPParent::CloseActive(bool aDieWhenUnloaded) mState = GMPStateUnloading; } if (mState != GMPStateNotLoaded && IsUsed()) { -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'A', - nsPrintfCString("Sent CloseActive, content children to close: %u", mGMPContentChildCount)); - } -#endif if (!SendCloseActive()) { -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'B', - NS_LITERAL_CSTRING("Could not send CloseActive - Aborting async shutdown")); - } -#endif AbortAsyncShutdown(); } else if (IsUsed()) { // We're expecting RecvPGMPContentChildDestroyed's -> Start async-shutdown timer now if needed. if (mAsyncShutdownRequired && NS_FAILED(EnsureAsyncShutdownTimeoutSet())) { -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'C', - NS_LITERAL_CSTRING("Could not start timer after sending CloseActive - Aborting async shutdown")); - } -#endif AbortAsyncShutdown(); } } else { @@ -418,12 +352,6 @@ GMPParent::CloseActive(bool aDieWhenUnloaded) // that time, it might not have proceeded with shutdown; And calling it // again after shutdown is fine because after the first one we'll be in // GMPStateNotLoaded. -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'D', - NS_LITERAL_CSTRING("Content children already destroyed")); - } -#endif CloseIfUnused(); } } @@ -630,78 +558,10 @@ GMPParent::EnsureProcessLoaded() return NS_SUCCEEDED(rv); } -#ifdef MOZ_CRASHREPORTER -void -GMPParent::WriteExtraDataForMinidump(CrashReporter::AnnotationTable& notes) -{ - notes.Put(NS_LITERAL_CSTRING("GMPPlugin"), NS_LITERAL_CSTRING("1")); - notes.Put(NS_LITERAL_CSTRING("PluginFilename"), - NS_ConvertUTF16toUTF8(mName)); - notes.Put(NS_LITERAL_CSTRING("PluginName"), mDisplayName); - notes.Put(NS_LITERAL_CSTRING("PluginVersion"), mVersion); -} - -void -GMPParent::GetCrashID(nsString& aResult) -{ - CrashReporterParent* cr = - static_cast<CrashReporterParent*>(LoneManagedOrNullAsserts(ManagedPCrashReporterParent())); - if (NS_WARN_IF(!cr)) { - return; - } - - AnnotationTable notes(4); - WriteExtraDataForMinidump(notes); - nsCOMPtr<nsIFile> dumpFile; - TakeMinidump(getter_AddRefs(dumpFile), nullptr); - if (!dumpFile) { - NS_WARNING("GMP crash without crash report"); - aResult = mName; - aResult += '-'; - AppendUTF8toUTF16(mVersion, aResult); - return; - } - GetIDFromMinidump(dumpFile, aResult); - cr->GenerateCrashReportForMinidump(dumpFile, ¬es); -} - -static void -GMPNotifyObservers(const uint32_t aPluginID, const nsACString& aPluginName, const nsAString& aPluginDumpID) -{ - nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService(); - nsCOMPtr<nsIWritablePropertyBag2> propbag = - do_CreateInstance("@mozilla.org/hash-property-bag;1"); - if (obs && propbag) { - propbag->SetPropertyAsUint32(NS_LITERAL_STRING("pluginID"), aPluginID); - propbag->SetPropertyAsACString(NS_LITERAL_STRING("pluginName"), aPluginName); - propbag->SetPropertyAsAString(NS_LITERAL_STRING("pluginDumpID"), aPluginDumpID); - obs->NotifyObservers(propbag, "gmp-plugin-crash", nullptr); - } - - RefPtr<gmp::GeckoMediaPluginService> service = - gmp::GeckoMediaPluginService::GetGeckoMediaPluginService(); - if (service) { - service->RunPluginCrashCallbacks(aPluginID, aPluginName); - } -} -#endif void GMPParent::ActorDestroy(ActorDestroyReason aWhy) { LOGD("%s: (%d)", __FUNCTION__, (int)aWhy); -#ifdef MOZ_CRASHREPORTER - if (AbnormalShutdown == aWhy) { - Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT, - NS_LITERAL_CSTRING("gmplugin"), 1); - nsString dumpID; - GetCrashID(dumpID); - - // NotifyObservers is mainthread-only - NS_DispatchToMainThread(WrapRunnableNM(&GMPNotifyObservers, - mPluginId, mDisplayName, dumpID), - NS_DISPATCH_NORMAL); - } -#endif // warn us off trying to close again mState = GMPStateClosing; mAbnormalShutdownInProgress = true; @@ -711,12 +571,6 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy) if (AbnormalShutdown == aWhy) { RefPtr<GMPParent> self(this); if (mAsyncShutdownRequired) { -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'M', - NS_LITERAL_CSTRING("Actor destroyed")); - } -#endif mService->AsyncShutdownComplete(this); mAsyncShutdownRequired = false; } @@ -732,9 +586,7 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy) mozilla::dom::PCrashReporterParent* GMPParent::AllocPCrashReporterParent(const NativeThreadId& aThread) { -#ifndef MOZ_CRASHREPORTER MOZ_ASSERT(false, "Should only be sent if crash reporting is enabled."); -#endif CrashReporterParent* cr = new CrashReporterParent(); cr->SetChildData(aThread, GeckoProcessType_GMPlugin); return cr; @@ -1043,12 +895,6 @@ GMPParent::RecvAsyncShutdownComplete() LOGD("%s", __FUNCTION__); MOZ_ASSERT(mAsyncShutdownRequired); -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'L', - NS_LITERAL_CSTRING("Received AsyncShutdownComplete")); - } -#endif AbortAsyncShutdown(); return true; } diff --git a/dom/media/gmp/GMPParent.h b/dom/media/gmp/GMPParent.h index 91a6fb429..4f91ec5ba 100644 --- a/dom/media/gmp/GMPParent.h +++ b/dom/media/gmp/GMPParent.h @@ -25,17 +25,6 @@ class nsIThread; -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" - -namespace mozilla { -namespace dom { -class PCrashReporterParent; -class CrashReporterParent; -} -} -#endif - namespace mozilla { namespace gmp { @@ -177,10 +166,6 @@ private: RefPtr<GenericPromise> ReadGMPInfoFile(nsIFile* aFile); RefPtr<GenericPromise> ParseChromiumManifest(nsString aJSON); // Main thread. RefPtr<GenericPromise> ReadChromiumManifestFile(nsIFile* aFile); // GMP thread. -#ifdef MOZ_CRASHREPORTER - void WriteExtraDataForMinidump(CrashReporter::AnnotationTable& notes); - void GetCrashID(nsString& aResult); -#endif void ActorDestroy(ActorDestroyReason aWhy) override; PCrashReporterParent* AllocPCrashReporterParent(const NativeThreadId& aThread) override; diff --git a/dom/media/gmp/GMPServiceParent.cpp b/dom/media/gmp/GMPServiceParent.cpp index 8741989e3..f25c36811 100644 --- a/dom/media/gmp/GMPServiceParent.cpp +++ b/dom/media/gmp/GMPServiceParent.cpp @@ -36,10 +36,6 @@ #include "nsHashKeys.h" #include "nsIFile.h" #include "nsISimpleEnumerator.h" -#if defined(MOZ_CRASHREPORTER) -#include "nsExceptionHandler.h" -#include "nsPrintfCString.h" -#endif #include "nsIXULRuntime.h" #include "GMPDecoderModule.h" #include <limits> @@ -88,9 +84,6 @@ NS_IMPL_ISUPPORTS_INHERITED(GeckoMediaPluginServiceParent, GeckoMediaPluginServiceParent::GeckoMediaPluginServiceParent() : mShuttingDown(false) -#ifdef MOZ_CRASHREPORTER - , mAsyncShutdownPluginStatesMutex("GeckoMediaPluginService::mAsyncShutdownPluginStatesMutex") -#endif , mScannedPluginOnDisk(false) , mWaitingForPluginsSyncShutdown(false) , mInitPromiseMonitor("GeckoMediaPluginServiceParent::mInitPromiseMonitor") @@ -421,28 +414,16 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject, if (gmpThread) { LOGD(("%s::%s Starting to unload plugins, waiting for first sync shutdown..." , __CLASS__, __FUNCTION__)); -#ifdef MOZ_CRASHREPORTER - SetAsyncShutdownPluginState(nullptr, '0', - NS_LITERAL_CSTRING("Dispatching UnloadPlugins")); -#endif gmpThread->Dispatch( NewRunnableMethod(this, &GeckoMediaPluginServiceParent::UnloadPlugins), NS_DISPATCH_NORMAL); -#ifdef MOZ_CRASHREPORTER - SetAsyncShutdownPluginState(nullptr, '1', - NS_LITERAL_CSTRING("Waiting for sync shutdown")); -#endif // Wait for UnloadPlugins() to do initial sync shutdown... while (mWaitingForPluginsSyncShutdown) { NS_ProcessNextEvent(NS_GetCurrentThread(), true); } -#ifdef MOZ_CRASHREPORTER - SetAsyncShutdownPluginState(nullptr, '4', - NS_LITERAL_CSTRING("Waiting for async shutdown")); -#endif // Wait for other plugins (if any) to do async shutdown... auto syncShutdownPluginsRemaining = std::numeric_limits<decltype(mAsyncShutdownPlugins.Length())>::max(); @@ -452,10 +433,6 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject, if (mAsyncShutdownPlugins.IsEmpty()) { LOGD(("%s::%s Finished unloading all plugins" , __CLASS__, __FUNCTION__)); -#if defined(MOZ_CRASHREPORTER) - CrashReporter::RemoveCrashReportAnnotation( - NS_LITERAL_CSTRING("AsyncPluginShutdown")); -#endif break; } else if (mAsyncShutdownPlugins.Length() < syncShutdownPluginsRemaining) { // First time here, or number of pending plugins has decreased. @@ -463,24 +440,10 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject, syncShutdownPluginsRemaining = mAsyncShutdownPlugins.Length(); LOGD(("%s::%s Still waiting for %d plugins to shutdown..." , __CLASS__, __FUNCTION__, (int)syncShutdownPluginsRemaining)); -#if defined(MOZ_CRASHREPORTER) - nsAutoCString names; - for (const auto& plugin : mAsyncShutdownPlugins) { - if (!names.IsEmpty()) { names.Append(NS_LITERAL_CSTRING(", ")); } - names.Append(plugin->GetDisplayName()); - } - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("AsyncPluginShutdown"), - names); -#endif } } NS_ProcessNextEvent(NS_GetCurrentThread(), true); } -#ifdef MOZ_CRASHREPORTER - SetAsyncShutdownPluginState(nullptr, '5', - NS_LITERAL_CSTRING("Async shutdown complete")); -#endif } else { // GMP thread has already shutdown. MOZ_ASSERT(mPlugins.IsEmpty()); @@ -627,66 +590,6 @@ GeckoMediaPluginServiceParent::AsyncShutdownComplete(GMPParent* aParent) } } -#ifdef MOZ_CRASHREPORTER -void -GeckoMediaPluginServiceParent::SetAsyncShutdownPluginState(GMPParent* aGMPParent, - char aId, - const nsCString& aState) -{ - MutexAutoLock lock(mAsyncShutdownPluginStatesMutex); - if (!aGMPParent) { - mAsyncShutdownPluginStates.Update(NS_LITERAL_CSTRING("-"), - NS_LITERAL_CSTRING("-"), - aId, - aState); - return; - } - mAsyncShutdownPluginStates.Update(aGMPParent->GetDisplayName(), - nsPrintfCString("%p", aGMPParent), - aId, - aState); -} - -void -GeckoMediaPluginServiceParent::AsyncShutdownPluginStates::Update(const nsCString& aPlugin, - const nsCString& aInstance, - char aId, - const nsCString& aState) -{ - nsCString note; - StatesByInstance* instances = mStates.LookupOrAdd(aPlugin); - if (!instances) { return; } - State* state = instances->LookupOrAdd(aInstance); - if (!state) { return; } - state->mStateSequence += aId; - state->mLastStateDescription = aState; - note += '{'; - bool firstPlugin = true; - for (auto pluginIt = mStates.ConstIter(); !pluginIt.Done(); pluginIt.Next()) { - if (!firstPlugin) { note += ','; } else { firstPlugin = false; } - note += pluginIt.Key(); - note += ":{"; - bool firstInstance = true; - for (auto instanceIt = pluginIt.UserData()->ConstIter(); !instanceIt.Done(); instanceIt.Next()) { - if (!firstInstance) { note += ','; } else { firstInstance = false; } - note += instanceIt.Key(); - note += ":\""; - note += instanceIt.UserData()->mStateSequence; - note += '='; - note += instanceIt.UserData()->mLastStateDescription; - note += '"'; - } - note += '}'; - } - note += '}'; - LOGD(("%s::%s states[%s][%s]='%c'/'%s' -> %s", __CLASS__, __FUNCTION__, - aPlugin.get(), aInstance.get(), aId, aState.get(), note.get())); - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("AsyncPluginShutdownStates"), - note); -} -#endif // MOZ_CRASHREPORTER - void GeckoMediaPluginServiceParent::NotifyAsyncShutdownComplete() { @@ -714,10 +617,6 @@ GeckoMediaPluginServiceParent::UnloadPlugins() MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread); MOZ_ASSERT(!mShuttingDownOnGMPThread); mShuttingDownOnGMPThread = true; -#ifdef MOZ_CRASHREPORTER - SetAsyncShutdownPluginState(nullptr, '2', - NS_LITERAL_CSTRING("Starting to unload plugins")); -#endif nsTArray<RefPtr<GMPParent>> plugins; { @@ -742,17 +641,9 @@ GeckoMediaPluginServiceParent::UnloadPlugins() // Note: CloseActive may be async; it could actually finish // shutting down when all the plugins have unloaded. for (const auto& plugin : plugins) { -#ifdef MOZ_CRASHREPORTER - SetAsyncShutdownPluginState(plugin, 'S', - NS_LITERAL_CSTRING("CloseActive")); -#endif plugin->CloseActive(true); } -#ifdef MOZ_CRASHREPORTER - SetAsyncShutdownPluginState(nullptr, '3', - NS_LITERAL_CSTRING("Dispatching sync-shutdown-complete")); -#endif nsCOMPtr<nsIRunnable> task(NewRunnableMethod( this, &GeckoMediaPluginServiceParent::NotifySyncShutdownComplete)); NS_DispatchToMainThread(task); diff --git a/dom/media/gmp/GMPServiceParent.h b/dom/media/gmp/GMPServiceParent.h index f3f43e215..49d81055b 100644 --- a/dom/media/gmp/GMPServiceParent.h +++ b/dom/media/gmp/GMPServiceParent.h @@ -54,9 +54,6 @@ public: void AsyncShutdownComplete(GMPParent* aParent); int32_t AsyncShutdownTimeoutMs(); -#ifdef MOZ_CRASHREPORTER - void SetAsyncShutdownPluginState(GMPParent* aGMPParent, char aId, const nsCString& aState); -#endif // MOZ_CRASHREPORTER RefPtr<GenericPromise> EnsureInitialized(); RefPtr<GenericPromise> AsyncAddPluginDirectory(const nsAString& aDirectory); @@ -169,21 +166,6 @@ private: bool mShuttingDown; nsTArray<RefPtr<GMPParent>> mAsyncShutdownPlugins; -#ifdef MOZ_CRASHREPORTER - Mutex mAsyncShutdownPluginStatesMutex; // Protects mAsyncShutdownPluginStates. - class AsyncShutdownPluginStates - { - public: - void Update(const nsCString& aPlugin, const nsCString& aInstance, - char aId, const nsCString& aState); - private: - struct State { nsCString mStateSequence; nsCString mLastStateDescription; }; - typedef nsClassHashtable<nsCStringHashKey, State> StatesByInstance; - typedef nsClassHashtable<nsCStringHashKey, StatesByInstance> StateInstancesByPlugin; - StateInstancesByPlugin mStates; - } mAsyncShutdownPluginStates; -#endif // MOZ_CRASHREPORTER - // True if we've inspected MOZ_GMP_PATH on the GMP thread and loaded any // plugins found there into mPlugins. Atomic<bool> mScannedPluginOnDisk; diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp index bd71d6f65..916bdea0f 100644 --- a/dom/plugins/base/nsPluginHost.cpp +++ b/dom/plugins/base/nsPluginHost.cpp @@ -109,10 +109,6 @@ #define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args) #endif -#if MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif - #include "npapi.h" using namespace mozilla; @@ -962,12 +958,6 @@ nsPluginHost::TrySetUpPluginInstance(const nsACString &aMimeType, plugin->GetLibrary()->SetHasLocalInstance(); -#if defined(MOZ_WIDGET_ANDROID) && defined(MOZ_CRASHREPORTER) - if (pluginTag->mIsFlashPlugin) { - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FlashVersion"), pluginTag->Version()); - } -#endif - RefPtr<nsNPAPIPluginInstance> instance = new nsNPAPIPluginInstance(); // This will create the owning reference. The connection must be made between the diff --git a/dom/plugins/base/nsPluginsDirDarwin.cpp b/dom/plugins/base/nsPluginsDirDarwin.cpp index 6edc4fd6a..0085eec0d 100644 --- a/dom/plugins/base/nsPluginsDirDarwin.cpp +++ b/dom/plugins/base/nsPluginsDirDarwin.cpp @@ -26,9 +26,6 @@ #include "mozilla/UniquePtr.h" #include "nsCocoaFeatures.h" -#if defined(MOZ_CRASHREPORTER) -#include "nsExceptionHandler.h" -#endif #include <string.h> #include <stdio.h> @@ -487,14 +484,6 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary) NS_WARNING(msg.get()); return NS_ERROR_FAILURE; } -#if defined(MOZ_CRASHREPORTER) - // The block above assumes that "fbplugin" is the filename of the plugin - // to be blocked, or that the filename starts with "fbplugin_". But we - // don't yet know for sure if this is always true. So for the time being - // record extra information in our crash logs. - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Bug_1086977"), - fileName); -#endif } // It's possible that our plugin has 2 entry points that'll give us mime type @@ -504,14 +493,6 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary) // Sadly we have to load the library for this to work. rv = LoadPlugin(outLibrary); -#if defined(MOZ_CRASHREPORTER) - if (nsCocoaFeatures::OnYosemiteOrLater()) { - // If we didn't crash in LoadPlugin(), change the previous annotation so we - // don't sow confusion. - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Bug_1086977"), - NS_LITERAL_CSTRING("Didn't crash, please ignore")); - } -#endif if (NS_FAILED(rv)) return rv; diff --git a/dom/plugins/ipc/PluginMessageUtils.h b/dom/plugins/ipc/PluginMessageUtils.h index 55be59d62..4532fac93 100644 --- a/dom/plugins/ipc/PluginMessageUtils.h +++ b/dom/plugins/ipc/PluginMessageUtils.h @@ -23,9 +23,6 @@ #include "nsTArray.h" #include "mozilla/Logging.h" #include "nsHashKeys.h" -#ifdef MOZ_CRASHREPORTER -# include "nsExceptionHandler.h" -#endif #ifdef XP_MACOSX #include "PluginInterposeOSX.h" #else diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index 84dc7c71f..7350a7fa7 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -753,10 +753,6 @@ PluginModuleChild::AnswerPCrashReporterConstructor( mozilla::dom::NativeThreadId* id, uint32_t* processType) { -#ifdef MOZ_CRASHREPORTER - *id = CrashReporter::CurrentThreadId(); - *processType = XRE_GetProcessType(); -#endif return true; } diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index b85a3e94b..73f9c1025 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -74,12 +74,6 @@ using namespace mozilla; using namespace mozilla::plugins; using namespace mozilla::plugins::parent; -#ifdef MOZ_CRASHREPORTER -#include "mozilla/dom/CrashReporterParent.h" - -using namespace CrashReporter; -#endif - static const char kContentTimeoutPref[] = "dom.ipc.plugins.contentTimeoutSecs"; static const char kChildTimeoutPref[] = "dom.ipc.plugins.timeoutSecs"; static const char kParentTimeoutPref[] = "dom.ipc.plugins.parentTimeoutSecs"; @@ -134,66 +128,6 @@ mozilla::plugins::SetupBridge(uint32_t aPluginId, return true; } -#ifdef MOZ_CRASHREPORTER_INJECTOR - -/** - * Use for executing CreateToolhelp32Snapshot off main thread - */ -class mozilla::plugins::FinishInjectorInitTask : public mozilla::CancelableRunnable -{ -public: - FinishInjectorInitTask() - : mMutex("FlashInjectorInitTask::mMutex") - , mParent(nullptr) - , mMainThreadMsgLoop(MessageLoop::current()) - { - MOZ_ASSERT(NS_IsMainThread()); - } - - void Init(PluginModuleChromeParent* aParent) - { - MOZ_ASSERT(aParent); - mParent = aParent; - } - - void PostToMainThread() - { - RefPtr<Runnable> self = this; - mSnapshot.own(CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)); - { // Scope for lock - mozilla::MutexAutoLock lock(mMutex); - if (mMainThreadMsgLoop) { - mMainThreadMsgLoop->PostTask(self.forget()); - } - } - } - - NS_IMETHOD Run() override - { - mParent->DoInjection(mSnapshot); - // We don't need to hold this lock during DoInjection, but we do need - // to obtain it before returning from Run() to ensure that - // PostToMainThread has completed before we return. - mozilla::MutexAutoLock lock(mMutex); - return NS_OK; - } - - nsresult Cancel() override - { - mozilla::MutexAutoLock lock(mMutex); - mMainThreadMsgLoop = nullptr; - return NS_OK; - } - -private: - mozilla::Mutex mMutex; - nsAutoHandle mSnapshot; - PluginModuleChromeParent* mParent; - MessageLoop* mMainThreadMsgLoop; -}; - -#endif // MOZ_CRASHREPORTER_INJECTOR - namespace { /** @@ -578,29 +512,6 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded) RegisterSettingsCallbacks(); -#ifdef MOZ_CRASHREPORTER - // If this fails, we're having IPC troubles, and we're doomed anyways. - if (!CrashReporterParent::CreateCrashReporter(this)) { - mShutdown = true; - Close(); - OnInitFailure(); - return; - } - CrashReporterParent* crashReporter = CrashReporter(); - if (crashReporter) { - crashReporter->AnnotateCrashReport(NS_LITERAL_CSTRING("AsyncPluginInit"), - mIsStartingAsync ? - NS_LITERAL_CSTRING("1") : - NS_LITERAL_CSTRING("0")); - } -#ifdef XP_WIN - { // Scope for lock - mozilla::MutexAutoLock lock(mCrashReporterMutex); - mCrashReporter = CrashReporter(); - } -#endif -#endif - #if defined(XP_WIN) && defined(_X86_) // Protected mode only applies to Windows and only to x86. if (!mIsBlocklisted && mIsFlashPlugin && @@ -686,12 +597,6 @@ PluginModuleParent::PluginModuleParent(bool aIsChrome, bool aAllowAsyncInit) , mIsNPShutdownPending(false) , mAsyncNewRv(NS_ERROR_NOT_INITIALIZED) { -#if defined(MOZ_CRASHREPORTER) - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AsyncPluginInit"), - mIsStartingAsync ? - NS_LITERAL_CSTRING("1") : - NS_LITERAL_CSTRING("0")); -#endif } PluginModuleParent::~PluginModuleParent() @@ -734,15 +639,6 @@ PluginModuleChromeParent::PluginModuleChromeParent(const char* aFilePath, , mHangUIParent(nullptr) , mHangUIEnabled(true) , mIsTimerReset(true) -#ifdef MOZ_CRASHREPORTER - , mCrashReporterMutex("PluginModuleChromeParent::mCrashReporterMutex") - , mCrashReporter(nullptr) -#endif -#endif -#ifdef MOZ_CRASHREPORTER_INJECTOR - , mFlashProcess1(0) - , mFlashProcess2(0) - , mFinishInitTask(nullptr) #endif , mInitOnAsyncConnect(false) , mAsyncInitRv(NS_ERROR_NOT_INITIALIZED) @@ -790,17 +686,6 @@ PluginModuleChromeParent::~PluginModuleChromeParent() mSubprocess = nullptr; } -#ifdef MOZ_CRASHREPORTER_INJECTOR - if (mFlashProcess1) - UnregisterInjectorCallback(mFlashProcess1); - if (mFlashProcess2) - UnregisterInjectorCallback(mFlashProcess2); - if (mFinishInitTask) { - // mFinishInitTask will be deleted by the main thread message_loop - mFinishInitTask->Cancel(); - } -#endif - UnregisterSettingsCallbacks(); Preferences::UnregisterCallback(TimeoutChanged, kChildTimeoutPref, this); @@ -818,52 +703,6 @@ PluginModuleChromeParent::~PluginModuleChromeParent() mozilla::HangMonitor::UnregisterAnnotator(*this); } -#ifdef MOZ_CRASHREPORTER -void -PluginModuleChromeParent::WriteExtraDataForMinidump(AnnotationTable& notes) -{ -#ifdef XP_WIN - // mCrashReporterMutex is already held by the caller - mCrashReporterMutex.AssertCurrentThreadOwns(); -#endif - typedef nsDependentCString CS; - - // Get the plugin filename, try to get just the file leafname - const std::string& pluginFile = mSubprocess->GetPluginFilePath(); - size_t filePos = pluginFile.rfind(FILE_PATH_SEPARATOR); - if (filePos == std::string::npos) - filePos = 0; - else - filePos++; - notes.Put(NS_LITERAL_CSTRING("PluginFilename"), CS(pluginFile.substr(filePos).c_str())); - - notes.Put(NS_LITERAL_CSTRING("PluginName"), mPluginName); - notes.Put(NS_LITERAL_CSTRING("PluginVersion"), mPluginVersion); - - CrashReporterParent* crashReporter = CrashReporter(); - if (crashReporter) { -#ifdef XP_WIN - if (mPluginCpuUsageOnHang.Length() > 0) { - notes.Put(NS_LITERAL_CSTRING("NumberOfProcessors"), - nsPrintfCString("%d", PR_GetNumberOfProcessors())); - - nsCString cpuUsageStr; - cpuUsageStr.AppendFloat(std::ceil(mPluginCpuUsageOnHang[0] * 100) / 100); - notes.Put(NS_LITERAL_CSTRING("PluginCpuUsage"), cpuUsageStr); - -#ifdef MOZ_CRASHREPORTER_INJECTOR - for (uint32_t i=1; i<mPluginCpuUsageOnHang.Length(); ++i) { - nsCString tempStr; - tempStr.AppendFloat(std::ceil(mPluginCpuUsageOnHang[i] * 100) / 100); - notes.Put(nsPrintfCString("CpuUsageFlashProcess%d", i), tempStr); - } -#endif - } -#endif - } -} -#endif // MOZ_CRASHREPORTER - void PluginModuleParent::SetChildTimeout(const int32_t aChildTimeout) { @@ -1123,20 +962,6 @@ PluginModuleChromeParent::AnnotateHang(mozilla::HangMonitor::HangAnnotations& aA } } -#ifdef MOZ_CRASHREPORTER -static bool -CreatePluginMinidump(base::ProcessId processId, ThreadId childThread, - nsIFile* parentMinidump, const nsACString& name) -{ - mozilla::ipc::ScopedProcessHandle handle; - if (processId == 0 || - !base::OpenPrivilegedProcessHandle(processId, &handle.rwget())) { - return false; - } - return CreateAdditionalChildMinidump(handle, 0, parentMinidump, name); -} -#endif - bool PluginModuleChromeParent::ShouldContinueFromReplyTimeout() { @@ -1184,87 +1009,7 @@ PluginModuleChromeParent::TakeFullMinidump(base::ProcessId aContentPid, const nsAString& aBrowserDumpId, nsString& aDumpId) { -#ifdef MOZ_CRASHREPORTER -#ifdef XP_WIN - mozilla::MutexAutoLock lock(mCrashReporterMutex); -#endif // XP_WIN - - CrashReporterParent* crashReporter = CrashReporter(); - if (!crashReporter) { - return; - } - - bool reportsReady = false; - - // Check to see if we already have a browser dump id - with e10s plugin - // hangs we take this earlier (see ProcessHangMonitor) from a background - // thread. We do this before we message the main thread about the hang - // since the posted message will trash our browser stack state. - bool exists; - nsCOMPtr<nsIFile> browserDumpFile; - if (!aBrowserDumpId.IsEmpty() && - CrashReporter::GetMinidumpForID(aBrowserDumpId, getter_AddRefs(browserDumpFile)) && - browserDumpFile && - NS_SUCCEEDED(browserDumpFile->Exists(&exists)) && exists) - { - // We have a single browser report, generate a new plugin process parent - // report and pair it up with the browser report handed in. - reportsReady = crashReporter->GenerateMinidumpAndPair(this, browserDumpFile, - NS_LITERAL_CSTRING("browser")); - if (!reportsReady) { - browserDumpFile = nullptr; - CrashReporter::DeleteMinidumpFilesForID(aBrowserDumpId); - } - } - - // Generate crash report including plugin and browser process minidumps. - // The plugin process is the parent report with additional dumps including - // the browser process, content process when running under e10s, and - // various flash subprocesses if we're the flash module. - if (!reportsReady) { - reportsReady = crashReporter->GeneratePairedMinidump(this); - } - - if (reportsReady) { - // Important to set this here, it tells the ActorDestroy handler - // that we have an existing crash report that needs to be finalized. - mPluginDumpID = crashReporter->ChildDumpID(); - aDumpId = mPluginDumpID; - PLUGIN_LOG_DEBUG( - ("generated paired browser/plugin minidumps: %s)", - NS_ConvertUTF16toUTF8(mPluginDumpID).get())); - nsAutoCString additionalDumps("browser"); - nsCOMPtr<nsIFile> pluginDumpFile; - if (GetMinidumpForID(mPluginDumpID, getter_AddRefs(pluginDumpFile)) && - pluginDumpFile) { -#ifdef MOZ_CRASHREPORTER_INJECTOR - // If we have handles to the flash sandbox processes on Windows, - // include those minidumps as well. - if (CreatePluginMinidump(mFlashProcess1, 0, pluginDumpFile, - NS_LITERAL_CSTRING("flash1"))) { - additionalDumps.AppendLiteral(",flash1"); - } - if (CreatePluginMinidump(mFlashProcess2, 0, pluginDumpFile, - NS_LITERAL_CSTRING("flash2"))) { - additionalDumps.AppendLiteral(",flash2"); - } -#endif // MOZ_CRASHREPORTER_INJECTOR - if (aContentPid != mozilla::ipc::kInvalidProcessId) { - // Include the content process minidump - if (CreatePluginMinidump(aContentPid, 0, - pluginDumpFile, - NS_LITERAL_CSTRING("content"))) { - additionalDumps.AppendLiteral(",content"); - } - } - } - crashReporter->AnnotateCrashReport( - NS_LITERAL_CSTRING("additional_minidumps"), - additionalDumps); - } else { - NS_WARNING("failed to capture paired minidumps from hang"); - } -#endif // MOZ_CRASHREPORTER + /*** STUB ***/ } void @@ -1273,43 +1018,6 @@ PluginModuleChromeParent::TerminateChildProcess(MessageLoop* aMsgLoop, const nsCString& aMonitorDescription, const nsAString& aDumpId) { -#ifdef MOZ_CRASHREPORTER - // Start by taking a full minidump if necessary, this is done early - // because it also needs to lock the mCrashReporterMutex and Mutex doesn't - // support recrusive locking. - nsAutoString dumpId; - if (aDumpId.IsEmpty()) { - TakeFullMinidump(aContentPid, EmptyString(), dumpId); - } - -#ifdef XP_WIN - mozilla::MutexAutoLock lock(mCrashReporterMutex); - CrashReporterParent* crashReporter = mCrashReporter; - if (!crashReporter) { - // If mCrashReporter is null then the hang has ended, the plugin module - // is shutting down. There's nothing to do here. - return; - } -#else - CrashReporterParent* crashReporter = CrashReporter(); -#endif // XP_WIN - crashReporter->AnnotateCrashReport(NS_LITERAL_CSTRING("PluginHang"), - NS_LITERAL_CSTRING("1")); - crashReporter->AnnotateCrashReport(NS_LITERAL_CSTRING("HangMonitorDescription"), - aMonitorDescription); -#ifdef XP_WIN - if (mHangUIParent) { - unsigned int hangUIDuration = mHangUIParent->LastShowDurationMs(); - if (hangUIDuration) { - nsPrintfCString strHangUIDuration("%u", hangUIDuration); - crashReporter->AnnotateCrashReport( - NS_LITERAL_CSTRING("PluginHangUIDuration"), - strHangUIDuration); - } - } -#endif // XP_WIN -#endif // MOZ_CRASHREPORTER - mozilla::ipc::ScopedProcessHandle geckoChildProcess; bool childOpened = base::OpenProcessHandle(OtherPid(), &geckoChildProcess.rwget()); @@ -1323,19 +1031,6 @@ PluginModuleChromeParent::TerminateChildProcess(MessageLoop* aMsgLoop, processHandles.AppendElement(geckoChildProcess); } -#ifdef MOZ_CRASHREPORTER_INJECTOR - mozilla::ipc::ScopedProcessHandle flashBrokerProcess; - if (mFlashProcess1 && - base::OpenProcessHandle(mFlashProcess1, &flashBrokerProcess.rwget())) { - processHandles.AppendElement(flashBrokerProcess); - } - mozilla::ipc::ScopedProcessHandle flashSandboxProcess; - if (mFlashProcess2 && - base::OpenProcessHandle(mFlashProcess2, &flashSandboxProcess.rwget())) { - processHandles.AppendElement(flashSandboxProcess); - } -#endif - if (!GetProcessCpuUsage(processHandles, mPluginCpuUsageOnHang)) { mPluginCpuUsageOnHang.Clear(); } @@ -1482,108 +1177,6 @@ PluginModuleChromeParent::OnHangUIContinue() } #endif // XP_WIN -#ifdef MOZ_CRASHREPORTER -CrashReporterParent* -PluginModuleChromeParent::CrashReporter() -{ - return static_cast<CrashReporterParent*>(LoneManagedOrNullAsserts(ManagedPCrashReporterParent())); -} - -#ifdef MOZ_CRASHREPORTER_INJECTOR -static void -RemoveMinidump(nsIFile* minidump) -{ - if (!minidump) - return; - - minidump->Remove(false); - nsCOMPtr<nsIFile> extraFile; - if (GetExtraFileForMinidump(minidump, - getter_AddRefs(extraFile))) { - extraFile->Remove(true); - } -} -#endif // MOZ_CRASHREPORTER_INJECTOR - -void -PluginModuleChromeParent::ProcessFirstMinidump() -{ -#ifdef XP_WIN - mozilla::MutexAutoLock lock(mCrashReporterMutex); -#endif - CrashReporterParent* crashReporter = CrashReporter(); - if (!crashReporter) - return; - - AnnotationTable notes(4); - WriteExtraDataForMinidump(notes); - - if (!mPluginDumpID.IsEmpty()) { - // mPluginDumpID may be set in TerminateChildProcess, which means the - // process hang monitor has already collected a 3-way browser, plugin, - // content crash report. If so, update the existing report with our - // annotations and finalize it. If not, fall through for standard - // plugin crash report handling. - crashReporter->GenerateChildData(¬es); - crashReporter->FinalizeChildData(); - return; - } - - uint32_t sequence = UINT32_MAX; - nsCOMPtr<nsIFile> dumpFile; - nsAutoCString flashProcessType; - TakeMinidump(getter_AddRefs(dumpFile), &sequence); - -#ifdef MOZ_CRASHREPORTER_INJECTOR - nsCOMPtr<nsIFile> childDumpFile; - uint32_t childSequence; - - if (mFlashProcess1 && - TakeMinidumpForChild(mFlashProcess1, - getter_AddRefs(childDumpFile), - &childSequence)) { - if (childSequence < sequence) { - RemoveMinidump(dumpFile); - dumpFile = childDumpFile; - sequence = childSequence; - flashProcessType.AssignLiteral("Broker"); - } - else { - RemoveMinidump(childDumpFile); - } - } - if (mFlashProcess2 && - TakeMinidumpForChild(mFlashProcess2, - getter_AddRefs(childDumpFile), - &childSequence)) { - if (childSequence < sequence) { - RemoveMinidump(dumpFile); - dumpFile = childDumpFile; - sequence = childSequence; - flashProcessType.AssignLiteral("Sandbox"); - } - else { - RemoveMinidump(childDumpFile); - } - } -#endif - - if (!dumpFile) { - NS_WARNING("[PluginModuleParent::ActorDestroy] abnormal shutdown without minidump!"); - return; - } - - PLUGIN_LOG_DEBUG(("got child minidump: %s", - NS_ConvertUTF16toUTF8(mPluginDumpID).get())); - - GetIDFromMinidump(dumpFile, mPluginDumpID); - if (!flashProcessType.IsEmpty()) { - notes.Put(NS_LITERAL_CSTRING("FlashProcessDump"), flashProcessType); - } - crashReporter->GenerateCrashReportForMinidump(dumpFile, ¬es); -} -#endif - void PluginModuleParent::ActorDestroy(ActorDestroyReason why) { @@ -1621,9 +1214,6 @@ void PluginModuleChromeParent::ActorDestroy(ActorDestroyReason why) { if (why == AbnormalShutdown) { -#ifdef MOZ_CRASHREPORTER - ProcessFirstMinidump(); -#endif Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT, NS_LITERAL_CSTRING("plugin"), 1); } @@ -2405,9 +1995,6 @@ PluginModuleChromeParent::RecvNP_InitializeResult(const NPError& aError) } #endif -#ifdef MOZ_CRASHREPORTER_INJECTOR - InitializeInjector(); -#endif } return PluginModuleParent::RecvNP_InitializeResult(aError) && ok; @@ -2955,24 +2542,12 @@ PCrashReporterParent* PluginModuleChromeParent::AllocPCrashReporterParent(mozilla::dom::NativeThreadId* id, uint32_t* processType) { -#ifdef MOZ_CRASHREPORTER - return new CrashReporterParent(); -#else return nullptr; -#endif } bool PluginModuleChromeParent::DeallocPCrashReporterParent(PCrashReporterParent* actor) { -#ifdef MOZ_CRASHREPORTER -#ifdef XP_WIN - mozilla::MutexAutoLock lock(mCrashReporterMutex); - if (actor == static_cast<PCrashReporterParent*>(mCrashReporter)) { - mCrashReporter = nullptr; - } -#endif -#endif delete actor; return true; } @@ -3134,107 +2709,6 @@ PluginModuleParent::AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges( return true; } -#ifdef MOZ_CRASHREPORTER_INJECTOR - -// We only add the crash reporter to subprocess which have the filename -// FlashPlayerPlugin* -#define FLASH_PROCESS_PREFIX "FLASHPLAYERPLUGIN" - -static DWORD -GetFlashChildOfPID(DWORD pid, HANDLE snapshot) -{ - PROCESSENTRY32 entry = { - sizeof(entry) - }; - for (BOOL ok = Process32First(snapshot, &entry); - ok; - ok = Process32Next(snapshot, &entry)) { - if (entry.th32ParentProcessID == pid) { - nsString name(entry.szExeFile); - ToUpperCase(name); - if (StringBeginsWith(name, NS_LITERAL_STRING(FLASH_PROCESS_PREFIX))) { - return entry.th32ProcessID; - } - } - } - return 0; -} - -// We only look for child processes of the Flash plugin, NPSWF* -#define FLASH_PLUGIN_PREFIX "NPSWF" - -void -PluginModuleChromeParent::InitializeInjector() -{ - if (!Preferences::GetBool("dom.ipc.plugins.flash.subprocess.crashreporter.enabled", false)) - return; - - nsCString path(Process()->GetPluginFilePath().c_str()); - ToUpperCase(path); - int32_t lastSlash = path.RFindCharInSet("\\/"); - if (kNotFound == lastSlash) - return; - - if (!StringBeginsWith(Substring(path, lastSlash + 1), - NS_LITERAL_CSTRING(FLASH_PLUGIN_PREFIX))) - return; - - TimeStamp th32Start = TimeStamp::Now(); - mFinishInitTask = mChromeTaskFactory.NewTask<FinishInjectorInitTask>(); - mFinishInitTask->Init(this); - if (!::QueueUserWorkItem(&PluginModuleChromeParent::GetToolhelpSnapshot, - mFinishInitTask, WT_EXECUTEDEFAULT)) { - mFinishInitTask = nullptr; - return; - } - TimeStamp th32End = TimeStamp::Now(); - mTimeBlocked += (th32End - th32Start); -} - -void -PluginModuleChromeParent::DoInjection(const nsAutoHandle& aSnapshot) -{ - DWORD pluginProcessPID = GetProcessId(Process()->GetChildProcessHandle()); - mFlashProcess1 = GetFlashChildOfPID(pluginProcessPID, aSnapshot); - if (mFlashProcess1) { - InjectCrashReporterIntoProcess(mFlashProcess1, this); - - mFlashProcess2 = GetFlashChildOfPID(mFlashProcess1, aSnapshot); - if (mFlashProcess2) { - InjectCrashReporterIntoProcess(mFlashProcess2, this); - } - } - mFinishInitTask = nullptr; -} - -DWORD WINAPI -PluginModuleChromeParent::GetToolhelpSnapshot(LPVOID aContext) -{ - FinishInjectorInitTask* task = static_cast<FinishInjectorInitTask*>(aContext); - MOZ_ASSERT(task); - task->PostToMainThread(); - return 0; -} - -void -PluginModuleChromeParent::OnCrash(DWORD processID) -{ - if (!mShutdown) { - GetIPCChannel()->CloseWithError(); - mozilla::ipc::ScopedProcessHandle geckoPluginChild; - if (base::OpenProcessHandle(OtherPid(), &geckoPluginChild.rwget())) { - if (!base::KillProcess(geckoPluginChild, - base::PROCESS_END_KILLED_BY_USER, false)) { - NS_ERROR("May have failed to kill child process."); - } - } else { - NS_ERROR("Failed to open child process when attempting kill."); - } - } -} - -#endif // MOZ_CRASHREPORTER_INJECTOR - #ifdef MOZ_ENABLE_PROFILER_SPS class PluginProfilerObserver final : public nsIObserver, public nsSupportsWeakReference diff --git a/dom/plugins/ipc/PluginModuleParent.h b/dom/plugins/ipc/PluginModuleParent.h index cc24d6ed2..946d4c236 100644 --- a/dom/plugins/ipc/PluginModuleParent.h +++ b/dom/plugins/ipc/PluginModuleParent.h @@ -26,10 +26,6 @@ #include "nsWindowsHelpers.h" #endif -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif - class nsIProfileSaveEvent; class nsPluginTag; @@ -56,9 +52,6 @@ class PluginInstanceParent; #ifdef XP_WIN class PluginHangUIParent; #endif -#ifdef MOZ_CRASHREPORTER_INJECTOR -class FinishInjectorInitTask; -#endif /** * PluginModuleParent @@ -80,9 +73,6 @@ class FinishInjectorInitTask; class PluginModuleParent : public PPluginModuleParent , public PluginLibrary -#ifdef MOZ_CRASHREPORTER_INJECTOR - , public CrashReporter::InjectorCrashCallback -#endif { protected: typedef mozilla::PluginLibrary PluginLibrary; @@ -395,10 +385,6 @@ class PluginModuleContentParent : public PluginModuleParent virtual bool ShouldContinueFromReplyTimeout() override; virtual void OnExitedSyncSend() override; -#ifdef MOZ_CRASHREPORTER_INJECTOR - void OnCrash(DWORD processID) override {} -#endif - static PluginModuleContentParent* sSavedModuleParent; uint32_t mPluginId; @@ -522,11 +508,6 @@ private: virtual bool ShouldContinueFromReplyTimeout() override; -#ifdef MOZ_CRASHREPORTER - void ProcessFirstMinidump(); - void WriteExtraDataForMinidump(CrashReporter::AnnotationTable& notes); -#endif - virtual PCrashReporterParent* AllocPCrashReporterParent(mozilla::dom::NativeThreadId* id, uint32_t* processType) override; @@ -594,17 +575,6 @@ private: PluginHangUIParent *mHangUIParent; bool mHangUIEnabled; bool mIsTimerReset; -#ifdef MOZ_CRASHREPORTER - /** - * This mutex protects the crash reporter when the Plugin Hang UI event - * handler is executing off main thread. It is intended to protect both - * the mCrashReporter variable in addition to the CrashReporterParent object - * that mCrashReporter refers to. - */ - mozilla::Mutex mCrashReporterMutex; - CrashReporterParent* mCrashReporter; -#endif // MOZ_CRASHREPORTER - /** * Launches the Plugin Hang UI. @@ -626,20 +596,6 @@ private: friend class mozilla::dom::CrashReporterParent; friend class mozilla::plugins::PluginAsyncSurrogate; -#ifdef MOZ_CRASHREPORTER_INJECTOR - friend class mozilla::plugins::FinishInjectorInitTask; - - void InitializeInjector(); - void DoInjection(const nsAutoHandle& aSnapshot); - static DWORD WINAPI GetToolhelpSnapshot(LPVOID aContext); - - void OnCrash(DWORD processID) override; - - DWORD mFlashProcess1; - DWORD mFlashProcess2; - RefPtr<mozilla::plugins::FinishInjectorInitTask> mFinishInitTask; -#endif - void OnProcessLaunched(const bool aSucceeded); class LaunchedTask : public LaunchCompleteTask diff --git a/dom/promise/Promise.cpp b/dom/promise/Promise.cpp index bf1fa5f50..00b78143e 100644 --- a/dom/promise/Promise.cpp +++ b/dom/promise/Promise.cpp @@ -38,9 +38,6 @@ #include "WorkerRunnable.h" #include "WrapperFactory.h" #include "xpcpublic.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif namespace mozilla { namespace dom { diff --git a/gfx/gl/GfxTexturesReporter.cpp b/gfx/gl/GfxTexturesReporter.cpp index 8007fe6b1..d2ca70d27 100644 --- a/gfx/gl/GfxTexturesReporter.cpp +++ b/gfx/gl/GfxTexturesReporter.cpp @@ -9,10 +9,6 @@ #include "GfxTexturesReporter.h" #include "gfxPrefs.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif - using namespace mozilla; using namespace mozilla::gl; @@ -75,8 +71,4 @@ GfxTexturesReporter::UpdateAmount(MemoryUse action, size_t amount) } } } - -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateTexturesSize(sAmount); -#endif } diff --git a/gfx/ipc/GPUChild.cpp b/gfx/ipc/GPUChild.cpp index 72328ac0b..3c2797683 100644 --- a/gfx/ipc/GPUChild.cpp +++ b/gfx/ipc/GPUChild.cpp @@ -121,9 +121,6 @@ GPUChild::RecvGraphicsError(const nsCString& aError) bool GPUChild::RecvInitCrashReporter(Shmem&& aShmem) { -#ifdef MOZ_CRASHREPORTER - mCrashReporter = MakeUnique<ipc::CrashReporterHost>(GeckoProcessType_GPU, aShmem); -#endif return true; } @@ -163,12 +160,6 @@ void GPUChild::ActorDestroy(ActorDestroyReason aWhy) { if (aWhy == AbnormalShutdown) { -#ifdef MOZ_CRASHREPORTER - if (mCrashReporter) { - mCrashReporter->GenerateCrashReport(OtherPid()); - mCrashReporter = nullptr; - } -#endif Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT, nsDependentCString(XRE_ChildProcessTypeToString(GeckoProcessType_GPU), 1)); } diff --git a/gfx/ipc/GPUParent.cpp b/gfx/ipc/GPUParent.cpp index d63e17e2f..896c7b36b 100644 --- a/gfx/ipc/GPUParent.cpp +++ b/gfx/ipc/GPUParent.cpp @@ -82,11 +82,6 @@ GPUParent::Init(base::ProcessId aParentPid, nsDebugImpl::SetMultiprocessMode("GPU"); -#ifdef MOZ_CRASHREPORTER - // Init crash reporter support. - CrashReporterClient::InitSingleton(this); -#endif - // Ensure gfxPrefs are initialized. gfxPrefs::GetSingleton(); gfxConfig::Init(); @@ -380,9 +375,6 @@ GPUParent::ActorDestroy(ActorDestroyReason aWhy) gfxVars::Shutdown(); gfxConfig::Shutdown(); gfxPrefs::DestroySingleton(); -#ifdef MOZ_CRASHREPORTER - CrashReporterClient::DestroySingleton(); -#endif XRE_ShutdownChildProcess(); } diff --git a/gfx/src/DriverCrashGuard.cpp b/gfx/src/DriverCrashGuard.cpp index 36d08dcf3..4754c26ad 100644 --- a/gfx/src/DriverCrashGuard.cpp +++ b/gfx/src/DriverCrashGuard.cpp @@ -7,9 +7,6 @@ #include "gfxPrefs.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "nsXULAppAPI.h"
@@ -164,12 +161,6 @@ DriverCrashGuard::~DriverCrashGuard() } else {
dom::ContentChild::GetSingleton()->SendEndDriverCrashGuard(uint32_t(mType));
}
-
-#ifdef MOZ_CRASHREPORTER
- // Remove the crash report annotation.
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("GraphicsStartupTest"),
- NS_LITERAL_CSTRING(""));
-#endif
}
bool
@@ -208,16 +199,6 @@ DriverCrashGuard::ActivateGuard() {
mGuardActivated = true;
-#ifdef MOZ_CRASHREPORTER
- // Anotate crash reports only if we're a real guard. Otherwise, we could
- // attribute a random parent process crash to a graphics problem in a child
- // process.
- if (mMode != Mode::Proxy) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("GraphicsStartupTest"),
- NS_LITERAL_CSTRING("1"));
- }
-#endif
-
// If we're in the content process, the rest of the guarding is handled
// in the parent.
if (XRE_IsContentProcess()) {
diff --git a/gfx/src/gfxCrashReporterUtils.cpp b/gfx/src/gfxCrashReporterUtils.cpp index 42647ccc6..757c15527 100644 --- a/gfx/src/gfxCrashReporterUtils.cpp +++ b/gfx/src/gfxCrashReporterUtils.cpp @@ -5,10 +5,6 @@ #include "gfxCrashReporterUtils.h" -#if defined(MOZ_CRASHREPORTER) -#define MOZ_GFXFEATUREREPORTER 1 -#endif - #ifdef MOZ_GFXFEATUREREPORTER #include "gfxCrashReporterUtils.h" #include <string.h> // for strcmp diff --git a/gfx/tests/gtest/TestGfxPrefs.cpp b/gfx/tests/gtest/TestGfxPrefs.cpp index 72b698ed6..4e3b6037e 100644 --- a/gfx/tests/gtest/TestGfxPrefs.cpp +++ b/gfx/tests/gtest/TestGfxPrefs.cpp @@ -80,27 +80,3 @@ TEST(GfxPrefs, Set) { ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == -1.0f); } -#ifdef MOZ_CRASHREPORTER -// Randomly test the function we use in nsExceptionHandler.cpp here: -extern bool SimpleNoCLibDtoA(double aValue, char* aBuffer, int aBufferLength); -TEST(GfxPrefs, StringUtility) -{ - char testBuffer[64]; - double testVal[] = {13.4, - 3324243.42, - 0.332424342, - 864.0, - 86400 * 100000000.0 * 10000000000.0 * 10000000000.0 * 100.0, - 86400.0 * 366.0 * 100.0 + 14243.44332}; - for (size_t i=0; i<mozilla::ArrayLength(testVal); i++) { - ASSERT_TRUE(SimpleNoCLibDtoA(testVal[i], testBuffer, sizeof(testBuffer))); - ASSERT_TRUE(fabs(1.0 - atof(testBuffer)/testVal[i]) < 0.0001); - } - - // We do not like negative numbers (random limitation) - ASSERT_FALSE(SimpleNoCLibDtoA(-864.0, testBuffer, sizeof(testBuffer))); - - // It won't fit into 32: - ASSERT_FALSE(SimpleNoCLibDtoA(testVal[4], testBuffer, sizeof(testBuffer)/2)); -} -#endif diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 2e4ec990f..a468592fe 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -71,9 +71,6 @@ #include "nsIScreenManager.h" #include "FrameMetrics.h" #include "MainThreadUtils.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif #include "nsWeakReference.h" @@ -293,12 +290,7 @@ void CrashStatsLogForwarder::UpdateCrashReport() message << logAnnotation << Get<0>(*it) << "]" << Get<1>(*it) << " (t=" << Get<2>(*it) << ") "; } -#ifdef MOZ_CRASHREPORTER - nsCString reportString(message.str().c_str()); - nsresult annotated = CrashReporter::AnnotateCrashReport(mCrashCriticalKey, reportString); -#else nsresult annotated = NS_ERROR_NOT_IMPLEMENTED; -#endif if (annotated != NS_OK) { printf("Crash Annotation %s: %s", mCrashCriticalKey.get(), message.str().c_str()); diff --git a/ipc/glue/CrashReporterHost.cpp b/ipc/glue/CrashReporterHost.cpp index 76052ae66..85552cba5 100644 --- a/ipc/glue/CrashReporterHost.cpp +++ b/ipc/glue/CrashReporterHost.cpp @@ -9,9 +9,6 @@ #include "mozilla/Sprintf.h" #include "mozilla/SyncRunnable.h" #include "mozilla/Telemetry.h" -#ifdef MOZ_CRASHREPORTER -# include "nsICrashService.h" -#endif namespace mozilla { namespace ipc { @@ -24,105 +21,5 @@ CrashReporterHost::CrashReporterHost(GeckoProcessType aProcessType, { } -#ifdef MOZ_CRASHREPORTER -void -CrashReporterHost::GenerateCrashReport(RefPtr<nsIFile> aCrashDump) -{ - nsString dumpID; - if (!CrashReporter::GetIDFromMinidump(aCrashDump, dumpID)) { - return; - } - - CrashReporter::AnnotationTable notes; - - nsAutoCString type; - switch (mProcessType) { - case GeckoProcessType_Content: - type = NS_LITERAL_CSTRING("content"); - break; - case GeckoProcessType_Plugin: - case GeckoProcessType_GMPlugin: - type = NS_LITERAL_CSTRING("plugin"); - break; - case GeckoProcessType_GPU: - type = NS_LITERAL_CSTRING("gpu"); - break; - default: - NS_ERROR("unknown process type"); - break; - } - notes.Put(NS_LITERAL_CSTRING("ProcessType"), type); - - char startTime[32]; - SprintfLiteral(startTime, "%lld", static_cast<long long>(mStartTime)); - notes.Put(NS_LITERAL_CSTRING("StartupTime"), nsDependentCString(startTime)); - - CrashReporterMetadataShmem::ReadAppNotes(mShmem, ¬es); - - CrashReporter::AppendExtraData(dumpID, notes); - NotifyCrashService(mProcessType, dumpID, ¬es); -} - -/* static */ void -CrashReporterHost::NotifyCrashService(GeckoProcessType aProcessType, - const nsString& aChildDumpID, - const AnnotationTable* aNotes) -{ - if (!NS_IsMainThread()) { - RefPtr<Runnable> runnable = NS_NewRunnableFunction([=] () -> void { - CrashReporterHost::NotifyCrashService(aProcessType, aChildDumpID, aNotes); - }); - RefPtr<nsIThread> mainThread = do_GetMainThread(); - SyncRunnable::DispatchToThread(mainThread, runnable); - return; - } - - MOZ_ASSERT(!aChildDumpID.IsEmpty()); - - nsCOMPtr<nsICrashService> crashService = - do_GetService("@mozilla.org/crashservice;1"); - if (!crashService) { - return; - } - - int32_t processType; - int32_t crashType = nsICrashService::CRASH_TYPE_CRASH; - - nsCString telemetryKey; - - switch (aProcessType) { - case GeckoProcessType_Content: - processType = nsICrashService::PROCESS_TYPE_CONTENT; - telemetryKey.AssignLiteral("content"); - break; - case GeckoProcessType_Plugin: { - processType = nsICrashService::PROCESS_TYPE_PLUGIN; - telemetryKey.AssignLiteral("plugin"); - nsAutoCString val; - if (aNotes->Get(NS_LITERAL_CSTRING("PluginHang"), &val) && - val.Equals(NS_LITERAL_CSTRING("1"))) { - crashType = nsICrashService::CRASH_TYPE_HANG; - telemetryKey.AssignLiteral("pluginhang"); - } - break; - } - case GeckoProcessType_GMPlugin: - processType = nsICrashService::PROCESS_TYPE_GMPLUGIN; - telemetryKey.AssignLiteral("gmplugin"); - break; - case GeckoProcessType_GPU: - processType = nsICrashService::PROCESS_TYPE_GPU; - telemetryKey.AssignLiteral("gpu"); - break; - default: - NS_ERROR("unknown process type"); - return; - } - - crashService->AddCrash(processType, crashType, aChildDumpID); - Telemetry::Accumulate(Telemetry::SUBPROCESS_CRASHES_WITH_DUMP, telemetryKey, 1); -} -#endif - } // namespace ipc } // namespace mozilla diff --git a/ipc/glue/CrashReporterHost.h b/ipc/glue/CrashReporterHost.h index 36c5923c2..1089781c5 100644 --- a/ipc/glue/CrashReporterHost.h +++ b/ipc/glue/CrashReporterHost.h @@ -28,26 +28,6 @@ class CrashReporterHost public: CrashReporterHost(GeckoProcessType aProcessType, const Shmem& aShmem); -#ifdef MOZ_CRASHREPORTER - void GenerateCrashReport(base::ProcessId aPid) { - RefPtr<nsIFile> crashDump; - if (!XRE_TakeMinidumpForChild(aPid, getter_AddRefs(crashDump), nullptr)) { - return; - } - GenerateCrashReport(crashDump); - } - - // This is a static helper function to notify the crash service that a - // crash has occurred. When PCrashReporter is removed, we can make this - // a member function. This can be called from any thread, and if not - // called from the main thread, will post a synchronous message to the - // main thread. - static void NotifyCrashService( - GeckoProcessType aProcessType, - const nsString& aChildDumpID, - const AnnotationTable* aNotes); -#endif - private: void GenerateCrashReport(RefPtr<nsIFile> aCrashDump); diff --git a/ipc/glue/CrashReporterMetadataShmem.cpp b/ipc/glue/CrashReporterMetadataShmem.cpp index f579d5bb0..5b889948b 100644 --- a/ipc/glue/CrashReporterMetadataShmem.cpp +++ b/ipc/glue/CrashReporterMetadataShmem.cpp @@ -208,28 +208,5 @@ private: EntryType mEntryType; }; -#ifdef MOZ_CRASHREPORTER -void -CrashReporterMetadataShmem::ReadAppNotes(const Shmem& aShmem, CrashReporter::AnnotationTable* aNotes) -{ - for (MetadataShmemReader reader(aShmem); !reader.Done(); reader.Next()) { - switch (reader.Type()) { - case EntryType::Annotation: { - nsCString key, value; - if (!reader.Read(key) || !reader.Read(value)) { - return; - } - - aNotes->Put(key, value); - break; - } - default: - NS_ASSERTION(false, "Unknown metadata entry type"); - break; - } - } -} -#endif - } // namespace ipc } // namespace mozilla diff --git a/ipc/glue/CrashReporterMetadataShmem.h b/ipc/glue/CrashReporterMetadataShmem.h index d2d8670a2..ad67c6d75 100644 --- a/ipc/glue/CrashReporterMetadataShmem.h +++ b/ipc/glue/CrashReporterMetadataShmem.h @@ -28,10 +28,6 @@ public: void AnnotateCrashReport(const nsCString& aKey, const nsCString& aData); void AppendAppNotes(const nsCString& aData); -#ifdef MOZ_CRASHREPORTER - static void ReadAppNotes(const Shmem& aShmem, CrashReporter::AnnotationTable* aNotes); -#endif - private: void SyncNotesToShmem(); diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp index 48051472a..db8ab3d0a 100644 --- a/ipc/glue/GeckoChildProcessHost.cpp +++ b/ipc/glue/GeckoChildProcessHost.cpp @@ -307,12 +307,6 @@ GeckoChildProcessHost::GetUniqueID() void GeckoChildProcessHost::PrepareLaunch() { -#ifdef MOZ_CRASHREPORTER - if (CrashReporter::GetEnabled()) { - CrashReporter::OOPInit(); - } -#endif - #ifdef XP_WIN if (mProcessType == GeckoProcessType_Plugin) { InitWindowsGroupID(); @@ -902,26 +896,6 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt childArgv.push_back(pidstring); -#if defined(MOZ_CRASHREPORTER) -# if defined(OS_LINUX) || defined(OS_BSD) - int childCrashFd, childCrashRemapFd; - if (!CrashReporter::CreateNotificationPipeForChild( - &childCrashFd, &childCrashRemapFd)) - return false; - if (0 <= childCrashFd) { - mFileMap.push_back(std::pair<int,int>(childCrashFd, childCrashRemapFd)); - // "true" == crash reporting enabled - childArgv.push_back("true"); - } - else { - // "false" == crash reporting disabled - childArgv.push_back("false"); - } -# elif defined(MOZ_WIDGET_COCOA) - childArgv.push_back(CrashReporter::GetChildNotificationPipe()); -# endif // OS_LINUX -#endif - #ifdef MOZ_WIDGET_COCOA // Add a mach port to the command line so the child can communicate its // 'task_t' back to the parent. @@ -1139,11 +1113,6 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt // Process id cmdLine.AppendLooseValue(UTF8ToWide(pidstring)); -#if defined(MOZ_CRASHREPORTER) - cmdLine.AppendLooseValue( - UTF8ToWide(CrashReporter::GetChildNotificationPipe())); -#endif - // Process type cmdLine.AppendLooseValue(UTF8ToWide(childProcessType)); diff --git a/ipc/glue/IPCMessageUtils.h b/ipc/glue/IPCMessageUtils.h index 094aa978a..15834a854 100644 --- a/ipc/glue/IPCMessageUtils.h +++ b/ipc/glue/IPCMessageUtils.h @@ -25,9 +25,6 @@ #include <stdint.h> -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif #include "nsID.h" #include "nsIWidget.h" #include "nsMemory.h" @@ -127,16 +124,8 @@ struct EnumSerializer { static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) { uintParamType value; if (!ReadParam(aMsg, aIter, &value)) { -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCReadErrorReason"), - NS_LITERAL_CSTRING("Bad iter")); -#endif return false; } else if (!EnumValidator::IsLegalValue(paramType(value))) { -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCReadErrorReason"), - NS_LITERAL_CSTRING("Illegal value")); -#endif return false; } *aResult = paramType(value); diff --git a/ipc/glue/MessageChannel.h b/ipc/glue/MessageChannel.h index df70899df..4c9edf9dd 100644 --- a/ipc/glue/MessageChannel.h +++ b/ipc/glue/MessageChannel.h @@ -19,10 +19,6 @@ #include "mozilla/ipc/Neutering.h" #endif // defined(OS_WIN) #include "mozilla/ipc/Transport.h" -#if defined(MOZ_CRASHREPORTER) && defined(OS_WIN) -#include "mozilla/mozalloc_oom.h" -#include "nsExceptionHandler.h" -#endif #include "MessageLink.h" #include <deque> diff --git a/ipc/glue/MessageLink.cpp b/ipc/glue/MessageLink.cpp index 6a1bda02d..a66fbbb32 100644 --- a/ipc/glue/MessageLink.cpp +++ b/ipc/glue/MessageLink.cpp @@ -14,9 +14,6 @@ #include "mozilla/Assertions.h" #include "mozilla/DebugOnly.h" #include "nsDebug.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif #include "nsISupportsImpl.h" #include "nsXULAppAPI.h" @@ -135,10 +132,6 @@ void ProcessLink::SendMessage(Message *msg) { if (msg->size() > IPC::Channel::kMaximumMessageSize) { -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCMessageName"), nsDependentCString(msg->name())); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCMessageSize"), nsPrintfCString("%d", msg->size())); -#endif MOZ_CRASH("IPC message size is too large"); } diff --git a/ipc/glue/ProtocolUtils.cpp b/ipc/glue/ProtocolUtils.cpp index 1a022048f..4de131469 100644 --- a/ipc/glue/ProtocolUtils.cpp +++ b/ipc/glue/ProtocolUtils.cpp @@ -25,13 +25,6 @@ #include "mozilla/sandboxTarget.h" #endif -#if defined(MOZ_CRASHREPORTER) && defined(XP_WIN) -#include "aclapi.h" -#include "sddl.h" - -#include "mozilla/TypeTraits.h" -#endif - #include "nsAutoPtr.h" using namespace IPC; @@ -42,16 +35,6 @@ using base::ProcessId; namespace mozilla { -#if defined(MOZ_CRASHREPORTER) && defined(XP_WIN) -// Generate RAII classes for LPTSTR and PSECURITY_DESCRIPTOR. -MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE(ScopedLPTStr, \ - RemovePointer<LPTSTR>::Type, \ - ::LocalFree) -MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE(ScopedPSecurityDescriptor, \ - RemovePointer<PSECURITY_DESCRIPTOR>::Type, \ - ::LocalFree) -#endif - namespace ipc { class ChannelOpened : public IPC::Message @@ -195,11 +178,6 @@ bool DuplicateHandle(HANDLE aSourceHandle, FALSE, aTargetProcessId)); if (!targetProcess) { -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("IPCTransportFailureReason"), - NS_LITERAL_CSTRING("Failed to open target process.")); -#endif return false; } @@ -209,34 +187,6 @@ bool DuplicateHandle(HANDLE aSourceHandle, } #endif -#ifdef MOZ_CRASHREPORTER -void -AnnotateSystemError() -{ - int64_t error = 0; -#if defined(XP_WIN) - error = ::GetLastError(); -#elif defined(OS_POSIX) - error = errno; -#endif - if (error) { - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("IPCSystemError"), - nsPrintfCString("%lld", error)); - } -} -#endif - -#if defined(MOZ_CRASHREPORTER) && defined(XP_MACOSX) -void -AnnotateCrashReportWithErrno(const char* tag, int error) -{ - CrashReporter::AnnotateCrashReport( - nsCString(tag), - nsPrintfCString("%d", error)); -} -#endif - void LogMessageForProtocol(const char* aTopLevelProtocol, base::ProcessId aOtherPid, const char* aContextDescription, @@ -274,18 +224,6 @@ FatalError(const char* aProtocolName, const char* aMsg, bool aIsParent) formattedMessage.AppendLiteral("]: \""); formattedMessage.AppendASCII(aMsg); if (aIsParent) { -#ifdef MOZ_CRASHREPORTER - // We're going to crash the parent process because at this time - // there's no other really nice way of getting a minidump out of - // this process if we're off the main thread. - formattedMessage.AppendLiteral("\". Intentionally crashing."); - NS_ERROR(formattedMessage.get()); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCFatalErrorProtocol"), - nsDependentCString(aProtocolName)); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCFatalErrorMsg"), - nsDependentCString(aMsg)); - AnnotateSystemError(); -#endif MOZ_CRASH("IPC FatalError in the parent process!"); } else { formattedMessage.AppendLiteral("\". abort()ing as a result."); @@ -540,12 +478,9 @@ IToplevelProtocol::SetOtherProcessId(base::ProcessId aOtherPid) bool IToplevelProtocol::TakeMinidump(nsIFile** aDump, uint32_t* aSequence) { + /*** STUB ***/ MOZ_RELEASE_ASSERT(GetSide() == ParentSide); -#ifdef MOZ_CRASHREPORTER - return XRE_TakeMinidumpForChild(OtherPid(), aDump, aSequence); -#else return false; -#endif } bool diff --git a/ipc/glue/ProtocolUtils.h b/ipc/glue/ProtocolUtils.h index 9184aae54..83860d93a 100644 --- a/ipc/glue/ProtocolUtils.h +++ b/ipc/glue/ProtocolUtils.h @@ -472,14 +472,10 @@ DuplicateHandle(HANDLE aSourceHandle, #endif /** - * Annotate the crash reporter with the error code from the most recent system - * call. Returns the system error. + * Hist: Annotated the crash reporter with the error code from the most + * recent system call. Returned the system error. */ -#ifdef MOZ_CRASHREPORTER -void AnnotateSystemError(); -#else #define AnnotateSystemError() do { } while (0) -#endif /** * An endpoint represents one end of a partially initialized IPDL channel. To @@ -599,12 +595,8 @@ private: ProtocolId mProtocolId; }; -#if defined(MOZ_CRASHREPORTER) && defined(XP_MACOSX) -void AnnotateCrashReportWithErrno(const char* tag, int error); -#else static inline void AnnotateCrashReportWithErrno(const char* tag, int error) {} -#endif // This function is used internally to create a pair of Endpoints. See the // comment above Endpoint for a description of how it might be used. diff --git a/ipc/ipdl/ipdl/lower.py b/ipc/ipdl/ipdl/lower.py index f810cccb0..61855a7a9 100644 --- a/ipc/ipdl/ipdl/lower.py +++ b/ipc/ipdl/ipdl/lower.py @@ -2610,13 +2610,6 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor): '"'+ _protocolHeaderName(self.protocol, self.side) +'.h"') ] + setToIncludes(self.externalIncludes)) - if self.protocol.decl.type.isToplevel(): - cf.addthings([ - CppDirective('ifdef', 'MOZ_CRASHREPORTER'), - CppDirective(' include', '"nsXULAppAPI.h"'), - CppDirective('endif') - ]) - cppheaders = [CppDirective('include', '"%s"' % filename) for filename in ipdl.builtin.CppIncludes] diff --git a/js/xpconnect/src/XPCJSContext.cpp b/js/xpconnect/src/XPCJSContext.cpp index bedb7c650..f5f6a11bb 100644 --- a/js/xpconnect/src/XPCJSContext.cpp +++ b/js/xpconnect/src/XPCJSContext.cpp @@ -59,10 +59,6 @@ #include "nsIXULRuntime.h" #include "nsJSPrincipals.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif - #if defined(MOZ_JEMALLOC4) #include "mozmemory.h" #endif @@ -709,11 +705,6 @@ XPCJSContext::GCSliceCallback(JSContext* cx, if (!self) return; -#ifdef MOZ_CRASHREPORTER - CrashReporter::SetGarbageCollecting(progress == JS::GC_CYCLE_BEGIN || - progress == JS::GC_SLICE_BEGIN); -#endif - if (self->mPrevGCSliceCallback) (*self->mPrevGCSliceCallback)(cx, progress, desc); } diff --git a/js/xpconnect/src/XPCShellImpl.cpp b/js/xpconnect/src/XPCShellImpl.cpp index d9629bfed..45d00d390 100644 --- a/js/xpconnect/src/XPCShellImpl.cpp +++ b/js/xpconnect/src/XPCShellImpl.cpp @@ -59,11 +59,6 @@ #include <unistd.h> /* for isatty() */ #endif -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#include "nsICrashReporter.h" -#endif - using namespace mozilla; using namespace JS; using mozilla::dom::AutoJSAPI; @@ -1372,18 +1367,6 @@ XRE_XPCShellMain(int argc, char** argv, char** envp, argv += 2; } -#ifdef MOZ_CRASHREPORTER - const char* val = getenv("MOZ_CRASHREPORTER"); - if (val && *val) { - 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; @@ -1603,12 +1586,6 @@ XRE_XPCShellMain(int argc, char** argv, char** envp, dirprovider.ClearPluginDir(); dirprovider.ClearAppFile(); -#ifdef MOZ_CRASHREPORTER - // Shut down the crashreporter service to prevent leaking some strings it holds. - if (CrashReporter::GetEnabled()) - CrashReporter::UnsetExceptionHandler(); -#endif - NS_LogTerm(); return result; diff --git a/layout/style/nsLayoutStylesheetCache.cpp b/layout/style/nsLayoutStylesheetCache.cpp index f8aea5541..e8c6d09d7 100644 --- a/layout/style/nsLayoutStylesheetCache.cpp +++ b/layout/style/nsLayoutStylesheetCache.cpp @@ -23,19 +23,6 @@ #include "nsPrintfCString.h" #include "nsXULAppAPI.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; @@ -463,280 +450,6 @@ nsLayoutStylesheetCache::LoadSheetFile(nsIFile* 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); - - unsigned char buf[512]; - int32_t n; - while ((n = PR_Read(fd, buf, sizeof(buf))) > 0) { - crc = crc32(crc, buf, n); - } - PR_Close(fd); - - if (n < 0) { - return NS_ERROR_FAILURE; - } - - *aResult = crc; - return NS_OK; -} - -static void -ListInterestingFiles(nsString& aAnnotation, nsIFile* aFile, - const nsTArray<nsString>& aInterestingFilenames) -{ - nsString filename; - aFile->GetLeafName(filename); - for (const nsString& interestingFilename : aInterestingFilenames) { - if (interestingFilename == filename) { - nsString path; - aFile->GetPath(path); - aAnnotation.AppendLiteral(" "); - aAnnotation.Append(path); - aAnnotation.AppendLiteral(" ("); - int64_t size; - if (NS_SUCCEEDED(aFile->GetFileSize(&size))) { - aAnnotation.AppendPrintf("%ld", size); - } else { - aAnnotation.AppendLiteral("???"); - } - aAnnotation.AppendLiteral(" bytes, crc32 = "); - uint32_t crc; - nsresult rv = ComputeCRC32(aFile, &crc); - if (NS_SUCCEEDED(rv)) { - aAnnotation.AppendPrintf("0x%08x)\n", crc); - } else { - aAnnotation.AppendPrintf("error 0x%08x)\n", uint32_t(rv)); - } - return; - } - } - - bool isDir = false; - aFile->IsDirectory(&isDir); - - if (!isDir) { - return; - } - - nsCOMPtr<nsISimpleEnumerator> entries; - if (NS_FAILED(aFile->GetDirectoryEntries(getter_AddRefs(entries)))) { - aAnnotation.AppendLiteral(" (failed to enumerated directory)\n"); - return; - } - - for (;;) { - bool hasMore = false; - if (NS_FAILED(entries->HasMoreElements(&hasMore))) { - aAnnotation.AppendLiteral(" (failed during directory enumeration)\n"); - return; - } - if (!hasMore) { - break; - } - - nsCOMPtr<nsISupports> entry; - if (NS_FAILED(entries->GetNext(getter_AddRefs(entry)))) { - aAnnotation.AppendLiteral(" (failed during directory enumeration)\n"); - return; - } - - nsCOMPtr<nsIFile> file = do_QueryInterface(entry); - if (file) { - ListInterestingFiles(aAnnotation, file, aInterestingFilenames); - } - } -} - -// Generate a crash report annotation to help debug issues with style -// sheets failing to load (bug 1194856). -static void -AnnotateCrashReport(nsIURI* aURI) -{ - nsAutoCString spec; - nsAutoCString scheme; - nsDependentCSubstring filename; - if (aURI) { - spec = aURI->GetSpecOrDefault(); - aURI->GetScheme(scheme); - int32_t i = spec.RFindChar('/'); - if (i != -1) { - filename.Rebind(spec, i + 1); - } - } - - nsString annotation; - - // The URL of the sheet that failed to load. - annotation.AppendLiteral("Error loading sheet: "); - annotation.Append(NS_ConvertUTF8toUTF16(spec).get()); - annotation.Append('\n'); - - annotation.AppendLiteral("NS_ERROR_FILE_CORRUPTION reason: "); - if (nsZipArchive::sFileCorruptedReason) { - annotation.Append(NS_ConvertUTF8toUTF16(nsZipArchive::sFileCorruptedReason).get()); - annotation.Append('\n'); - } else { - annotation.AppendLiteral("(none)\n"); - } - - // The jar: or file: URL that the sheet's resource: or chrome: URL - // resolves to. - if (scheme.EqualsLiteral("resource")) { - annotation.AppendLiteral("Real location: "); - nsCOMPtr<nsISubstitutingProtocolHandler> handler; - nsCOMPtr<nsIIOService> io(do_GetIOService()); - if (io) { - nsCOMPtr<nsIProtocolHandler> ph; - io->GetProtocolHandler(scheme.get(), getter_AddRefs(ph)); - if (ph) { - handler = do_QueryInterface(ph); - } - } - if (!handler) { - annotation.AppendLiteral("(ResolveURI failed)\n"); - } else { - nsAutoCString resolvedSpec; - handler->ResolveURI(aURI, resolvedSpec); - annotation.Append(NS_ConvertUTF8toUTF16(resolvedSpec)); - annotation.Append('\n'); - } - } else if (scheme.EqualsLiteral("chrome")) { - annotation.AppendLiteral("Real location: "); - nsCOMPtr<nsIChromeRegistry> reg = - mozilla::services::GetChromeRegistryService(); - if (!reg) { - annotation.AppendLiteral("(no chrome registry)\n"); - } else { - nsCOMPtr<nsIURI> resolvedURI; - reg->ConvertChromeURL(aURI, getter_AddRefs(resolvedURI)); - if (!resolvedURI) { - annotation.AppendLiteral("(ConvertChromeURL failed)\n"); - } else { - annotation.Append( - NS_ConvertUTF8toUTF16(resolvedURI->GetSpecOrDefault())); - annotation.Append('\n'); - } - } - } - - nsTArray<nsString> interestingFiles; - interestingFiles.AppendElement(NS_LITERAL_STRING("chrome.manifest")); - interestingFiles.AppendElement(NS_LITERAL_STRING("omni.ja")); - interestingFiles.AppendElement(NS_ConvertUTF8toUTF16(filename)); - - annotation.AppendLiteral("GRE directory: "); - nsCOMPtr<nsIFile> file; - nsDirectoryService::gService->Get(NS_GRE_DIR, NS_GET_IID(nsIFile), - getter_AddRefs(file)); - if (file) { - // The Firefox installation directory. - nsString path; - file->GetPath(path); - annotation.Append(path); - annotation.Append('\n'); - - // List interesting files -- any chrome.manifest or omni.ja file or any file - // whose name is the sheet's filename -- under the Firefox installation - // directory. - annotation.AppendLiteral("Interesting files in the GRE directory:\n"); - ListInterestingFiles(annotation, file, interestingFiles); - - // If the Firefox installation directory has a chrome.manifest file, let's - // see what's in it. - file->Append(NS_LITERAL_STRING("chrome.manifest")); - bool exists = false; - file->Exists(&exists); - if (exists) { - annotation.AppendLiteral("Contents of chrome.manifest:\n[[[\n"); - PRFileDesc* fd; - if (NS_SUCCEEDED(file->OpenNSPRFileDesc(PR_RDONLY, 0, &fd))) { - nsCString contents; - char buf[512]; - int32_t n; - while ((n = PR_Read(fd, buf, sizeof(buf))) > 0) { - contents.Append(buf, n); - } - if (n < 0) { - annotation.AppendLiteral(" (error while reading)\n"); - } else { - annotation.Append(NS_ConvertUTF8toUTF16(contents)); - } - PR_Close(fd); - } - annotation.AppendLiteral("]]]\n"); - } - } else { - annotation.AppendLiteral("(none)\n"); - } - - // The jar: or file: URL prefix that chrome: and resource: URLs get translated - // to. - annotation.AppendLiteral("GRE omnijar URI string: "); - nsCString uri; - nsresult rv = Omnijar::GetURIString(Omnijar::GRE, uri); - if (NS_FAILED(rv)) { - annotation.AppendLiteral("(failed)\n"); - } else { - annotation.Append(NS_ConvertUTF8toUTF16(uri)); - annotation.Append('\n'); - } - - RefPtr<nsZipArchive> zip = Omnijar::GetReader(Omnijar::GRE); - if (zip) { - // List interesting files in the GRE omnijar. - annotation.AppendLiteral("Interesting files in the GRE omnijar:\n"); - nsZipFind* find; - rv = zip->FindInit(nullptr, &find); - if (NS_FAILED(rv)) { - annotation.AppendPrintf(" (FindInit failed with 0x%08x)\n", rv); - } else if (!find) { - annotation.AppendLiteral(" (FindInit returned null)\n"); - } else { - const char* result; - uint16_t len; - while (NS_SUCCEEDED(find->FindNext(&result, &len))) { - nsCString itemPathname; - nsString itemFilename; - itemPathname.Append(result, len); - int32_t i = itemPathname.RFindChar('/'); - if (i != -1) { - itemFilename = NS_ConvertUTF8toUTF16(Substring(itemPathname, i + 1)); - } - for (const nsString& interestingFile : interestingFiles) { - if (interestingFile == itemFilename) { - annotation.AppendLiteral(" "); - annotation.Append(NS_ConvertUTF8toUTF16(itemPathname)); - nsZipItem* item = zip->GetItem(itemPathname.get()); - if (!item) { - annotation.AppendLiteral(" (GetItem failed)\n"); - } else { - annotation.AppendPrintf(" (%d bytes, crc32 = 0x%08x)\n", - item->RealSize(), - item->CRC32()); - } - break; - } - } - } - delete find; - } - } 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) { @@ -751,9 +464,6 @@ ErrorLoadingSheet(nsIURI* aURI, const char* aMsg, FailureAction aFailureAction) } } -#ifdef MOZ_CRASHREPORTER - AnnotateCrashReport(aURI); -#endif NS_RUNTIMEABORT(errorMessage.get()); } @@ -780,9 +490,6 @@ nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI, } } -#ifdef MOZ_CRASHREPORTER - nsZipArchive::sFileCorruptedReason = nullptr; -#endif nsresult rv = loader->LoadSheetSync(aURI, aParsingMode, true, aSheet); if (NS_FAILED(rv)) { ErrorLoadingSheet(aURI, diff --git a/mobile/android/app/build.gradle b/mobile/android/app/build.gradle index 18586cadb..724b955ef 100644 --- a/mobile/android/app/build.gradle +++ b/mobile/android/app/build.gradle @@ -100,9 +100,7 @@ android { srcDir "${topsrcdir}/mobile/android/stumbler/java" } - if (!mozconfig.substs.MOZ_CRASHREPORTER) { - exclude 'org/mozilla/gecko/CrashReporter.java' - } + exclude 'org/mozilla/gecko/CrashReporter.java' if (!mozconfig.substs.MOZ_NATIVE_DEVICES) { exclude 'org/mozilla/gecko/ChromeCastDisplay.java' diff --git a/mobile/android/base/AndroidManifest.xml.in b/mobile/android/base/AndroidManifest.xml.in index 2ec98c35a..0352c1ab6 100644 --- a/mobile/android/base/AndroidManifest.xml.in +++ b/mobile/android/base/AndroidManifest.xml.in @@ -263,20 +263,6 @@ #include ../search/manifests/SearchAndroidManifest_activities.xml.in #endif -#if MOZ_CRASHREPORTER - <activity android:name="org.mozilla.gecko.CrashReporter" - android:process="@ANDROID_PACKAGE_NAME@.CrashReporter" - android:label="@string/crash_reporter_title" - android:icon="@drawable/crash_reporter" - android:theme="@style/Gecko" - android:exported="false" - android:excludeFromRecents="true"> - <intent-filter> - <action android:name="org.mozilla.gecko.reportCrash" /> - </intent-filter> - </activity> -#endif - <activity android:name="org.mozilla.gecko.preferences.GeckoPreferences" android:theme="@style/Gecko.Preferences" android:configChanges="orientation|screenSize|locale|layoutDirection" diff --git a/mobile/android/base/AppConstants.java.in b/mobile/android/base/AppConstants.java.in index 25a6a456e..21748e73b 100644 --- a/mobile/android/base/AppConstants.java.in +++ b/mobile/android/base/AppConstants.java.in @@ -194,13 +194,6 @@ public class AppConstants { false; //#endif - public static final boolean MOZ_CRASHREPORTER = -//#if MOZ_CRASHREPORTER - true; -//#else - false; -//#endif - public static final boolean MOZ_DATA_REPORTING = //#ifdef MOZ_DATA_REPORTING true; diff --git a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java index 5ab1bc3fd..aab5be2de 100644 --- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java +++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java @@ -734,12 +734,6 @@ OnSharedPreferenceChangeListener i--; continue; } - } else if (PREFS_CRASHREPORTER_ENABLED.equals(key)) { - if (!AppConstants.MOZ_CRASHREPORTER || !Restrictions.isAllowed(this, Restrictable.DATA_CHOICES)) { - preferences.removePreference(pref); - i--; - continue; - } } else if (PREFS_GEO_REPORTING.equals(key) || PREFS_GEO_LEARN_MORE.equals(key)) { if (!AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED || !Restrictions.isAllowed(this, Restrictable.DATA_CHOICES)) { diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build index 6c88464ab..eac831421 100644 --- a/mobile/android/base/moz.build +++ b/mobile/android/base/moz.build @@ -805,10 +805,6 @@ gbjar.extra_jars += [ CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'], 'constants.jar' ] -if CONFIG['MOZ_CRASHREPORTER']: - gbjar.sources += [ 'java/org/mozilla/gecko/CrashReporter.java' ] - ANDROID_RES_DIRS += [ 'crashreporter/res' ] - if CONFIG['MOZ_ANDROID_GCM']: gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [ 'gcm/GcmInstanceIDListenerService.java', @@ -1089,7 +1085,7 @@ for var in ('ANDROID_PACKAGE_NAME', 'ANDROID_CPU_ARCH', 'MOZ_APP_DISPLAYNAME', 'MOZ_APP_UA_NAME', 'MOZ_APP_ID', 'MOZ_APP_NAME', 'MOZ_APP_VENDOR', 'MOZ_APP_VERSION', 'MOZ_CHILD_PROCESS_NAME', 'MOZ_ANDROID_APPLICATION_CLASS', 'MOZ_ANDROID_BROWSER_INTENT_CLASS', 'MOZ_ANDROID_SEARCH_INTENT_CLASS', - 'MOZ_CRASHREPORTER', 'MOZ_UPDATE_CHANNEL', 'OMNIJAR_NAME', + 'MOZ_UPDATE_CHANNEL', 'OMNIJAR_NAME', 'OS_TARGET', 'TARGET_XPCOM_ABI'): DEFINES[var] = CONFIG[var] diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashHandler.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashHandler.java index 15df27336..0c8eeff9e 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashHandler.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashHandler.java @@ -467,10 +467,6 @@ public class CrashHandler implements Thread.UncaughtExceptionHandler { @Override public boolean reportException(final Thread thread, final Throwable exc) { - if (AppConstants.MOZ_CRASHREPORTER && AppConstants.MOZILLA_OFFICIAL) { - // Only use Java crash reporter if enabled on official build. - return super.reportException(thread, exc); - } return false; } }; diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java index a80212639..152981649 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java @@ -166,10 +166,6 @@ public class GeckoAppShell // reportJavaCrash should have caused us to hard crash. If we're still here, // it probably means Gecko is not loaded, and we should do something else. - if (AppConstants.MOZ_CRASHREPORTER && AppConstants.MOZILLA_OFFICIAL) { - // Only use Java crash reporter if enabled on official build. - return super.reportException(thread, exc); - } return false; } }; diff --git a/mobile/android/installer/package-manifest.in b/mobile/android/installer/package-manifest.in index a643ea243..086138d47 100644 --- a/mobile/android/installer/package-manifest.in +++ b/mobile/android/installer/package-manifest.in @@ -507,14 +507,6 @@ @BINPATH@/@DLL_PREFIX@mozsandbox@DLL_SUFFIX@ #endif -; [Crash Reporter] -; CrashService is not used on Android but the ini files are required for L10N -; strings, see bug 1191351. -#ifdef MOZ_CRASHREPORTER -@BINPATH@/crashreporter.ini -@BINPATH@/crashreporter-override.ini -#endif - [mobile] @BINPATH@/chrome/chrome@JAREXT@ @BINPATH@/chrome/chrome.manifest diff --git a/modules/libpref/nsPrefBranch.cpp b/modules/libpref/nsPrefBranch.cpp index 2fd4992c8..98e06aaa4 100644 --- a/modules/libpref/nsPrefBranch.cpp +++ b/modules/libpref/nsPrefBranch.cpp @@ -26,10 +26,6 @@ #include "prefapi_private_data.h" -#ifdef MOZ_CRASHREPORTER -#include "nsICrashReporter.h" -#endif - #include "nsIConsoleService.h" #ifdef DEBUG @@ -335,16 +331,6 @@ NS_IMETHODIMP nsPrefBranch::GetComplexValue(const char *aPrefName, const nsIID & // some addons, see bug 836263. nsAutoString wdata; if (!AppendUTF8toUTF16(utf8String, wdata, mozilla::fallible)) { -#ifdef MOZ_CRASHREPORTER - nsCOMPtr<nsICrashReporter> cr = - do_GetService("@mozilla.org/toolkit/crash-reporter;1"); - if (cr) { - cr->AnnotateCrashReport(NS_LITERAL_CSTRING("bug836263-size"), - nsPrintfCString("%x", utf8String.Length())); - cr->RegisterAppMemory(uint64_t(utf8String.BeginReading()), - std::min(0x1000U, utf8String.Length())); - } -#endif NS_RUNTIMEABORT("bug836263"); } theString->SetData(wdata); diff --git a/netwerk/ipc/NeckoMessageUtils.h b/netwerk/ipc/NeckoMessageUtils.h index 778691369..1633b82b6 100644 --- a/netwerk/ipc/NeckoMessageUtils.h +++ b/netwerk/ipc/NeckoMessageUtils.h @@ -14,11 +14,6 @@ #include "mozilla/net/DNS.h" #include "TimingStruct.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#include "nsPrintfCString.h" -#endif - namespace IPC { // nsIPermissionManager utilities @@ -102,12 +97,6 @@ struct ParamTraits<mozilla::net::NetAddr> aMsg->WriteBytes(aParam.local.path, sizeof(aParam.local.path)); #endif } else { -#ifdef MOZ_CRASHREPORTER - if (XRE_IsParentProcess()) { - nsPrintfCString msg("%d", aParam.raw.family); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Unknown NetAddr socket family"), msg); - } -#endif NS_RUNTIMEABORT("Unknown socket family"); } } diff --git a/old-configure.in b/old-configure.in index c7d882e2d..6b43cb1ad 100644 --- a/old-configure.in +++ b/old-configure.in @@ -3482,68 +3482,6 @@ AC_SUBST(MOZ_GAMEPAD) AC_SUBST(MOZ_GAMEPAD_BACKEND) dnl ======================================================== -dnl = Breakpad crash reporting (on by default on supported platforms) -dnl ======================================================== - -case $target in -i?86-*-mingw*|x86_64-*-mingw*) - MOZ_CRASHREPORTER=1 - ;; -i?86-apple-darwin*|x86_64-apple-darwin*) - if test -z "$MOZ_IOS"; then - MOZ_CRASHREPORTER=1 - fi - ;; -i?86-*-linux*|x86_64-*-linux*|arm-*-linux*) - if test "$MOZ_ENABLE_GTK"; then - MOZ_CRASHREPORTER=1 - fi - ;; -*-android*|*-linuxandroid*) - MOZ_CRASHREPORTER=1 - ;; -esac - -MOZ_ARG_DISABLE_BOOL(crashreporter, -[ --disable-crashreporter Disable breakpad crash reporting], - [MOZ_CRASHREPORTER=], - [MOZ_CRASHREPORTER=F # Force enable breakpad]) - -if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then - if test "$MOZ_CRASHREPORTER" = F; then - AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.]) - fi - MOZ_CRASHREPORTER= -fi - -if test -n "$MOZ_CRASHREPORTER"; then - AC_DEFINE(MOZ_CRASHREPORTER) - - if test "$OS_TARGET" = "Linux" && \ - test -z "$SKIP_LIBRARY_CHECKS"; then - PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0) - fi - - if test "$OS_ARCH" = "WINNT"; then - if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then - MOZ_CRASHREPORTER_INJECTOR=1 - AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR) - fi - fi -fi - -MOZ_ARG_WITH_STRING(crashreporter-enable-percent, -[ --with-crashreporter-enable-percent=NN - Enable sending crash reports by default on NN% of users. (default=100)], -[ val=`echo $withval | sed 's/[^0-9]//g'` - MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"]) - -if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then - MOZ_CRASHREPORTER_ENABLE_PERCENT=100 -fi -AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT) - -dnl ======================================================== dnl = libjpeg-turbo configuration dnl ======================================================== MOZ_LIBJPEG_TURBO= @@ -5291,8 +5229,6 @@ AC_SUBST(MOZ_UNIVERSALCHARDET) AC_SUBST(ACCESSIBILITY) AC_SUBST(MOZ_SPELLCHECK) AC_SUBST(MOZ_ANDROID_ANR_REPORTER) -AC_SUBST(MOZ_CRASHREPORTER) -AC_SUBST(MOZ_CRASHREPORTER_INJECTOR) AC_SUBST(MOZ_MAINTENANCE_SERVICE) AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE) AC_SUBST(MOZ_ENABLE_SIGNMAR) @@ -5525,7 +5461,7 @@ fi dnl If we have any service that uploads data (and requires data submission dnl policy alert), set MOZ_DATA_REPORTING. dnl We need SUBST for build system and DEFINE for xul preprocessor. -if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then +if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT"; then MOZ_DATA_REPORTING=1 AC_DEFINE(MOZ_DATA_REPORTING) AC_SUBST(MOZ_DATA_REPORTING) diff --git a/python/mozbuild/mozbuild/mozinfo.py b/python/mozbuild/mozbuild/mozinfo.py index 2c08c4e9f..712722d62 100755 --- a/python/mozbuild/mozbuild/mozinfo.py +++ b/python/mozbuild/mozbuild/mozinfo.py @@ -80,7 +80,6 @@ def build_dict(config, env=os.environ): d['nightly_build'] = substs.get('NIGHTLY_BUILD') == '1' d['release_or_beta'] = substs.get('RELEASE_OR_BETA') == '1' d['pgo'] = substs.get('MOZ_PGO') == '1' - d['crashreporter'] = bool(substs.get('MOZ_CRASHREPORTER')) d['datareporting'] = bool(substs.get('MOZ_DATA_REPORTING')) d['healthreport'] = substs.get('MOZ_SERVICES_HEALTHREPORT') == '1' d['sync'] = substs.get('MOZ_SERVICES_SYNC') == '1' diff --git a/python/mozbuild/mozbuild/test/test_mozinfo.py b/python/mozbuild/mozbuild/test/test_mozinfo.py index 1a4194cb5..6d0909b2d 100755 --- a/python/mozbuild/mozbuild/test/test_mozinfo.py +++ b/python/mozbuild/mozbuild/test/test_mozinfo.py @@ -215,7 +215,6 @@ class TestBuildDict(unittest.TestCase, Base): OS_TARGET='Linux', TARGET_CPU='i386', MOZ_WIDGET_TOOLKIT='gtk2', - MOZ_CRASHREPORTER='1', ))) self.assertEqual(True, d['crashreporter']) diff --git a/security/sandbox/linux/glue/SandboxCrash.cpp b/security/sandbox/linux/glue/SandboxCrash.cpp index 87a75e845..8ead16bdf 100644 --- a/security/sandbox/linux/glue/SandboxCrash.cpp +++ b/security/sandbox/linux/glue/SandboxCrash.cpp @@ -18,9 +18,6 @@ #include "mozilla/Unused.h" #include "mozilla/dom/Exceptions.h" #include "nsContentUtils.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif #include "mozilla/StackWalk.h" #include "nsString.h" #include "nsThreadUtils.h" @@ -109,9 +106,6 @@ SandboxCrash(int nr, siginfo_t *info, void *void_context) pid_t pid = getpid(), tid = syscall(__NR_gettid); bool dumped = false; -#ifdef MOZ_CRASHREPORTER - dumped = CrashReporter::WriteMinidumpForSigInfo(nr, info, void_context); -#endif if (!dumped) { SANDBOX_LOG_ERROR("crash reporter is disabled (or failed);" " trying stack trace:"); diff --git a/testing/gtest/mozilla/GTestRunner.cpp b/testing/gtest/mozilla/GTestRunner.cpp index 0864db8cb..544de81da 100644 --- a/testing/gtest/mozilla/GTestRunner.cpp +++ b/testing/gtest/mozilla/GTestRunner.cpp @@ -6,9 +6,6 @@ #include "GTestRunner.h" #include "gtest/gtest.h" #include "mozilla/Attributes.h" -#ifdef MOZ_CRASHREPORTER -#include "nsICrashReporter.h" -#endif #include "testing/TestHarness.h" #include "prenv.h" #ifdef XP_WIN @@ -92,28 +89,6 @@ int RunGTestFunc() #ifdef XP_WIN mozilla::ipc::windows::InitUIThread(); #endif -#ifdef MOZ_CRASHREPORTER - nsCOMPtr<nsICrashReporter> crashreporter; - char *crashreporterStr = PR_GetEnv("MOZ_CRASHREPORTER"); - if (crashreporterStr && !strcmp(crashreporterStr, "1")) { - //TODO: move this to an even-more-common location to use in all - // C++ unittests - crashreporter = do_GetService("@mozilla.org/toolkit/crash-reporter;1"); - if (crashreporter) { - std::cerr << "Setting up crash reporting" << std::endl; - - nsCOMPtr<nsIProperties> dirsvc = - do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID); - nsCOMPtr<nsIFile> cwd; - nsresult rv = dirsvc->Get(NS_OS_CURRENT_WORKING_DIR, - NS_GET_IID(nsIFile), - getter_AddRefs(cwd)); - MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv)); - crashreporter->SetEnabled(true); - crashreporter->SetMinidumpPath(cwd); - } - } -#endif return RUN_ALL_TESTS(); } diff --git a/testing/gtest/rungtests.py b/testing/gtest/rungtests.py index e9e33cca2..499908680 100644 --- a/testing/gtest/rungtests.py +++ b/testing/gtest/rungtests.py @@ -89,7 +89,6 @@ class GTests(object): ) env["XPCOM_DEBUG_BREAK"] = "stack-and-abort" env["MOZ_CRASHREPORTER_NO_REPORT"] = "1" - env["MOZ_CRASHREPORTER"] = "1" env["MOZ_RUN_GTEST"] = "1" # Normally we run with GTest default output, override this to use the TBPL test format. env["MOZ_TBPL_PARSER"] = "1" diff --git a/testing/marionette/client/marionette_driver/geckoinstance.py b/testing/marionette/client/marionette_driver/geckoinstance.py index 7e2048187..174168ed2 100644 --- a/testing/marionette/client/marionette_driver/geckoinstance.py +++ b/testing/marionette/client/marionette_driver/geckoinstance.py @@ -226,8 +226,7 @@ class GeckoInstance(object): # environment variables needed for crashreporting # https://developer.mozilla.org/docs/Environment_variables_affecting_crash_reporting - env.update({"MOZ_CRASHREPORTER": "1", - "MOZ_CRASHREPORTER_NO_REPORT": "1", + env.update({"MOZ_CRASHREPORTER_NO_REPORT": "1", "MOZ_CRASHREPORTER_SHUTDOWN": "1", }) diff --git a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm index eebcbb6bb..d6cd836e7 100644 --- a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm +++ b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm @@ -851,9 +851,6 @@ this.BrowserTestUtils = { crashBrowser: Task.async(function*(browser, shouldShowTabCrashPage=true) { let extra = {}; let KeyValueParser = {}; - if (AppConstants.MOZ_CRASHREPORTER) { - Cu.import("resource://gre/modules/KeyValueParser.jsm", KeyValueParser); - } if (!browser.isRemoteBrowser) { throw new Error("<xul:browser> needs to be remote in order to crash"); @@ -938,11 +935,7 @@ this.BrowserTestUtils = { extrafile.append(dumpID + '.extra'); if (extrafile.exists()) { dump(`\nNo .extra file for dumpID: ${dumpID}\n`); - if (AppConstants.MOZ_CRASHREPORTER) { - extra = KeyValueParser.parseKeyValuePairsFromFile(extrafile); - } else { - dump('\nCrashReporter not enabled - will not return any extra data\n'); - } + dump('\nWill not return any extra data\n'); } removeFile(minidumpDirectory, dumpID + '.dmp'); diff --git a/testing/mozbase/mozrunner/mozrunner/base/browser.py b/testing/mozbase/mozrunner/mozrunner/base/browser.py index 998e4ccc5..6fc7348d5 100644 --- a/testing/mozbase/mozrunner/mozrunner/base/browser.py +++ b/testing/mozbase/mozrunner/mozrunner/base/browser.py @@ -75,6 +75,5 @@ class GeckoRuntimeRunner(BaseRunner): if not self.show_crash_reporter: # hide the crash reporter window self.env["MOZ_CRASHREPORTER_NO_REPORT"] = "1" - self.env["MOZ_CRASHREPORTER"] = "1" BaseRunner.start(self, *args, **kwargs) diff --git a/testing/mozbase/mozrunner/mozrunner/base/device.py b/testing/mozbase/mozrunner/mozrunner/base/device.py index 2252203d1..6eeef042f 100644 --- a/testing/mozbase/mozrunner/mozrunner/base/device.py +++ b/testing/mozbase/mozrunner/mozrunner/base/device.py @@ -22,8 +22,7 @@ class DeviceRunner(BaseRunner): The base runner class used for running gecko on remote devices (or emulators), such as B2G. """ - env = {'MOZ_CRASHREPORTER': '1', - 'MOZ_CRASHREPORTER_NO_REPORT': '1', + env = {'MOZ_CRASHREPORTER_NO_REPORT': '1', 'MOZ_CRASHREPORTER_SHUTDOWN': '1', 'MOZ_HIDE_RESULTS_TABLE': '1', 'MOZ_LOG': 'signaling:3,mtransport:4,DataChannel:4,jsep:4,MediaPipelineFactory:4', diff --git a/testing/mozbase/mozrunner/mozrunner/utils.py b/testing/mozbase/mozrunner/mozrunner/utils.py index f96c94398..79f26b8f2 100755 --- a/testing/mozbase/mozrunner/mozrunner/utils.py +++ b/testing/mozbase/mozrunner/mozrunner/utils.py @@ -132,7 +132,6 @@ def test_environment(xrePath, env=None, crashreporter=True, debugger=False, if crashreporter and not debugger: env['MOZ_CRASHREPORTER_NO_REPORT'] = '1' - env['MOZ_CRASHREPORTER'] = '1' else: env['MOZ_CRASHREPORTER_DISABLE'] = '1' diff --git a/testing/runcppunittests.py b/testing/runcppunittests.py index d8b79f68f..fdd6abc1f 100755 --- a/testing/runcppunittests.py +++ b/testing/runcppunittests.py @@ -90,7 +90,6 @@ class CPPUnitTests(object): # been fixed to enable crash reporting env["XPCOM_DEBUG_BREAK"] = "stack-and-abort" env["MOZ_CRASHREPORTER_NO_REPORT"] = "1" - env["MOZ_CRASHREPORTER"] = "1" return env def build_environment(self): diff --git a/testing/talos/talos/ffsetup.py b/testing/talos/talos/ffsetup.py index 22a9dea07..14ff576d5 100644 --- a/testing/talos/talos/ffsetup.py +++ b/testing/talos/talos/ffsetup.py @@ -67,10 +67,7 @@ class FFSetup(object): # for winxp e10s logging: # https://bugzilla.mozilla.org/show_bug.cgi?id=1037445 self.env['MOZ_WIN_INHERIT_STD_HANDLES_PRE_VISTA'] = '1' - if self.browser_config['symbols_path']: - self.env['MOZ_CRASHREPORTER'] = '1' - else: - self.env['MOZ_CRASHREPORTER_DISABLE'] = '1' + self.env['MOZ_CRASHREPORTER_DISABLE'] = '1' self.env['MOZ_DISABLE_NONLOCAL_CONNECTIONS'] = '1' diff --git a/testing/xpcshell/runxpcshelltests.py b/testing/xpcshell/runxpcshelltests.py index 7c88343dc..34af6639f 100755 --- a/testing/xpcshell/runxpcshelltests.py +++ b/testing/xpcshell/runxpcshelltests.py @@ -910,9 +910,6 @@ class XPCShellTests(object): """ # Make assertions fatal self.env["XPCOM_DEBUG_BREAK"] = "stack-and-abort" - # Crash reporting interferes with debugging - if not self.debuggerInfo: - self.env["MOZ_CRASHREPORTER"] = "1" # Don't launch the crash reporter client self.env["MOZ_CRASHREPORTER_NO_REPORT"] = "1" # Don't permit remote connections by default. diff --git a/toolkit/components/moz.build b/toolkit/components/moz.build index 12e1748e9..5dba09a32 100644 --- a/toolkit/components/moz.build +++ b/toolkit/components/moz.build @@ -79,9 +79,6 @@ if not CONFIG['MOZ_FENNEC']: if CONFIG['NS_PRINTING']: DIRS += ['printing'] -if CONFIG['MOZ_CRASHREPORTER']: - DIRS += ['crashes'] - if CONFIG['BUILD_CTYPES']: DIRS += ['ctypes'] diff --git a/toolkit/components/places/tests/cpp/places_test_harness_tail.h b/toolkit/components/places/tests/cpp/places_test_harness_tail.h index 4bbd45ccb..9e57c3724 100644 --- a/toolkit/components/places/tests/cpp/places_test_harness_tail.h +++ b/toolkit/components/places/tests/cpp/places_test_harness_tail.h @@ -6,9 +6,6 @@ #include "nsWidgetsCID.h" #include "nsIComponentRegistrar.h" -#ifdef MOZ_CRASHREPORTER -#include "nsICrashReporter.h" -#endif #ifndef TEST_NAME #error "Must #define TEST_NAME before including places_test_harness_tail.h" @@ -94,32 +91,6 @@ main(int aArgc, return -1; } -#ifdef MOZ_CRASHREPORTER - char* enabled = PR_GetEnv("MOZ_CRASHREPORTER"); - if (enabled && !strcmp(enabled, "1")) { - // bug 787458: move this to an even-more-common location to use in all - // C++ unittests - nsCOMPtr<nsICrashReporter> crashreporter = - do_GetService("@mozilla.org/toolkit/crash-reporter;1"); - if (crashreporter) { - fprintf(stderr, "Setting up crash reporting\n"); - - nsCOMPtr<nsIProperties> dirsvc = - do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID); - if (!dirsvc) - NS_RUNTIMEABORT("Couldn't get directory service"); - nsCOMPtr<nsIFile> cwd; - nsresult rv = dirsvc->Get(NS_OS_CURRENT_WORKING_DIR, - NS_GET_IID(nsIFile), - getter_AddRefs(cwd)); - if (NS_FAILED(rv)) - NS_RUNTIMEABORT("Couldn't get CWD"); - crashreporter->SetEnabled(true); - crashreporter->SetMinidumpPath(cwd); - } - } -#endif - RefPtr<WaitForConnectionClosed> spinClose = new WaitForConnectionClosed(); // Tinderboxes are constantly on idle. Since idle tasks can interact with diff --git a/toolkit/components/terminator/nsTerminator.cpp b/toolkit/components/terminator/nsTerminator.cpp index f9459cc5d..91e872821 100644 --- a/toolkit/components/terminator/nsTerminator.cpp +++ b/toolkit/components/terminator/nsTerminator.cpp @@ -29,9 +29,6 @@ #include "nsIObserverService.h" #include "nsIPrefService.h" -#if defined(MOZ_CRASHREPORTER) -#include "nsExceptionHandler.h" -#endif #if defined(XP_WIN) #include <windows.h> @@ -541,13 +538,7 @@ nsTerminator::UpdateTelemetry() void nsTerminator::UpdateCrashReport(const char* aTopic) { -#if defined(MOZ_CRASHREPORTER) - // In case of crash, we wish to know where in shutdown we are - nsAutoCString report(aTopic); - - Unused << CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ShutdownProgress"), - report); -#endif // defined(MOZ_CRASH_REPORTER) + /*** STUB ***/ } diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js index 5daf6d189..3bd06ddcc 100644 --- a/toolkit/content/aboutSupport.js +++ b/toolkit/content/aboutSupport.js @@ -75,69 +75,7 @@ var snapshotFormatters = { }, crashes: function crashes(data) { - if (!AppConstants.MOZ_CRASHREPORTER) - return; - - let strings = stringBundle(); - let daysRange = Troubleshoot.kMaxCrashAge / (24 * 60 * 60 * 1000); - $("crashes-title").textContent = - PluralForm.get(daysRange, strings.GetStringFromName("crashesTitle")) - .replace("#1", daysRange); - let reportURL; - try { - reportURL = Services.prefs.getCharPref("breakpad.reportURL"); - // Ignore any non http/https urls - if (!/^https?:/i.test(reportURL)) - reportURL = null; - } - catch (e) { } - if (!reportURL) { - $("crashes-noConfig").style.display = "block"; - $("crashes-noConfig").classList.remove("no-copy"); - return; - } - $("crashes-allReports").style.display = "block"; - $("crashes-allReports").classList.remove("no-copy"); - - if (data.pending > 0) { - $("crashes-allReportsWithPending").textContent = - PluralForm.get(data.pending, strings.GetStringFromName("pendingReports")) - .replace("#1", data.pending); - } - - let dateNow = new Date(); - $.append($("crashes-tbody"), data.submitted.map(function (crash) { - let date = new Date(crash.date); - let timePassed = dateNow - date; - let formattedDate; - if (timePassed >= 24 * 60 * 60 * 1000) - { - let daysPassed = Math.round(timePassed / (24 * 60 * 60 * 1000)); - let daysPassedString = strings.GetStringFromName("crashesTimeDays"); - formattedDate = PluralForm.get(daysPassed, daysPassedString) - .replace("#1", daysPassed); - } - else if (timePassed >= 60 * 60 * 1000) - { - let hoursPassed = Math.round(timePassed / (60 * 60 * 1000)); - let hoursPassedString = strings.GetStringFromName("crashesTimeHours"); - formattedDate = PluralForm.get(hoursPassed, hoursPassedString) - .replace("#1", hoursPassed); - } - else - { - let minutesPassed = Math.max(Math.round(timePassed / (60 * 1000)), 1); - let minutesPassedString = strings.GetStringFromName("crashesTimeMinutes"); - formattedDate = PluralForm.get(minutesPassed, minutesPassedString) - .replace("#1", minutesPassed); - } - return $.new("tr", [ - $.new("td", [ - $.new("a", crash.id, null, {href : reportURL + crash.id}) - ]), - $.new("td", formattedDate) - ]); - })); + return; }, extensions: function extensions(data) { diff --git a/toolkit/content/aboutSupport.xhtml b/toolkit/content/aboutSupport.xhtml index e2885c8b8..6d9f34b7e 100644 --- a/toolkit/content/aboutSupport.xhtml +++ b/toolkit/content/aboutSupport.xhtml @@ -253,34 +253,6 @@ </table> <!-- - - - - - - - - - - - - - - - - - - - - --> -#ifdef MOZ_CRASHREPORTER - - <h2 class="major-section" id="crashes-title"> - &aboutSupport.crashes.title; - </h2> - - <table id="crashes-table"> - <thead> - <tr> - <th> - &aboutSupport.crashes.id; - </th> - <th> - &aboutSupport.crashes.sendDate; - </th> - </tr> - </thead> - <tbody id="crashes-tbody"> - </tbody> - </table> - <p id="crashes-allReports" class="hidden no-copy"> - <a href="about:crashes" id="crashes-allReportsWithPending" class="block">&aboutSupport.crashes.allReports;</a> - </p> - <p id="crashes-noConfig" class="hidden no-copy">&aboutSupport.crashes.noConfig;</p> - -#endif - <!-- - - - - - - - - - - - - - - - - - - - - --> - <h2 class="major-section"> &aboutSupport.extensionsTitle; </h2> diff --git a/toolkit/content/browser-child.js b/toolkit/content/browser-child.js index c819e3db6..7d0fe18c5 100644 --- a/toolkit/content/browser-child.js +++ b/toolkit/content/browser-child.js @@ -17,12 +17,6 @@ Cu.import("resource://gre/modules/Timer.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "PageThumbUtils", "resource://gre/modules/PageThumbUtils.jsm"); -if (AppConstants.MOZ_CRASHREPORTER) { - XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter", - "@mozilla.org/xre/app-info;1", - "nsICrashReporter"); -} - function makeInputStream(aString) { let stream = Cc["@mozilla.org/io/string-input-stream;1"]. createInstance(Ci.nsISupportsCString); @@ -174,15 +168,6 @@ var WebProgressListener = { json.principal = content.document.nodePrincipal; json.synthetic = content.document.mozSyntheticDocument; json.inLoadURI = WebNavigation.inLoadURI; - - if (AppConstants.MOZ_CRASHREPORTER && CrashReporter.enabled) { - let uri = aLocationURI.clone(); - try { - // If the current URI contains a username/password, remove it. - uri.userPass = ""; - } catch (ex) { /* Ignore failures on about: URIs. */ } - CrashReporter.annotateCrashReport("URL", uri.spec); - } } this._send("Content:LocationChange", json, objects); @@ -310,17 +295,6 @@ var WebNavigation = { }, loadURI: function(uri, flags, referrer, referrerPolicy, postData, headers, baseURI) { - if (AppConstants.MOZ_CRASHREPORTER && CrashReporter.enabled) { - let annotation = uri; - try { - let url = Services.io.newURI(uri, null, null); - // If the current URI contains a username/password, remove it. - url.userPass = ""; - annotation = url.spec; - } catch (ex) { /* Ignore failures to parse and failures - on about: URIs. */ } - CrashReporter.annotateCrashReport("URL", annotation); - } if (referrer) referrer = Services.io.newURI(referrer, null, null); if (postData) diff --git a/toolkit/locales/Makefile.in b/toolkit/locales/Makefile.in index e20128611..189e0b1b0 100644 --- a/toolkit/locales/Makefile.in +++ b/toolkit/locales/Makefile.in @@ -30,11 +30,3 @@ chrome-%: libs:: update.locale sed -e 's/%AB_CD%/$(AB_CD)/' $< > $(FINAL_TARGET)/update.locale -ifdef MOZ_CRASHREPORTER -libs:: crashreporter.ini -ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) - $(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/crashreporter.app/Contents/Resources -else - $(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET) -endif -endif diff --git a/toolkit/locales/l10n.mk b/toolkit/locales/l10n.mk index 34d78d33c..05bda0b56 100644 --- a/toolkit/locales/l10n.mk +++ b/toolkit/locales/l10n.mk @@ -120,14 +120,6 @@ ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) ifneq (en,$(LPROJ_ROOT)) mv $(STAGEDIST)/en.lproj $(STAGEDIST)/$(LPROJ_ROOT).lproj endif -ifdef MOZ_CRASHREPORTER -# On Mac OS X, the crashreporter.ini file needs to be moved from under the -# application bundle's Resources directory where all other l10n files are -# located to the crash reporter bundle's Resources directory. - mv $(STAGEDIST)/crashreporter.app/Contents/Resources/crashreporter.ini \ - $(STAGEDIST)/../MacOS/crashreporter.app/Contents/Resources/crashreporter.ini - $(RM) -rf $(STAGEDIST)/crashreporter.app -endif endif $(NSINSTALL) -D $(DIST)/l10n-stage/$(PKG_PATH) diff --git a/toolkit/modules/AppConstants.jsm b/toolkit/modules/AppConstants.jsm index ba5d82c01..93acea0ec 100644 --- a/toolkit/modules/AppConstants.jsm +++ b/toolkit/modules/AppConstants.jsm @@ -183,13 +183,6 @@ this.AppConstants = Object.freeze({ Services.vc.compare(platformVersion, version) <= 0; }, - MOZ_CRASHREPORTER: -#ifdef MOZ_CRASHREPORTER - true, -#else - false, -#endif - MOZ_VERIFY_MAR_SIGNATURE: #ifdef MOZ_VERIFY_MAR_SIGNATURE true, diff --git a/toolkit/modules/Services.jsm b/toolkit/modules/Services.jsm index 1bf1a89fe..58d87ffb1 100644 --- a/toolkit/modules/Services.jsm +++ b/toolkit/modules/Services.jsm @@ -39,15 +39,6 @@ XPCOMUtils.defineLazyGetter(Services, "dirsvc", function () { .QueryInterface(Ci.nsIProperties); }); -#ifdef MOZ_CRASHREPORTER -XPCOMUtils.defineLazyGetter(Services, "crashmanager", () => { - let ns = {}; - Components.utils.import("resource://gre/modules/CrashManager.jsm", ns); - - return ns.CrashManager.Singleton; -}); -#endif - XPCOMUtils.defineLazyGetter(Services, "mm", () => { return Cc["@mozilla.org/globalmessagemanager;1"] .getService(Ci.nsIMessageBroadcaster) diff --git a/toolkit/modules/Troubleshoot.jsm b/toolkit/modules/Troubleshoot.jsm index cc545b4c4..cdcd6b085 100644 --- a/toolkit/modules/Troubleshoot.jsm +++ b/toolkit/modules/Troubleshoot.jsm @@ -549,19 +549,6 @@ var dataProviders = { } }; -if (AppConstants.MOZ_CRASHREPORTER) { - dataProviders.crashes = function crashes(done) { - let CrashReports = Cu.import("resource://gre/modules/CrashReports.jsm").CrashReports; - let reports = CrashReports.getReports(); - let now = new Date(); - let reportsNew = reports.filter(report => (now - report.date < Troubleshoot.kMaxCrashAge)); - let reportsSubmitted = reportsNew.filter(report => (!report.pending)); - let reportsPendingCount = reportsNew.length - reportsSubmitted.length; - let data = {submitted : reportsSubmitted, pending : reportsPendingCount}; - done(data); - } -} - if (AppConstants.MOZ_SANDBOX) { dataProviders.sandbox = function sandbox(done) { let data = {}; diff --git a/toolkit/moz.build b/toolkit/moz.build index d9becc9c6..778f1c0de 100644 --- a/toolkit/moz.build +++ b/toolkit/moz.build @@ -54,9 +54,6 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': DIRS += ['system/androidproxy'] -if CONFIG['MOZ_CRASHREPORTER']: - DIRS += ['crashreporter'] - TEST_HARNESS_FILES.testing.mochitest.browser.toolkit.crashreporter.test.browser += [ 'crashreporter/test/browser/crashreport.sjs', ] diff --git a/toolkit/profile/nsProfileLock.cpp b/toolkit/profile/nsProfileLock.cpp index 08d109224..cc9ecb62e 100644 --- a/toolkit/profile/nsProfileLock.cpp +++ b/toolkit/profile/nsProfileLock.cpp @@ -30,7 +30,7 @@ #include "prenv.h" #endif -#if defined(MOZ_WIDGET_GONK) && !defined(MOZ_CRASHREPORTER) +#if defined(MOZ_WIDGET_GONK) #include <sys/syscall.h> #endif @@ -198,7 +198,6 @@ void nsProfileLock::FatalSignalHandler(int signo case SIGILL: case SIGABRT: case SIGSEGV: -#ifndef MOZ_CRASHREPORTER // Retrigger the signal for those that can generate a core dump signal(signo, SIG_DFL); if (info->si_code <= 0) { @@ -206,7 +205,6 @@ void nsProfileLock::FatalSignalHandler(int signo break; } } -#endif return; default: break; diff --git a/toolkit/toolkit.mozbuild b/toolkit/toolkit.mozbuild index a782acd3a..3b3bf80ae 100644 --- a/toolkit/toolkit.mozbuild +++ b/toolkit/toolkit.mozbuild @@ -181,10 +181,6 @@ if CONFIG['ENABLE_TESTS']: '/testing/web-platform', ] - # The file id utility requires breakpad libraries. - if CONFIG['MOZ_CRASHREPORTER']: - DIRS += ['/testing/tools/fileid'] - if CONFIG['MOZ_MEMORY']: DIRS += ['/memory/gtest'] diff --git a/toolkit/xre/nsAndroidStartup.cpp b/toolkit/xre/nsAndroidStartup.cpp index a88c58e5d..47b9ec6e5 100644 --- a/toolkit/xre/nsAndroidStartup.cpp +++ b/toolkit/xre/nsAndroidStartup.cpp @@ -26,15 +26,6 @@ GeckoStart(JNIEnv* env, char* data, const nsXREAppData* appData) { mozilla::jni::SetGeckoThreadEnv(env); -#ifdef MOZ_CRASHREPORTER - const struct mapping_info *info = getLibraryMapping(); - while (info->name) { - CrashReporter::AddLibraryMapping(info->name, info->base, - info->len, info->offset); - info++; - } -#endif - if (!data) { LOG("Failed to get arguments for GeckoStart\n"); return; diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 1b5c2ed75..b65a4093f 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -190,17 +190,6 @@ #include "jprof.h" #endif -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#include "nsICrashReporter.h" -#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1" -#include "nsIPrefService.h" -#include "nsIMemoryInfoDumper.h" -#if defined(XP_LINUX) && !defined(ANDROID) -#include "mozilla/widget/LSBUtils.h" -#endif -#endif - #include "base/command_line.h" #include "GTestRunner.h" @@ -646,10 +635,6 @@ class nsXULAppInfo : public nsIXULAppInfo, #ifdef XP_WIN public nsIWinAppHelper, #endif -#ifdef MOZ_CRASHREPORTER - public nsICrashReporter, - public nsIFinishDumpingCallback, -#endif public nsIXULRuntime { @@ -660,10 +645,6 @@ public: NS_DECL_NSIXULAPPINFO NS_DECL_NSIXULRUNTIME NS_DECL_NSIOBSERVER -#ifdef MOZ_CRASHREPORTER - NS_DECL_NSICRASHREPORTER - NS_DECL_NSIFINISHDUMPINGCALLBACK -#endif #ifdef XP_WIN NS_DECL_NSIWINAPPHELPER #endif @@ -676,10 +657,6 @@ NS_INTERFACE_MAP_BEGIN(nsXULAppInfo) #ifdef XP_WIN NS_INTERFACE_MAP_ENTRY(nsIWinAppHelper) #endif -#ifdef MOZ_CRASHREPORTER - NS_INTERFACE_MAP_ENTRY(nsICrashReporter) - NS_INTERFACE_MAP_ENTRY(nsIFinishDumpingCallback) -#endif NS_INTERFACE_MAP_ENTRY(nsIPlatformInfo) NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIXULAppInfo, gAppData || XRE_IsContentProcess()) @@ -1004,12 +981,7 @@ nsXULAppInfo::GetReplacedLockTime(PRTime *aReplacedLockTime) NS_IMETHODIMP nsXULAppInfo::GetLastRunCrashID(nsAString &aLastRunCrashID) { -#ifdef MOZ_CRASHREPORTER - CrashReporter::GetLastRunCrashID(aLastRunCrashID); - return NS_OK; -#else return NS_ERROR_NOT_IMPLEMENTED; -#endif } NS_IMETHODIMP @@ -1117,219 +1089,6 @@ nsXULAppInfo::GetUserCanElevate(bool *aUserCanElevate) } #endif -#ifdef MOZ_CRASHREPORTER -NS_IMETHODIMP -nsXULAppInfo::GetEnabled(bool *aEnabled) -{ - *aEnabled = CrashReporter::GetEnabled(); - return NS_OK; -} - -NS_IMETHODIMP -nsXULAppInfo::SetEnabled(bool aEnabled) -{ - if (aEnabled) { - if (CrashReporter::GetEnabled()) { - // no point in erroring for double-enabling - return NS_OK; - } - - nsCOMPtr<nsIFile> greBinDir; - NS_GetSpecialDirectory(NS_GRE_BIN_DIR, getter_AddRefs(greBinDir)); - if (!greBinDir) { - return NS_ERROR_FAILURE; - } - - nsCOMPtr<nsIFile> xreBinDirectory = do_QueryInterface(greBinDir); - if (!xreBinDirectory) { - return NS_ERROR_FAILURE; - } - - return CrashReporter::SetExceptionHandler(xreBinDirectory, true); - } - else { - if (!CrashReporter::GetEnabled()) { - // no point in erroring for double-disabling - return NS_OK; - } - - return CrashReporter::UnsetExceptionHandler(); - } -} - -NS_IMETHODIMP -nsXULAppInfo::GetServerURL(nsIURL** aServerURL) -{ - if (!CrashReporter::GetEnabled()) - return NS_ERROR_NOT_INITIALIZED; - - nsAutoCString data; - if (!CrashReporter::GetServerURL(data)) { - return NS_ERROR_FAILURE; - } - nsCOMPtr<nsIURI> uri; - NS_NewURI(getter_AddRefs(uri), data); - if (!uri) - return NS_ERROR_FAILURE; - - nsCOMPtr<nsIURL> url; - url = do_QueryInterface(uri); - NS_ADDREF(*aServerURL = url); - - return NS_OK; -} - -NS_IMETHODIMP -nsXULAppInfo::SetServerURL(nsIURL* aServerURL) -{ - bool schemeOk; - // only allow https or http URLs - nsresult rv = aServerURL->SchemeIs("https", &schemeOk); - NS_ENSURE_SUCCESS(rv, rv); - if (!schemeOk) { - rv = aServerURL->SchemeIs("http", &schemeOk); - NS_ENSURE_SUCCESS(rv, rv); - - if (!schemeOk) - return NS_ERROR_INVALID_ARG; - } - nsAutoCString spec; - rv = aServerURL->GetSpec(spec); - NS_ENSURE_SUCCESS(rv, rv); - - return CrashReporter::SetServerURL(spec); -} - -NS_IMETHODIMP -nsXULAppInfo::GetMinidumpPath(nsIFile** aMinidumpPath) -{ - if (!CrashReporter::GetEnabled()) - return NS_ERROR_NOT_INITIALIZED; - - nsAutoString path; - if (!CrashReporter::GetMinidumpPath(path)) - return NS_ERROR_FAILURE; - - nsresult rv = NS_NewLocalFile(path, false, aMinidumpPath); - NS_ENSURE_SUCCESS(rv, rv); - return NS_OK; -} - -NS_IMETHODIMP -nsXULAppInfo::SetMinidumpPath(nsIFile* aMinidumpPath) -{ - nsAutoString path; - nsresult rv = aMinidumpPath->GetPath(path); - NS_ENSURE_SUCCESS(rv, rv); - return CrashReporter::SetMinidumpPath(path); -} - -NS_IMETHODIMP -nsXULAppInfo::AnnotateCrashReport(const nsACString& key, - const nsACString& data) -{ - return CrashReporter::AnnotateCrashReport(key, data); -} - -NS_IMETHODIMP -nsXULAppInfo::AppendAppNotesToCrashReport(const nsACString& data) -{ - return CrashReporter::AppendAppNotesToCrashReport(data); -} - -NS_IMETHODIMP -nsXULAppInfo::RegisterAppMemory(uint64_t pointer, - uint64_t len) -{ - return CrashReporter::RegisterAppMemory((void *)pointer, len); -} - -NS_IMETHODIMP -nsXULAppInfo::WriteMinidumpForException(void* aExceptionInfo) -{ -#ifdef XP_WIN32 - return CrashReporter::WriteMinidumpForException(static_cast<EXCEPTION_POINTERS*>(aExceptionInfo)); -#else - return NS_ERROR_NOT_IMPLEMENTED; -#endif -} - -NS_IMETHODIMP -nsXULAppInfo::AppendObjCExceptionInfoToAppNotes(void* aException) -{ -#ifdef XP_MACOSX - return CrashReporter::AppendObjCExceptionInfoToAppNotes(aException); -#else - return NS_ERROR_NOT_IMPLEMENTED; -#endif -} - -NS_IMETHODIMP -nsXULAppInfo::GetSubmitReports(bool* aEnabled) -{ - return CrashReporter::GetSubmitReports(aEnabled); -} - -NS_IMETHODIMP -nsXULAppInfo::SetSubmitReports(bool aEnabled) -{ - return CrashReporter::SetSubmitReports(aEnabled); -} - -NS_IMETHODIMP -nsXULAppInfo::UpdateCrashEventsDir() -{ - CrashReporter::UpdateCrashEventsDir(); - return NS_OK; -} - -NS_IMETHODIMP -nsXULAppInfo::SaveMemoryReport() -{ - if (!CrashReporter::GetEnabled()) { - return NS_ERROR_NOT_INITIALIZED; - } - nsCOMPtr<nsIFile> file; - nsresult rv = CrashReporter::GetDefaultMemoryReportFile(getter_AddRefs(file)); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - - nsString path; - file->GetPath(path); - - nsCOMPtr<nsIMemoryInfoDumper> dumper = - do_GetService("@mozilla.org/memory-info-dumper;1"); - if (NS_WARN_IF(!dumper)) { - return NS_ERROR_UNEXPECTED; - } - - rv = dumper->DumpMemoryReportsToNamedFile(path, this, file, true /* anonymize */); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - return NS_OK; -} - -NS_IMETHODIMP -nsXULAppInfo::SetTelemetrySessionId(const nsACString& id) -{ - CrashReporter::SetTelemetrySessionId(id); - return NS_OK; -} - -// This method is from nsIFInishDumpingCallback. -NS_IMETHODIMP -nsXULAppInfo::Callback(nsISupports* aData) -{ - nsCOMPtr<nsIFile> file = do_QueryInterface(aData); - MOZ_ASSERT(file); - - CrashReporter::SetMemoryReportFile(file); - return NS_OK; -} -#endif - static const nsXULAppInfo kAppInfo; static nsresult AppInfoConstructor(nsISupports* aOuter, REFNSIID aIID, void **aResult) @@ -1434,9 +1193,6 @@ static const mozilla::Module::CIDEntry kXRECIDs[] = { static const mozilla::Module::ContractIDEntry kXREContracts[] = { { XULAPPINFO_SERVICE_CONTRACTID, &kAPPINFO_CID }, { XULRUNTIME_SERVICE_CONTRACTID, &kAPPINFO_CID }, -#ifdef MOZ_CRASHREPORTER - { NS_CRASHREPORTER_CONTRACTID, &kAPPINFO_CID }, -#endif { NS_PROFILESERVICE_CONTRACTID, &kProfileServiceCID }, { NS_NATIVEAPPSUPPORT_CONTRACTID, &kNativeAppSupportCID }, { nullptr } @@ -2763,33 +2519,6 @@ static void RestoreStateForAppInitiatedRestart() } } -#ifdef MOZ_CRASHREPORTER -// When we first initialize the crash reporter we don't have a profile, -// so we set the minidump path to $TEMP. Once we have a profile, -// we set it to $PROFILE/minidumps, creating the directory -// if needed. -static void MakeOrSetMinidumpPath(nsIFile* profD) -{ - nsCOMPtr<nsIFile> dumpD; - profD->Clone(getter_AddRefs(dumpD)); - - if (dumpD) { - bool fileExists; - //XXX: do some more error checking here - dumpD->Append(NS_LITERAL_STRING("minidumps")); - dumpD->Exists(&fileExists); - if (!fileExists) { - nsresult rv = dumpD->Create(nsIFile::DIRECTORY_TYPE, 0700); - NS_ENSURE_SUCCESS_VOID(rv); - } - - nsAutoString pathStr; - if (NS_SUCCEEDED(dumpD->GetPath(pathStr))) - CrashReporter::SetMinidumpPath(pathStr); - } -} -#endif - const nsXREAppData* gAppData = nullptr; #ifdef MOZ_WIDGET_GTK @@ -3215,94 +2944,6 @@ XREMain::XRE_mainInit(bool* aExitFlag) if (NS_FAILED(rv)) return 1; -#ifdef MOZ_CRASHREPORTER - if (EnvHasValue("MOZ_CRASHREPORTER")) { - mAppData->flags |= NS_XRE_ENABLE_CRASH_REPORTER; - } - - nsCOMPtr<nsIFile> xreBinDirectory; - xreBinDirectory = mDirProvider.GetGREBinDir(); - - if ((mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER) && - NS_SUCCEEDED( - CrashReporter::SetExceptionHandler(xreBinDirectory))) { - nsCOMPtr<nsIFile> file; - rv = mDirProvider.GetUserAppDataDirectory(getter_AddRefs(file)); - if (NS_SUCCEEDED(rv)) { - CrashReporter::SetUserAppDataDirectory(file); - } - if (mAppData->crashReporterURL) - CrashReporter::SetServerURL(nsDependentCString(mAppData->crashReporterURL)); - - // We overwrite this once we finish starting up. - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("StartupCrash"), - NS_LITERAL_CSTRING("1")); - - // pass some basic info from the app data - if (mAppData->vendor) - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Vendor"), - nsDependentCString(mAppData->vendor)); - if (mAppData->name) - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProductName"), - nsDependentCString(mAppData->name)); - if (mAppData->ID) - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProductID"), - nsDependentCString(mAppData->ID)); - if (mAppData->version) - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Version"), - nsDependentCString(mAppData->version)); - if (mAppData->buildID) - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("BuildID"), - nsDependentCString(mAppData->buildID)); - - nsDependentCString releaseChannel(NS_STRINGIFY(MOZ_UPDATE_CHANNEL)); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ReleaseChannel"), - releaseChannel); -#ifdef MOZ_LINKER - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CrashAddressLikelyWrong"), - IsSignalHandlingBroken() ? NS_LITERAL_CSTRING("1") - : NS_LITERAL_CSTRING("0")); -#endif - -#ifdef XP_WIN - nsAutoString appInitDLLs; - if (widget::WinUtils::GetAppInitDLLs(appInitDLLs)) { - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AppInitDLLs"), - NS_ConvertUTF16toUTF8(appInitDLLs)); - } -#endif - - CrashReporter::SetRestartArgs(gArgc, gArgv); - - // annotate other data (user id etc) - nsCOMPtr<nsIFile> userAppDataDir; - if (NS_SUCCEEDED(mDirProvider.GetUserAppDataDirectory( - getter_AddRefs(userAppDataDir)))) { - CrashReporter::SetupExtraData(userAppDataDir, - nsDependentCString(mAppData->buildID)); - - // see if we have a crashreporter-override.ini in the application directory - nsCOMPtr<nsIFile> overrideini; - bool exists; - if (NS_SUCCEEDED(mDirProvider.GetAppDir()->Clone(getter_AddRefs(overrideini))) && - NS_SUCCEEDED(overrideini->AppendNative(NS_LITERAL_CSTRING("crashreporter-override.ini"))) && - NS_SUCCEEDED(overrideini->Exists(&exists)) && - exists) { -#ifdef XP_WIN - nsAutoString overridePathW; - overrideini->GetPath(overridePathW); - NS_ConvertUTF16toUTF8 overridePath(overridePathW); -#else - nsAutoCString overridePath; - overrideini->GetNativePath(overridePath); -#endif - - SaveWordToEnv("MOZ_CRASHREPORTER_STRINGS_OVERRIDE", overridePath); - } - } - } -#endif - #if defined(MOZ_SANDBOX) && defined(XP_WIN) if (mAppData->sandboxBrokerServices) { SandboxBroker::Initialize(mAppData->sandboxBrokerServices); @@ -3448,22 +3089,9 @@ XREMain::XRE_mainInit(bool* aExitFlag) } } -#ifdef MOZ_CRASHREPORTER - if (cpuUpdateRevision > 0) { - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CPUMicrocodeVersion"), - nsPrintfCString("0x%x", - cpuUpdateRevision)); - } -#endif } #endif -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("SafeMode"), - gSafeMode ? NS_LITERAL_CSTRING("1") : - NS_LITERAL_CSTRING("0")); -#endif - // Handle --no-remote and --new-instance command line arguments. Setup // the environment to better accommodate other components and various // restart scenarios. @@ -3523,102 +3151,6 @@ XREMain::XRE_mainInit(bool* aExitFlag) return 0; } -#ifdef MOZ_CRASHREPORTER -#ifdef XP_WIN -/** - * Uses WMI to read some manufacturer information that may be useful for - * diagnosing hardware-specific crashes. This function is best-effort; failures - * shouldn't burden the caller. COM must be initialized before calling. - */ -static void AnnotateSystemManufacturer() -{ - RefPtr<IWbemLocator> locator; - - HRESULT hr = CoCreateInstance(CLSID_WbemLocator, nullptr, CLSCTX_INPROC_SERVER, - IID_IWbemLocator, getter_AddRefs(locator)); - - if (FAILED(hr)) { - return; - } - - RefPtr<IWbemServices> services; - - hr = locator->ConnectServer(_bstr_t(L"ROOT\\CIMV2"), nullptr, nullptr, nullptr, - 0, nullptr, nullptr, getter_AddRefs(services)); - - if (FAILED(hr)) { - return; - } - - hr = CoSetProxyBlanket(services, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, nullptr, - RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, - nullptr, EOAC_NONE); - - if (FAILED(hr)) { - return; - } - - RefPtr<IEnumWbemClassObject> enumerator; - - hr = services->ExecQuery(_bstr_t(L"WQL"), _bstr_t(L"SELECT * FROM Win32_BIOS"), - WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, - nullptr, getter_AddRefs(enumerator)); - - if (FAILED(hr) || !enumerator) { - return; - } - - RefPtr<IWbemClassObject> classObject; - ULONG results; - - hr = enumerator->Next(WBEM_INFINITE, 1, getter_AddRefs(classObject), &results); - - if (FAILED(hr) || results == 0) { - return; - } - - VARIANT value; - VariantInit(&value); - - hr = classObject->Get(L"Manufacturer", 0, &value, 0, 0); - - if (SUCCEEDED(hr) && V_VT(&value) == VT_BSTR) { - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("BIOS_Manufacturer"), - NS_ConvertUTF16toUTF8(V_BSTR(&value))); - } - - VariantClear(&value); -} - -static void PR_CALLBACK AnnotateSystemManufacturer_ThreadStart(void*) -{ - HRESULT hr = CoInitialize(nullptr); - - if (FAILED(hr)) { - return; - } - - AnnotateSystemManufacturer(); - - CoUninitialize(); -} -#endif // XP_WIN - -#if defined(XP_LINUX) && !defined(ANDROID) - -static void -AnnotateLSBRelease(void*) -{ - nsCString dist, desc, release, codename; - if (widget::lsb::GetLSBRelease(dist, desc, release, codename)) { - CrashReporter::AppendAppNotesToCrashReport(desc); - } -} - -#endif // defined(XP_LINUX) && !defined(ANDROID) - -#endif - namespace mozilla { ShutdownChecksMode gShutdownChecks = SCM_NOTHING; } // namespace mozilla @@ -4007,13 +3539,6 @@ XREMain::XRE_mainStartup(bool* aExitFlag) mozilla::Telemetry::SetProfileDir(mProfD); -#ifdef MOZ_CRASHREPORTER - if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER) - MakeOrSetMinidumpPath(mProfD); - - CrashReporter::SetProfileDirectory(mProfD); -#endif - nsAutoCString version; BuildVersion(version); @@ -4103,39 +3628,6 @@ XREMain::XRE_mainStartup(bool* aExitFlag) return 0; } -#if defined(MOZ_CRASHREPORTER) -#if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK) -void AddSandboxAnnotations() -{ - // Include the sandbox content level, regardless of platform - int level = Preferences::GetInt("security.sandbox.content.level"); - - nsAutoCString levelString; - levelString.AppendInt(level); - - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("ContentSandboxLevel"), levelString); - - // Include whether or not this instance is capable of content sandboxing - bool sandboxCapable = false; - -#if defined(XP_WIN) - // All supported Windows versions support some level of content sandboxing - sandboxCapable = true; -#elif defined(XP_MACOSX) - // All supported OS X versions are capable - sandboxCapable = true; -#elif defined(XP_LINUX) - sandboxCapable = SandboxInfo::Get().CanSandboxContent(); -#endif - - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("ContentSandboxCapable"), - sandboxCapable ? NS_LITERAL_CSTRING("1") : NS_LITERAL_CSTRING("0")); -} -#endif /* MOZ_CONTENT_SANDBOX && !MOZ_WIDGET_GONK */ -#endif /* MOZ_CRASHREPORTER */ - /* * XRE_mainRun - Command line startup, profile migration, and * the calling of appStartup->Run(). @@ -4169,40 +3661,6 @@ XREMain::XRE_mainRun() rv = mScopedXPCOM->SetWindowCreator(mNativeApp); NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); -#ifdef MOZ_CRASHREPORTER - // tell the crash reporter to also send the release channel - nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv); - if (NS_SUCCEEDED(rv)) { - nsCOMPtr<nsIPrefBranch> defaultPrefBranch; - rv = prefs->GetDefaultBranch(nullptr, getter_AddRefs(defaultPrefBranch)); - - if (NS_SUCCEEDED(rv)) { - nsXPIDLCString sval; - rv = defaultPrefBranch->GetCharPref("app.update.channel", getter_Copies(sval)); - if (NS_SUCCEEDED(rv)) { - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ReleaseChannel"), - sval); - } - } - } - // Needs to be set after xpcom initialization. - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonBase"), - nsPrintfCString("%.16llx", uint64_t(gMozillaPoisonBase))); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonSize"), - nsPrintfCString("%lu", uint32_t(gMozillaPoisonSize))); - -#ifdef XP_WIN - PR_CreateThread(PR_USER_THREAD, AnnotateSystemManufacturer_ThreadStart, 0, - PR_PRIORITY_LOW, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0); -#endif - -#if defined(XP_LINUX) && !defined(ANDROID) - PR_CreateThread(PR_USER_THREAD, AnnotateLSBRelease, 0, PR_PRIORITY_LOW, - PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0); -#endif - -#endif - if (mStartOffline) { nsCOMPtr<nsIIOService2> io (do_GetService("@mozilla.org/network/io-service;1")); NS_ENSURE_TRUE(io, NS_ERROR_FAILURE); @@ -4308,17 +3766,6 @@ XREMain::XRE_mainRun() OverrideDefaultLocaleIfNeeded(); -#ifdef MOZ_CRASHREPORTER - nsCString userAgentLocale; - // Try a localized string first. This pref is always a localized string in - // Fennec, and might be elsewhere, too. - if (NS_SUCCEEDED(Preferences::GetLocalizedCString("general.useragent.locale", &userAgentLocale))) { - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("useragent_locale"), userAgentLocale); - } else if (NS_SUCCEEDED(Preferences::GetCString("general.useragent.locale", &userAgentLocale))) { - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("useragent_locale"), userAgentLocale); - } -#endif - appStartup->GetShuttingDown(&mShuttingDown); nsCOMPtr<nsICommandLineRunner> cmdLine; @@ -4411,11 +3858,6 @@ XREMain::XRE_mainRun() (void)appStartup->DoneStartingUp(); -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("StartupCrash"), - NS_LITERAL_CSTRING("0")); -#endif - appStartup->GetShuttingDown(&mShuttingDown); } @@ -4466,21 +3908,8 @@ XREMain::XRE_mainRun() sandboxInfo.Test(SandboxInfo::kEnabledForContent)); Telemetry::Accumulate(Telemetry::SANDBOX_MEDIA_ENABLED, sandboxInfo.Test(SandboxInfo::kEnabledForMedia)); -#if defined(MOZ_CRASHREPORTER) - nsAutoCString flagsString; - flagsString.AppendInt(sandboxInfo.AsInteger()); - - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("ContentSandboxCapabilities"), flagsString); -#endif /* MOZ_CRASHREPORTER */ #endif /* MOZ_SANDBOX && XP_LINUX && !MOZ_WIDGET_GONK */ -#if defined(MOZ_CRASHREPORTER) -#if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK) - AddSandboxAnnotations(); -#endif /* MOZ_CONTENT_SANDBOX && !MOZ_WIDGET_GONK */ -#endif /* MOZ_CRASHREPORTER */ - { rv = appStartup->Run(); if (NS_FAILED(rv)) { @@ -4673,10 +4102,6 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData) rv = LaunchChild(mNativeApp, true); } -#ifdef MOZ_CRASHREPORTER - if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER) - CrashReporter::UnsetExceptionHandler(); -#endif return rv == NS_ERROR_LAUNCHED_CHILD_PROCESS ? 0 : 1; } @@ -4686,11 +4111,6 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData) MOZ_gdk_display_close(mGdkDisplay); #endif -#ifdef MOZ_CRASHREPORTER - if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER) - CrashReporter::UnsetExceptionHandler(); -#endif - XRE_DeinitCommandLine(); return NS_FAILED(rv) ? 1 : 0; @@ -4863,12 +4283,6 @@ MultiprocessBlockPolicy() { bool addonsCanDisable = Preferences::GetBool("extensions.e10sBlocksEnabling", false); bool disabledByAddons = Preferences::GetBool("extensions.e10sBlockedByAddons", false); -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AddonsShouldHaveBlockedE10s"), - disabledByAddons ? NS_LITERAL_CSTRING("1") - : NS_LITERAL_CSTRING("0")); -#endif - if (addonsCanDisable && disabledByAddons) { gMultiprocessBlockPolicy = kE10sDisabledForAddons; return gMultiprocessBlockPolicy; diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp index 1e67ea7ce..4a612e495 100644 --- a/toolkit/xre/nsEmbedFunctions.cpp +++ b/toolkit/xre/nsEmbedFunctions.cpp @@ -239,30 +239,6 @@ XRE_SetProcessType(const char* aProcessTypeString) } } -#if defined(MOZ_CRASHREPORTER) -// FIXME/bug 539522: this out-of-place function is stuck here because -// IPDL wants access to this crashreporter interface, and -// crashreporter is built in such a way to make that awkward -bool -XRE_TakeMinidumpForChild(uint32_t aChildPid, nsIFile** aDump, - uint32_t* aSequence) -{ - return CrashReporter::TakeMinidumpForChild(aChildPid, aDump, aSequence); -} - -bool -XRE_SetRemoteExceptionHandler(const char* aPipe/*= 0*/) -{ -#if defined(XP_WIN) || defined(XP_MACOSX) - return CrashReporter::SetRemoteExceptionHandler(nsDependentCString(aPipe)); -#elif defined(OS_LINUX) - return CrashReporter::SetRemoteExceptionHandler(); -#else -# error "OOP crash reporter unsupported on this platform" -#endif -} -#endif // if defined(MOZ_CRASHREPORTER) - #if defined(XP_WIN) void SetTaskbarGroupId(const nsString& aId) @@ -273,22 +249,6 @@ SetTaskbarGroupId(const nsString& aId) } #endif -#if defined(MOZ_CRASHREPORTER) -#if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK) -void -AddContentSandboxLevelAnnotation() -{ - if (XRE_GetProcessType() == GeckoProcessType_Content) { - int level = Preferences::GetInt("security.sandbox.content.level"); - nsAutoCString levelString; - levelString.AppendInt(level); - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("ContentSandboxLevel"), levelString); - } -} -#endif /* MOZ_CONTENT_SANDBOX && !MOZ_WIDGET_GONK */ -#endif /* MOZ_CRASHREPORTER */ - nsresult XRE_InitChildProcess(int aArgc, char* aArgv[], @@ -442,33 +402,6 @@ XRE_InitChildProcess(int aArgc, SetupErrorHandling(aArgv[0]); -#if defined(MOZ_CRASHREPORTER) - if (aArgc < 1) - return NS_ERROR_FAILURE; - const char* const crashReporterArg = aArgv[--aArgc]; - -# if defined(XP_WIN) || defined(XP_MACOSX) - // on windows and mac, |crashReporterArg| is the named pipe on which the - // server is listening for requests, or "-" if crash reporting is - // disabled. - if (0 != strcmp("-", crashReporterArg) && - !XRE_SetRemoteExceptionHandler(crashReporterArg)) { - // Bug 684322 will add better visibility into this condition - NS_WARNING("Could not setup crash reporting\n"); - } -# elif defined(OS_LINUX) - // on POSIX, |crashReporterArg| is "true" if crash reporting is - // enabled, false otherwise - if (0 != strcmp("false", crashReporterArg) && - !XRE_SetRemoteExceptionHandler(nullptr)) { - // Bug 684322 will add better visibility into this condition - NS_WARNING("Could not setup crash reporting\n"); - } -# else -# error "OOP crash reporting unsupported on this platform" -# endif -#endif // if defined(MOZ_CRASHREPORTER) - gArgv = aArgv; gArgc = aArgc; @@ -647,12 +580,6 @@ XRE_InitChildProcess(int aArgc, return NS_ERROR_FAILURE; } -#ifdef MOZ_CRASHREPORTER -#if defined(XP_WIN) || defined(XP_MACOSX) - CrashReporter::InitChildProcessTmpDir(); -#endif -#endif - #if defined(XP_WIN) // Set child processes up such that they will get killed after the // chrome process is killed in cases where the user shuts the system @@ -668,12 +595,6 @@ XRE_InitChildProcess(int aArgc, OverrideDefaultLocaleIfNeeded(); -#if defined(MOZ_CRASHREPORTER) -#if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK) - AddContentSandboxLevelAnnotation(); -#endif -#endif - // Run the UI event loop on the main thread. uiMessageLoop.MessageLoop::Run(); diff --git a/toolkit/xre/nsX11ErrorHandler.cpp b/toolkit/xre/nsX11ErrorHandler.cpp index 0db24e58b..0fb0d29c5 100644 --- a/toolkit/xre/nsX11ErrorHandler.cpp +++ b/toolkit/xre/nsX11ErrorHandler.cpp @@ -117,18 +117,6 @@ X11Error(Display *display, XErrorEvent *event) { } } -#ifdef MOZ_CRASHREPORTER - switch (XRE_GetProcessType()) { - case GeckoProcessType_Default: - case GeckoProcessType_Plugin: - case GeckoProcessType_Content: - CrashReporter::AppendAppNotesToCrashReport(notes); - break; - default: - ; // crash report notes not supported. - } -#endif - #ifdef DEBUG // The resource id is unlikely to be useful in a crash report without // context of other ids, but add it to the debug console output. diff --git a/tools/profiler/moz.build b/tools/profiler/moz.build index e48ae8f94..08103f126 100644 --- a/tools/profiler/moz.build +++ b/tools/profiler/moz.build @@ -60,14 +60,13 @@ if CONFIG['MOZ_ENABLE_PROFILER_SPS']: 'core/platform-linux.cc', 'core/shared-libraries-linux.cc', ] - if not CONFIG['MOZ_CRASHREPORTER']: - SOURCES += [ - '/toolkit/crashreporter/google-breakpad/src/common/linux/elfutils.cc', - '/toolkit/crashreporter/google-breakpad/src/common/linux/file_id.cc', - '/toolkit/crashreporter/google-breakpad/src/common/linux/guid_creator.cc', - '/toolkit/crashreporter/google-breakpad/src/common/linux/linux_libc_support.cc', - '/toolkit/crashreporter/google-breakpad/src/common/linux/memory_mapped_file.cc', - ] + SOURCES += [ + '/toolkit/crashreporter/google-breakpad/src/common/linux/elfutils.cc', + '/toolkit/crashreporter/google-breakpad/src/common/linux/file_id.cc', + '/toolkit/crashreporter/google-breakpad/src/common/linux/guid_creator.cc', + '/toolkit/crashreporter/google-breakpad/src/common/linux/linux_libc_support.cc', + '/toolkit/crashreporter/google-breakpad/src/common/linux/memory_mapped_file.cc', + ] if CONFIG['CPU_ARCH'] == 'arm': SOURCES += [ 'core/EHABIStackWalk.cpp', @@ -100,7 +99,7 @@ if CONFIG['MOZ_ENABLE_PROFILER_SPS']: '/toolkit/crashreporter/google-breakpad/src/common/android/include', ] - if not CONFIG['MOZ_CRASHREPORTER'] and CONFIG['OS_TARGET'] == 'Android': + if CONFIG['OS_TARGET'] == 'Android': SOURCES += ['/toolkit/crashreporter/google-breakpad/src/common/android/breakpad_getcontext.S'] if CONFIG['ANDROID_CPU_ARCH'] == 'armeabi': diff --git a/widget/GfxInfoBase.cpp b/widget/GfxInfoBase.cpp index 5c8693957..c937f5099 100644 --- a/widget/GfxInfoBase.cpp +++ b/widget/GfxInfoBase.cpp @@ -37,10 +37,6 @@ #include "gfxConfig.h" #include "DriverCrashGuard.h" -#if defined(MOZ_CRASHREPORTER) -#include "nsExceptionHandler.h" -#endif - using namespace mozilla::widget; using namespace mozilla; using mozilla::MutexAutoLock; diff --git a/widget/GfxInfoX11.cpp b/widget/GfxInfoX11.cpp index f490bed52..4297aaa93 100644 --- a/widget/GfxInfoX11.cpp +++ b/widget/GfxInfoX11.cpp @@ -15,11 +15,6 @@ #include "GfxInfoX11.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#include "nsICrashReporter.h" -#endif - namespace mozilla { namespace widget { @@ -176,9 +171,6 @@ GfxInfo::GetData() mAdapterDescription.Append(nsDependentCString(buf)); mAdapterDescription.Append('\n'); } -#ifdef MOZ_CRASHREPORTER - CrashReporter::AppendAppNotesToCrashReport(mAdapterDescription); -#endif return; } @@ -194,9 +186,6 @@ GfxInfo::GetData() if (mHasTextureFromPixmap) note.AppendLiteral(" -- texture_from_pixmap"); note.Append('\n'); -#ifdef MOZ_CRASHREPORTER - CrashReporter::AppendAppNotesToCrashReport(note); -#endif // determine the major OpenGL version. That's the first integer in the version string. mGLMajorVersion = strtol(mVersion.get(), 0, 10); diff --git a/widget/android/GfxInfo.cpp b/widget/android/GfxInfo.cpp index af63184a7..181629e96 100644 --- a/widget/android/GfxInfo.cpp +++ b/widget/android/GfxInfo.cpp @@ -15,12 +15,6 @@ #include "nsIWindowWatcher.h" #include "nsServiceManagerUtils.h" -#if defined(MOZ_CRASHREPORTER) -#include "nsExceptionHandler.h" -#include "nsICrashReporter.h" -#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1" -#endif - namespace mozilla { namespace widget { @@ -351,21 +345,7 @@ GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active) void GfxInfo::AddCrashReportAnnotations() { -#if defined(MOZ_CRASHREPORTER) - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterVendorID"), - mGLStrings->Vendor()); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"), - mGLStrings->Renderer()); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDriverVersion"), - mGLStrings->Version()); - - /* Add an App Note for now so that we get the data immediately. These - * can go away after we store the above in the socorro db */ - nsAutoCString note; - note.AppendPrintf("AdapterDescription: '%s'\n", mAdapterDescription.get()); - - CrashReporter::AppendAppNotesToCrashReport(note); -#endif + /*** STUB ***/ } const nsTArray<GfxDriverInfo>& diff --git a/widget/android/jni/Utils.cpp b/widget/android/jni/Utils.cpp index 145f7e9ea..919588851 100644 --- a/widget/android/jni/Utils.cpp +++ b/widget/android/jni/Utils.cpp @@ -9,10 +9,6 @@ #include "GeneratedJNIWrappers.h" #include "nsAppShell.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif - namespace mozilla { namespace jni { @@ -192,12 +188,6 @@ bool ReportException(JNIEnv* aEnv, jthrowable aExc, jstring aStack) { bool result = true; -#ifdef MOZ_CRASHREPORTER - result &= NS_SUCCEEDED(CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("JavaStackTrace"), - String::Ref::From(aStack)->ToCString())); -#endif // MOZ_CRASHREPORTER - if (sOOMErrorClass && aEnv->IsInstanceOf(aExc, sOOMErrorClass)) { NS_ABORT_OOM(0); // Unknown OOM size } diff --git a/widget/android/nsAppShell.cpp b/widget/android/nsAppShell.cpp index fefd711d0..09548c27b 100644 --- a/widget/android/nsAppShell.cpp +++ b/widget/android/nsAppShell.cpp @@ -53,11 +53,6 @@ #include "mozilla/Logging.h" #endif -#ifdef MOZ_CRASHREPORTER -#include "nsICrashReporter.h" -#include "nsExceptionHandler.h" -#endif - #include "AndroidAlerts.h" #include "ANRReporter.h" #include "GeckoBatteryManager.h" diff --git a/widget/cocoa/GfxInfo.mm b/widget/cocoa/GfxInfo.mm index 6789ae8b2..74333c514 100644 --- a/widget/cocoa/GfxInfo.mm +++ b/widget/cocoa/GfxInfo.mm @@ -18,12 +18,6 @@ #import <IOKit/IOKitLib.h> #import <Cocoa/Cocoa.h> -#if defined(MOZ_CRASHREPORTER) -#include "nsExceptionHandler.h" -#include "nsICrashReporter.h" -#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1" -#endif - using namespace mozilla; using namespace mozilla::widget; @@ -273,33 +267,7 @@ GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active) void GfxInfo::AddCrashReportAnnotations() { -#if defined(MOZ_CRASHREPORTER) - nsString deviceID, vendorID, driverVersion; - nsAutoCString narrowDeviceID, narrowVendorID, narrowDriverVersion; - - GetAdapterDeviceID(deviceID); - CopyUTF16toUTF8(deviceID, narrowDeviceID); - GetAdapterVendorID(vendorID); - CopyUTF16toUTF8(vendorID, narrowVendorID); - GetAdapterDriverVersion(driverVersion); - CopyUTF16toUTF8(driverVersion, narrowDriverVersion); - - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterVendorID"), - narrowVendorID); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"), - narrowDeviceID); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDriverVersion"), - narrowDriverVersion); - /* Add an App Note for now so that we get the data immediately. These - * can go away after we store the above in the socorro db */ - nsAutoCString note; - /* AppendPrintf only supports 32 character strings, mrghh. */ - note.Append("AdapterVendorID: "); - note.Append(narrowVendorID); - note.Append(", AdapterDeviceID: "); - note.Append(narrowDeviceID); - CrashReporter::AppendAppNotesToCrashReport(note); -#endif + /*** STUB ***/ } // We don't support checking driver versions on Mac. diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 92ccd8b6c..8f72a81be 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -77,9 +77,6 @@ #include "nsAccessibilityService.h" #include "mozilla/a11y/Platform.h" #endif -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif #include "mozilla/Preferences.h" @@ -5373,31 +5370,14 @@ GetIntegerDeltaForEvent(NSEvent* aEvent) #if !defined(RELEASE_OR_BETA) || defined(DEBUG) if (!Preferences::GetBool("intl.allow-insecure-text-input", false) && mGeckoChild && mTextInputHandler && mTextInputHandler->IsFocused()) { -#ifdef MOZ_CRASHREPORTER - NSWindow* window = [self window]; - NSString* info = [NSString stringWithFormat:@"\nview [%@], window [%@], window is key %i, is fullscreen %i, app is active %i", - self, window, [window isKeyWindow], ([window styleMask] & (1 << 14)) != 0, - [NSApp isActive]]; - nsAutoCString additionalInfo([info UTF8String]); -#endif if (mGeckoChild->GetInputContext().IsPasswordEditor() && !TextInputHandler::IsSecureEventInputEnabled()) { #define CRASH_MESSAGE "A password editor has focus, but not in secure input mode" -#ifdef MOZ_CRASHREPORTER - CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("\nBug 893973: ") + - NS_LITERAL_CSTRING(CRASH_MESSAGE)); - CrashReporter::AppendAppNotesToCrashReport(additionalInfo); -#endif MOZ_CRASH(CRASH_MESSAGE); #undef CRASH_MESSAGE } else if (!mGeckoChild->GetInputContext().IsPasswordEditor() && TextInputHandler::IsSecureEventInputEnabled()) { #define CRASH_MESSAGE "A non-password editor has focus, but in secure input mode" -#ifdef MOZ_CRASHREPORTER - CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("\nBug 893973: ") + - NS_LITERAL_CSTRING(CRASH_MESSAGE)); - CrashReporter::AppendAppNotesToCrashReport(additionalInfo); -#endif MOZ_CRASH(CRASH_MESSAGE); #undef CRASH_MESSAGE } diff --git a/widget/nsBaseAppShell.cpp b/widget/nsBaseAppShell.cpp index 1557498b7..c6b88cba0 100644 --- a/widget/nsBaseAppShell.cpp +++ b/widget/nsBaseAppShell.cpp @@ -6,9 +6,6 @@ #include "base/message_loop.h" #include "nsBaseAppShell.h" -#if defined(MOZ_CRASHREPORTER) -#include "nsExceptionHandler.h" -#endif #include "nsThreadUtils.h" #include "nsIObserverService.h" #include "nsServiceManagerUtils.h" @@ -317,18 +314,12 @@ void nsBaseAppShell::IncrementEventloopNestingLevel() { ++mEventloopNestingLevel; -#if defined(MOZ_CRASHREPORTER) - CrashReporter::SetEventloopNestingLevel(mEventloopNestingLevel); -#endif } void nsBaseAppShell::DecrementEventloopNestingLevel() { --mEventloopNestingLevel; -#if defined(MOZ_CRASHREPORTER) - CrashReporter::SetEventloopNestingLevel(mEventloopNestingLevel); -#endif } // Called from the main thread diff --git a/widget/windows/GfxInfo.cpp b/widget/windows/GfxInfo.cpp index bfea41851..8a429ad32 100644 --- a/widget/windows/GfxInfo.cpp +++ b/widget/windows/GfxInfo.cpp @@ -21,12 +21,6 @@ #include "nsPrintfCString.h" #include "jsapi.h" -#if defined(MOZ_CRASHREPORTER) -#include "nsExceptionHandler.h" -#include "nsICrashReporter.h" -#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1" -#endif - using namespace mozilla; using namespace mozilla::gfx; using namespace mozilla::widget; @@ -721,102 +715,10 @@ GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active) return NS_OK; } -#if defined(MOZ_CRASHREPORTER) -/* Cisco's VPN software can cause corruption of the floating point state. - * Make a note of this in our crash reports so that some weird crashes - * make more sense */ -static void -CheckForCiscoVPN() { - LONG result; - HKEY key; - /* This will give false positives, but hopefully no false negatives */ - result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Cisco Systems\\VPN Client", 0, KEY_QUERY_VALUE, &key); - if (result == ERROR_SUCCESS) { - RegCloseKey(key); - CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("Cisco VPN\n")); - } -} -#endif - void GfxInfo::AddCrashReportAnnotations() { -#if defined(MOZ_CRASHREPORTER) - CheckForCiscoVPN(); - - if (mHasDriverVersionMismatch) { - CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("DriverVersionMismatch\n")); - } - - nsString deviceID, vendorID, driverVersion, subsysID; - nsCString narrowDeviceID, narrowVendorID, narrowDriverVersion, narrowSubsysID; - - GetAdapterDeviceID(deviceID); - CopyUTF16toUTF8(deviceID, narrowDeviceID); - GetAdapterVendorID(vendorID); - CopyUTF16toUTF8(vendorID, narrowVendorID); - GetAdapterDriverVersion(driverVersion); - CopyUTF16toUTF8(driverVersion, narrowDriverVersion); - GetAdapterSubsysID(subsysID); - CopyUTF16toUTF8(subsysID, narrowSubsysID); - - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterVendorID"), - narrowVendorID); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"), - narrowDeviceID); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDriverVersion"), - narrowDriverVersion); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterSubsysID"), - narrowSubsysID); - - /* Add an App Note for now so that we get the data immediately. These - * can go away after we store the above in the socorro db */ - nsAutoCString note; - /* AppendPrintf only supports 32 character strings, mrghh. */ - note.AppendLiteral("AdapterVendorID: "); - note.Append(narrowVendorID); - note.AppendLiteral(", AdapterDeviceID: "); - note.Append(narrowDeviceID); - note.AppendLiteral(", AdapterSubsysID: "); - note.Append(narrowSubsysID); - note.AppendLiteral(", AdapterDriverVersion: "); - note.Append(NS_LossyConvertUTF16toASCII(driverVersion)); - - if (vendorID == GfxDriverInfo::GetDeviceVendor(VendorAll)) { - /* if we didn't find a valid vendorID lets append the mDeviceID string to try to find out why */ - note.AppendLiteral(", "); - LossyAppendUTF16toASCII(mDeviceID, note); - note.AppendLiteral(", "); - LossyAppendUTF16toASCII(mDeviceKeyDebug, note); - LossyAppendUTF16toASCII(mDeviceKeyDebug, note); - } - note.Append("\n"); - - if (mHasDualGPU) { - nsString deviceID2, vendorID2, subsysID2; - nsAutoString adapterDriverVersionString2; - nsCString narrowDeviceID2, narrowVendorID2, narrowSubsysID2; - - note.AppendLiteral("Has dual GPUs. GPU #2: "); - GetAdapterDeviceID2(deviceID2); - CopyUTF16toUTF8(deviceID2, narrowDeviceID2); - GetAdapterVendorID2(vendorID2); - CopyUTF16toUTF8(vendorID2, narrowVendorID2); - GetAdapterDriverVersion2(adapterDriverVersionString2); - GetAdapterSubsysID(subsysID2); - CopyUTF16toUTF8(subsysID2, narrowSubsysID2); - note.AppendLiteral("AdapterVendorID2: "); - note.Append(narrowVendorID2); - note.AppendLiteral(", AdapterDeviceID2: "); - note.Append(narrowDeviceID2); - note.AppendLiteral(", AdapterSubsysID2: "); - note.Append(narrowSubsysID2); - note.AppendLiteral(", AdapterDriverVersion2: "); - note.Append(NS_LossyConvertUTF16toASCII(adapterDriverVersionString2)); - } - CrashReporter::AppendAppNotesToCrashReport(note); - -#endif + /*** STUB ***/ } static OperatingSystem diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp index 341a40c18..9166d97d7 100644 --- a/widget/windows/KeyboardLayout.cpp +++ b/widget/windows/KeyboardLayout.cpp @@ -13,9 +13,6 @@ #include "mozilla/WindowsVersion.h" #include "nsAlgorithm.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif #include "nsGkAtoms.h" #include "nsIDOMKeyEvent.h" #include "nsIIdleServiceInternal.h" @@ -2740,42 +2737,6 @@ NativeKey::NeedsToHandleWithoutFollowingCharMessages() const return mIsPrintableKey; } -#ifdef MOZ_CRASHREPORTER - -static nsCString -GetResultOfInSendMessageEx() -{ - DWORD ret = ::InSendMessageEx(nullptr); - if (!ret) { - return NS_LITERAL_CSTRING("ISMEX_NOSEND"); - } - nsAutoCString result; - if (ret & ISMEX_CALLBACK) { - result = "ISMEX_CALLBACK"; - } - if (ret & ISMEX_NOTIFY) { - if (!result.IsEmpty()) { - result += " | "; - } - result += "ISMEX_NOTIFY"; - } - if (ret & ISMEX_REPLIED) { - if (!result.IsEmpty()) { - result += " | "; - } - result += "ISMEX_REPLIED"; - } - if (ret & ISMEX_SEND) { - if (!result.IsEmpty()) { - result += " | "; - } - result += "ISMEX_SEND"; - } - return result; -} - -#endif // #ifdef MOZ_CRASHREPORTER - bool NativeKey::MayBeSameCharMessage(const MSG& aCharMsg1, const MSG& aCharMsg2) const @@ -3019,33 +2980,6 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) } if (doCrash) { -#ifdef MOZ_CRASHREPORTER - nsPrintfCString info("\nPeekMessage() failed to remove char message! " - "\nActive keyboard layout=0x%08X (%s), " - "\nHandling message: %s, InSendMessageEx()=%s, " - "\nFound message: %s, " - "\nWM_NULL has been removed: %d, " - "\nNext key message in all windows: %s, " - "time=%d, ", - KeyboardLayout::GetActiveLayout(), - KeyboardLayout::GetActiveLayoutName().get(), - ToString(mMsg).get(), - GetResultOfInSendMessageEx().get(), - ToString(kFoundCharMsg).get(), i, - ToString(nextKeyMsgInAllWindows).get(), - nextKeyMsgInAllWindows.time); - CrashReporter::AppendAppNotesToCrashReport(info); - MSG nextMsg; - if (WinUtils::PeekMessage(&nextMsg, 0, 0, 0, - PM_NOREMOVE | PM_NOYIELD)) { - nsPrintfCString info("\nNext message in all windows: %s, time=%d", - ToString(nextMsg).get(), nextMsg.time); - CrashReporter::AppendAppNotesToCrashReport(info); - } else { - CrashReporter::AppendAppNotesToCrashReport( - NS_LITERAL_CSTRING("\nThere is no message in any window")); - } -#endif // #ifdef MOZ_CRASHREPORTER MOZ_CRASH("We lost the following char message"); } @@ -3164,63 +3098,12 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) "nextKeyMsg=%s, kFoundCharMsg=%s", this, ToString(removedMsg).get(), ToString(nextKeyMsg).get(), ToString(kFoundCharMsg).get())); -#ifdef MOZ_CRASHREPORTER - nsPrintfCString info("\nPeekMessage() removed unexpcted char message! " - "\nActive keyboard layout=0x%08X (%s), " - "\nHandling message: %s, InSendMessageEx()=%s, " - "\nFound message: %s, " - "\nRemoved message: %s, ", - KeyboardLayout::GetActiveLayout(), - KeyboardLayout::GetActiveLayoutName().get(), - ToString(mMsg).get(), - GetResultOfInSendMessageEx().get(), - ToString(kFoundCharMsg).get(), - ToString(removedMsg).get()); - CrashReporter::AppendAppNotesToCrashReport(info); - // What's the next key message? - MSG nextKeyMsgAfter; - if (WinUtils::PeekMessage(&nextKeyMsgAfter, mMsg.hwnd, - WM_KEYFIRST, WM_KEYLAST, - PM_NOREMOVE | PM_NOYIELD)) { - nsPrintfCString info("\nNext key message after unexpected char message " - "removed: %s, ", - ToString(nextKeyMsgAfter).get()); - CrashReporter::AppendAppNotesToCrashReport(info); - } else { - CrashReporter::AppendAppNotesToCrashReport( - NS_LITERAL_CSTRING("\nThere is no key message after unexpected char " - "message removed, ")); - } - // Another window has a key message? - if (WinUtils::PeekMessage(&nextKeyMsgInAllWindows, 0, - WM_KEYFIRST, WM_KEYLAST, - PM_NOREMOVE | PM_NOYIELD)) { - nsPrintfCString info("\nNext key message in all windows: %s.", - ToString(nextKeyMsgInAllWindows).get()); - CrashReporter::AppendAppNotesToCrashReport(info); - } else { - CrashReporter::AppendAppNotesToCrashReport( - NS_LITERAL_CSTRING("\nThere is no key message in any windows.")); - } -#endif // #ifdef MOZ_CRASHREPORTER MOZ_CRASH("PeekMessage() removed unexpected message"); } MOZ_LOG(sNativeKeyLogger, LogLevel::Error, ("%p NativeKey::GetFollowingCharMessage(), FAILED, removed messages " "are all WM_NULL, nextKeyMsg=%s", this, ToString(nextKeyMsg).get())); -#ifdef MOZ_CRASHREPORTER - nsPrintfCString info("\nWe lost following char message! " - "\nActive keyboard layout=0x%08X (%s), " - "\nHandling message: %s, InSendMessageEx()=%s, \n" - "Found message: %s, removed a lot of WM_NULL", - KeyboardLayout::GetActiveLayout(), - KeyboardLayout::GetActiveLayoutName().get(), - ToString(mMsg).get(), - GetResultOfInSendMessageEx().get(), - ToString(kFoundCharMsg).get()); - CrashReporter::AppendAppNotesToCrashReport(info); -#endif // #ifdef MOZ_CRASHREPORTER MOZ_CRASH("We lost the following char message"); return false; } diff --git a/widget/windows/moz.build b/widget/windows/moz.build index d4f089eea..1e7fc4b02 100644 --- a/widget/windows/moz.build +++ b/widget/windows/moz.build @@ -79,11 +79,6 @@ SOURCES += [ 'WinMouseScrollHandler.cpp', ] -if CONFIG['MOZ_CRASHREPORTER']: - UNIFIED_SOURCES += [ - 'LSPAnnotator.cpp', - ] - if CONFIG['NS_PRINTING']: UNIFIED_SOURCES += [ 'nsDeviceContextSpecWin.cpp', diff --git a/widget/windows/nsAppShell.cpp b/widget/windows/nsAppShell.cpp index c8820e7d1..c3e99b2d3 100644 --- a/widget/windows/nsAppShell.cpp +++ b/widget/windows/nsAppShell.cpp @@ -213,10 +213,6 @@ nsAppShell::~nsAppShell() nsresult nsAppShell::Init() { -#ifdef MOZ_CRASHREPORTER - LSPAnnotate(); -#endif - mLastNativeEventScheduled = TimeStamp::NowLoRes(); mozilla::ipc::windows::InitUIThread(); diff --git a/xpcom/base/CycleCollectedJSContext.cpp b/xpcom/base/CycleCollectedJSContext.cpp index 87e123078..4af8fe4dd 100644 --- a/xpcom/base/CycleCollectedJSContext.cpp +++ b/xpcom/base/CycleCollectedJSContext.cpp @@ -82,10 +82,6 @@ #include "nsJSUtils.h" #include "nsWrapperCache.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif - #include "nsIException.h" #include "nsIPlatformInfo.h" #include "nsThread.h" @@ -539,10 +535,6 @@ CycleCollectedJSContext::Initialize(JSContext* aParentContext, JS_SetSweepZoneCallback(mJSContext, XPCStringConvert::ClearZoneCache); JS::SetBuildIdOp(mJSContext, GetBuildId); JS::SetWarningReporter(mJSContext, MozCrashWarningReporter); -#ifdef MOZ_CRASHREPORTER - js::AutoEnterOOMUnsafeRegion::setAnnotateOOMAllocationSizeCallback( - CrashReporter::AnnotateOOMAllocationSize); -#endif static js::DOMCallbacks DOMcallbacks = { InstanceClassHasProtoAtDepth @@ -1607,16 +1599,6 @@ CycleCollectedJSContext::AnnotateAndSetOutOfMemory(OOMState* aStatePtr, MOZ_ASSERT(mJSContext); *aStatePtr = aNewState; -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateCrashReport(aStatePtr == &mOutOfMemoryState - ? NS_LITERAL_CSTRING("JSOutOfMemory") - : NS_LITERAL_CSTRING("JSLargeAllocationFailure"), - aNewState == OOMState::Reporting - ? NS_LITERAL_CSTRING("Reporting") - : aNewState == OOMState::Reported - ? NS_LITERAL_CSTRING("Reported") - : NS_LITERAL_CSTRING("Recovered")); -#endif } void @@ -1630,14 +1612,6 @@ CycleCollectedJSContext::OnGC(JSGCStatus aStatus) mZonesWaitingForGC.Clear(); break; case JSGC_END: { -#ifdef MOZ_CRASHREPORTER - if (mOutOfMemoryState == OOMState::Reported) { - AnnotateAndSetOutOfMemory(&mOutOfMemoryState, OOMState::Recovered); - } - if (mLargeAllocationFailureState == OOMState::Reported) { - AnnotateAndSetOutOfMemory(&mLargeAllocationFailureState, OOMState::Recovered); - } -#endif // Do any deferred finalization of native objects. FinalizeDeferredThings(JS::WasIncrementalGC(mJSContext) ? FinalizeIncrementally : diff --git a/xpcom/base/nsCrashOnException.cpp b/xpcom/base/nsCrashOnException.cpp index 0f8042531..06c48738f 100644 --- a/xpcom/base/nsCrashOnException.cpp +++ b/xpcom/base/nsCrashOnException.cpp @@ -8,22 +8,11 @@ #include "nsCOMPtr.h" #include "nsServiceManagerUtils.h" -#ifdef MOZ_CRASHREPORTER -#include "nsICrashReporter.h" -#endif - namespace mozilla { static int ReportException(EXCEPTION_POINTERS* aExceptionInfo) { -#ifdef MOZ_CRASHREPORTER - nsCOMPtr<nsICrashReporter> cr = - do_GetService("@mozilla.org/toolkit/crash-reporter;1"); - if (cr) { - cr->WriteMinidumpForException(aExceptionInfo); - } -#endif return EXCEPTION_EXECUTE_HANDLER; } diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index ca7057628..721ae9065 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -188,10 +188,6 @@ #include "mozilla/Telemetry.h" #include "mozilla/ThreadLocal.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif - using namespace mozilla; //#define COLLECT_TIME_DEBUG @@ -3150,14 +3146,6 @@ nsCycleCollector::ScanWhiteNodes(bool aFullySynchGraphBuild) } if (pi->mInternalRefs > pi->mRefCount) { -#ifdef MOZ_CRASHREPORTER - const char* piName = "Unknown"; - if (pi->mParticipant) { - piName = pi->mParticipant->ClassName(); - } - nsPrintfCString msg("More references to an object than its refcount, for class %s", piName); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CycleCollector"), msg); -#endif MOZ_CRASH(); } diff --git a/xpcom/base/nsDebugImpl.cpp b/xpcom/base/nsDebugImpl.cpp index 36288d203..96487acda 100644 --- a/xpcom/base/nsDebugImpl.cpp +++ b/xpcom/base/nsDebugImpl.cpp @@ -11,9 +11,6 @@ #include "nsDebugImpl.h" #include "nsDebug.h" -#ifdef MOZ_CRASHREPORTER -# include "nsExceptionHandler.h" -#endif #include "nsString.h" #include "nsXULAppAPI.h" #include "prprf.h" @@ -380,22 +377,6 @@ NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr, return; case NS_DEBUG_ABORT: { -#if defined(MOZ_CRASHREPORTER) - // Updating crash annotations in the child causes us to do IPC. This can - // really cause trouble if we're asserting from within IPC code. So we - // have to do without the annotations in that case. - if (XRE_IsParentProcess()) { - // Don't include the PID in the crash report annotation to - // allow faceting on crash-stats.mozilla.org. - nsCString note("xpcom_runtime_abort("); - note += nonPIDBuf.buffer; - note += ")"; - CrashReporter::AppendAppNotesToCrashReport(note); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AbortMessage"), - nsDependentCString(nonPIDBuf.buffer)); - } -#endif // MOZ_CRASHREPORTER - #if defined(DEBUG) && defined(_WIN32) RealBreak(); #endif @@ -600,8 +581,5 @@ NS_ErrorAccordingToNSPR() void NS_ABORT_OOM(size_t aSize) { -#if defined(MOZ_CRASHREPORTER) - CrashReporter::AnnotateOOMAllocationSize(aSize); -#endif MOZ_CRASH("OOM"); } diff --git a/xpcom/base/nsObjCExceptions.h b/xpcom/base/nsObjCExceptions.h index e63c92af5..b3ed532ec 100644 --- a/xpcom/base/nsObjCExceptions.h +++ b/xpcom/base/nsObjCExceptions.h @@ -17,12 +17,6 @@ #import <ExceptionHandling/NSExceptionHandler.h> #endif -#if defined(MOZ_CRASHREPORTER) && defined(__cplusplus) -#include "nsICrashReporter.h" -#include "nsCOMPtr.h" -#include "nsServiceManagerUtils.h" -#endif - #include <unistd.h> #include <signal.h> #include "nsError.h" @@ -47,15 +41,6 @@ nsObjCExceptionLog(NSException* aException) NSLog(@"Mozilla has caught an Obj-C exception [%@: %@]", [aException name], [aException reason]); -#if defined(MOZ_CRASHREPORTER) && defined(__cplusplus) - // Attach exception info to the crash report. - nsCOMPtr<nsICrashReporter> crashReporter = - do_GetService("@mozilla.org/toolkit/crash-reporter;1"); - if (crashReporter) { - crashReporter->AppendObjCExceptionInfoToAppNotes(static_cast<void*>(aException)); - } -#endif - #ifdef DEBUG @try { // Try to get stack information out of the exception. 10.5 returns the stack diff --git a/xpcom/build/nsXULAppAPI.h b/xpcom/build/nsXULAppAPI.h index 426a58f06..aae248ca1 100644 --- a/xpcom/build/nsXULAppAPI.h +++ b/xpcom/build/nsXULAppAPI.h @@ -426,17 +426,6 @@ XRE_API(const char*, XRE_API(void, XRE_SetProcessType, (const char* aProcessTypeString)) -#if defined(MOZ_CRASHREPORTER) -// Used in the "master" parent process hosting the crash server -XRE_API(bool, - XRE_TakeMinidumpForChild, (uint32_t aChildPid, nsIFile** aDump, - uint32_t* aSequence)) - -// Used in child processes. -XRE_API(bool, - XRE_SetRemoteExceptionHandler, (const char* aPipe)) -#endif - namespace mozilla { namespace gmp { class GMPLoader; diff --git a/xpcom/system/moz.build b/xpcom/system/moz.build index 8a4f88efe..1d8e7ea1f 100644 --- a/xpcom/system/moz.build +++ b/xpcom/system/moz.build @@ -18,9 +18,4 @@ XPIDL_SOURCES += [ 'nsIXULRuntime.idl', ] -if CONFIG['MOZ_CRASHREPORTER']: - XPIDL_SOURCES += [ - 'nsICrashReporter.idl', - ] - XPIDL_MODULE = 'xpcom_system' diff --git a/xpcom/tests/gtest/TestDeadlockDetector.cpp b/xpcom/tests/gtest/TestDeadlockDetector.cpp index 646ee3e1d..877c5f5c3 100644 --- a/xpcom/tests/gtest/TestDeadlockDetector.cpp +++ b/xpcom/tests/gtest/TestDeadlockDetector.cpp @@ -15,12 +15,6 @@ #include "mozilla/ReentrantMonitor.h" #include "mozilla/Mutex.h" -#ifdef MOZ_CRASHREPORTER -#include "nsCOMPtr.h" -#include "nsICrashReporter.h" -#include "nsServiceManagerUtils.h" -#endif - #include "gtest/gtest.h" using namespace mozilla; @@ -62,13 +56,7 @@ private: void DisableCrashReporter() { -#ifdef MOZ_CRASHREPORTER - nsCOMPtr<nsICrashReporter> crashreporter = - do_GetService("@mozilla.org/toolkit/crash-reporter;1"); - if (crashreporter) { - crashreporter->SetEnabled(false); - } -#endif + /*** STUB ***/ } //----------------------------------------------------------------------------- diff --git a/xpcom/tests/gtest/TestPLDHash.cpp b/xpcom/tests/gtest/TestPLDHash.cpp index e7a73ae1b..4405b102c 100644 --- a/xpcom/tests/gtest/TestPLDHash.cpp +++ b/xpcom/tests/gtest/TestPLDHash.cpp @@ -21,10 +21,6 @@ extern unsigned int _gdb_sleep_duration; #endif -#ifdef MOZ_CRASHREPORTER -#include "nsICrashReporter.h" -#endif - // We can test that certain operations cause expected aborts by forking // and then checking that the child aborted in the expected way (i.e. via // MOZ_CRASH). We skip this for the following configurations. @@ -46,17 +42,6 @@ TestCrashyOperation(void (*aCrashyOperation)()) ASSERT_NE(pid, -1); if (pid == 0) { - // Disable the crashreporter -- writing a crash dump in the child will - // prevent the parent from writing a subsequent dump. Crashes here are - // expected, so we don't want their stacks to show up in the log anyway. -#ifdef MOZ_CRASHREPORTER - nsCOMPtr<nsICrashReporter> crashreporter = - do_GetService("@mozilla.org/toolkit/crash-reporter;1"); - if (crashreporter) { - crashreporter->SetEnabled(false); - } -#endif - // Child: perform the crashy operation. fprintf(stderr, "TestCrashyOperation: The following crash is expected. Do not panic.\n"); aCrashyOperation(); diff --git a/xpcom/tests/gtest/TestSTLWrappers.cpp b/xpcom/tests/gtest/TestSTLWrappers.cpp index 9559548a3..295aa7434 100644 --- a/xpcom/tests/gtest/TestSTLWrappers.cpp +++ b/xpcom/tests/gtest/TestSTLWrappers.cpp @@ -10,12 +10,6 @@ # error "failed to wrap <vector>" #endif -#ifdef MOZ_CRASHREPORTER -#include "nsCOMPtr.h" -#include "nsICrashReporter.h" -#include "nsServiceManagerUtils.h" -#endif - // gcc errors out if we |try ... catch| with -fno-exceptions, but we // can still test on windows #ifdef _MSC_VER @@ -40,14 +34,6 @@ void ShouldAbort() _gdb_sleep_duration = 0; #endif -#ifdef MOZ_CRASHREPORTER - nsCOMPtr<nsICrashReporter> crashreporter = - do_GetService("@mozilla.org/toolkit/crash-reporter;1"); - if (crashreporter) { - crashreporter->SetEnabled(false); - } -#endif - std::vector<int> v; int rv = 1; diff --git a/xpcom/threads/HangMonitor.cpp b/xpcom/threads/HangMonitor.cpp index 71cc67ca4..bd415be50 100644 --- a/xpcom/threads/HangMonitor.cpp +++ b/xpcom/threads/HangMonitor.cpp @@ -22,10 +22,6 @@ #include "nsThreadUtils.h" #include "nsXULAppAPI.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif - #ifdef XP_WIN #include <windows.h> #endif @@ -111,15 +107,6 @@ Crash() } #endif -#ifdef MOZ_CRASHREPORTER - // If you change this, you must also deal with the threadsafety of AnnotateCrashReport in - // non-chrome processes! - if (GeckoProcessType_Default == XRE_GetProcessType()) { - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Hang"), - NS_LITERAL_CSTRING("1")); - } -#endif - NS_RUNTIMEABORT("HangMonitor triggered"); } diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp index 63bd28ca3..7c1af08f4 100644 --- a/xpcom/threads/nsThread.cpp +++ b/xpcom/threads/nsThread.cpp @@ -39,12 +39,6 @@ #include "nsThreadSyncDispatch.h" #include "LeakRefPtr.h" -#ifdef MOZ_CRASHREPORTER -#include "nsServiceManagerUtils.h" -#include "nsICrashReporter.h" -#include "mozilla/dom/ContentChild.h" -#endif - #ifdef XP_LINUX #include <sys/time.h> #include <sys/resource.h> @@ -520,73 +514,6 @@ nsThread::ThreadFunc(void* aArg) //----------------------------------------------------------------------------- -#ifdef MOZ_CRASHREPORTER -// Tell the crash reporter to save a memory report if our heuristics determine -// that an OOM failure is likely to occur soon. -// Memory usage will not be checked more than every 30 seconds or saved more -// than every 3 minutes -// If |aShouldSave == kForceReport|, a report will be saved regardless of -// whether the process is low on memory or not. However, it will still not be -// saved if a report was saved less than 3 minutes ago. -bool -nsThread::SaveMemoryReportNearOOM(ShouldSaveMemoryReport aShouldSave) -{ - // Keep an eye on memory usage (cheap, ~7ms) somewhat frequently, - // but save memory reports (expensive, ~75ms) less frequently. - const size_t kLowMemoryCheckSeconds = 30; - const size_t kLowMemorySaveSeconds = 3 * 60; - - static TimeStamp nextCheck = TimeStamp::NowLoRes() - + TimeDuration::FromSeconds(kLowMemoryCheckSeconds); - static bool recentlySavedReport = false; // Keeps track of whether a report - // was saved last time we checked - - // Are we checking again too soon? - TimeStamp now = TimeStamp::NowLoRes(); - if ((aShouldSave == ShouldSaveMemoryReport::kMaybeReport || - recentlySavedReport) && now < nextCheck) { - return false; - } - - bool needMemoryReport = (aShouldSave == ShouldSaveMemoryReport::kForceReport); -#ifdef XP_WIN // XXX implement on other platforms as needed - // If the report is forced there is no need to check whether it is necessary - if (aShouldSave != ShouldSaveMemoryReport::kForceReport) { - const size_t LOWMEM_THRESHOLD_VIRTUAL = 200 * 1024 * 1024; - MEMORYSTATUSEX statex; - statex.dwLength = sizeof(statex); - if (GlobalMemoryStatusEx(&statex)) { - if (statex.ullAvailVirtual < LOWMEM_THRESHOLD_VIRTUAL) { - needMemoryReport = true; - } - } - } -#endif - - if (needMemoryReport) { - if (XRE_IsContentProcess()) { - dom::ContentChild* cc = dom::ContentChild::GetSingleton(); - if (cc) { - cc->SendNotifyLowMemory(); - } - } else { - nsCOMPtr<nsICrashReporter> cr = - do_GetService("@mozilla.org/toolkit/crash-reporter;1"); - if (cr) { - cr->SaveMemoryReport(); - } - } - recentlySavedReport = true; - nextCheck = now + TimeDuration::FromSeconds(kLowMemorySaveSeconds); - } else { - recentlySavedReport = false; - nextCheck = now + TimeDuration::FromSeconds(kLowMemoryCheckSeconds); - } - - return recentlySavedReport; -} -#endif - #ifdef MOZ_CANARY int sCanaryOutputFD = -1; #endif @@ -1459,12 +1386,6 @@ nsThread::DoMainThreadSpecificProcessing(bool aReallyWait) } } } - -#ifdef MOZ_CRASHREPORTER - if (!ShuttingDown()) { - SaveMemoryReportNearOOM(ShouldSaveMemoryReport::kMaybeReport); - } -#endif } //----------------------------------------------------------------------------- diff --git a/xpcom/threads/nsThread.h b/xpcom/threads/nsThread.h index 836123747..037ef1952 100644 --- a/xpcom/threads/nsThread.h +++ b/xpcom/threads/nsThread.h @@ -83,16 +83,6 @@ public: void WaitForAllAsynchronousShutdowns(); -#ifdef MOZ_CRASHREPORTER - enum class ShouldSaveMemoryReport - { - kMaybeReport, - kForceReport - }; - - static bool SaveMemoryReportNearOOM(ShouldSaveMemoryReport aShouldSave); -#endif - private: void DoMainThreadSpecificProcessing(bool aReallyWait); |