Remove base conditional code for crash reporter and injector.

This commit is contained in:
wolfbeast
2018-03-30 08:50:58 +02:00
committed by Roy Tam
parent 87fa26d31e
commit 434f3590e3
131 changed files with 39 additions and 4139 deletions
-16
View File
@@ -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:
@@ -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> >;
-4
View File
@@ -9,10 +9,6 @@
#include "nsDebug.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
namespace mozilla {
namespace a11y {
+4 -36
View File
@@ -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);
-29
View File
@@ -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);
@@ -4589,23 +4577,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 () {
-13
View File
@@ -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", "");
},
@@ -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();
@@ -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"
@@ -232,22 +225,6 @@
</hbox>
</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
-22
View File
@@ -785,28 +785,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
-5
View File
@@ -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 \
+4 -117
View File
@@ -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;
},
}
+2 -24
View File
@@ -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 () {
-5
View File
@@ -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
-4
View File
@@ -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
-1
View File
@@ -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'
-1
View File
@@ -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.
+2 -30
View File
@@ -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
+1 -1
View File
@@ -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
-7
View File
@@ -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);
-3
View File
@@ -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 |
-7
View File
@@ -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;
}
-3
View File
@@ -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 },
-4
View File
@@ -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
-39
View File
@@ -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();
-71
View File
@@ -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;
}
-83
View File
@@ -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
-236
View File
@@ -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
-36
View File
@@ -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
-7
View File
@@ -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;
}
-8
View File
@@ -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
-4
View File
@@ -257,10 +257,6 @@ GMPChild::Init(const nsAString& aPluginPath,
return false;
}
#ifdef MOZ_CRASHREPORTER
SendPCrashReporterConstructor(CrashReporter::CurrentThreadId());
#endif
mPluginPath = aPluginPath;
mSandboxVoucherPath = aVoucherPath;
-154
View File
@@ -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, &notes);
}
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;
}
-15
View File
@@ -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;
-109
View File
@@ -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);
-18
View File
@@ -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;
-10
View File
@@ -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
-19
View File
@@ -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;
-3
View File
@@ -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
-4
View File
@@ -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;
}
+1 -527
View File
@@ -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(&notes);
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, &notes);
}
#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
-44
View File
@@ -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
-3
View File
@@ -38,9 +38,6 @@
#include "WorkerRunnable.h"
#include "WrapperFactory.h"
#include "xpcpublic.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
namespace mozilla {
namespace dom {
-8
View File
@@ -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
}
-9
View File
@@ -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));
}
-8
View File
@@ -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();
}
-19
View File
@@ -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()) {
-4
View File
@@ -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
-24
View File
@@ -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
-8
View File
@@ -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());
-103
View File
@@ -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, &notes);
CrashReporter::AppendExtraData(dumpID, notes);
NotifyCrashService(mProcessType, dumpID, &notes);
}
/* 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
-20
View File
@@ -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);
-23
View File
@@ -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
-4
View File
@@ -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();
-31
View File
@@ -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));
-11
View File
@@ -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);
-4
View File
@@ -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>
-7
View File
@@ -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");
}
+1 -66
View File
@@ -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
+2 -10
View File
@@ -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.
-7
View File
@@ -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]
-9
View File
@@ -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);
}
-23
View File
@@ -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;
-293
View File
@@ -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,
+1 -3
View File
@@ -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'
@@ -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"
-7
View File
@@ -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;
@@ -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)) {
+1 -5
View File
@@ -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]
@@ -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;
}
};
@@ -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;
}
};
@@ -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
-14
View File
@@ -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);
-11
View File
@@ -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");
}
}
+1 -65
View File
@@ -3564,68 +3564,6 @@ fi
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 ========================================================
@@ -5374,8 +5312,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)
@@ -5611,7 +5547,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)
-1
View File
@@ -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'
@@ -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'])
@@ -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:");
-25
View File
@@ -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();
}
-1
View File
@@ -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"
@@ -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",
})
@@ -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');
@@ -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)
@@ -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',
@@ -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'
-1
View File
@@ -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):
+1 -4
View File
@@ -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'
-3
View File
@@ -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.
-3
View File
@@ -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']
@@ -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
+1 -10
View File
@@ -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 ***/
}
+1 -63
View File
@@ -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) {
-28
View File
@@ -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>
-26
View File
@@ -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)
-8
View File
@@ -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
-8
View File
@@ -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)
-7
View File
@@ -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,
-9
View File
@@ -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)
-13
View File
@@ -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 = {};
-3
View File
@@ -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',
]
+1 -3
View File
@@ -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;

Some files were not shown because too many files have changed in this diff Show More