Browse Source

Remove base conditional code for crash reporter and injector.

pull/1/head
wolfbeast 4 years ago committed by Roy Tam
parent
commit
434f3590e3
  1. 16
      Makefile.in
  2. 10
      accessible/base/nsAccessibilityService.cpp
  3. 4
      accessible/windows/msaa/IUnknownImpl.cpp
  4. 40
      browser/base/content/browser-plugins.js
  5. 29
      browser/base/content/browser.js
  6. 13
      browser/components/nsBrowserGlue.js
  7. 3
      browser/components/preferences/in-content/advanced.js
  8. 23
      browser/components/preferences/in-content/advanced.xul
  9. 22
      browser/installer/package-manifest.in
  10. 5
      browser/locales/Makefile.in
  11. 121
      browser/modules/ContentCrashHandlers.jsm
  12. 26
      browser/modules/PluginContent.jsm
  13. 5
      build/application.ini
  14. 4
      build/automation-build.mk
  15. 1
      build/automation.py.in
  16. 1
      build/mobile/b2gautomation.py
  17. 32
      build/mobile/remoteautomation.py
  18. 2
      build/moz.build
  19. 7
      caps/BasePrincipal.cpp
  20. 3
      docshell/base/nsAboutRedirector.cpp
  21. 7
      docshell/base/nsDocShell.cpp
  22. 3
      docshell/build/nsDocShellModule.cpp
  23. 4
      dom/base/nsFrameMessageManager.cpp
  24. 39
      dom/ipc/ContentChild.cpp
  25. 71
      dom/ipc/ContentParent.cpp
  26. 83
      dom/ipc/CrashReporterParent.cpp
  27. 236
      dom/ipc/CrashReporterParent.h
  28. 36
      dom/ipc/ProcessHangMonitor.cpp
  29. 7
      dom/ipc/TabChild.cpp
  30. 8
      dom/ipc/TabMessageUtils.h
  31. 4
      dom/media/gmp/GMPChild.cpp
  32. 154
      dom/media/gmp/GMPParent.cpp
  33. 15
      dom/media/gmp/GMPParent.h
  34. 109
      dom/media/gmp/GMPServiceParent.cpp
  35. 18
      dom/media/gmp/GMPServiceParent.h
  36. 10
      dom/plugins/base/nsPluginHost.cpp
  37. 19
      dom/plugins/base/nsPluginsDirDarwin.cpp
  38. 3
      dom/plugins/ipc/PluginMessageUtils.h
  39. 4
      dom/plugins/ipc/PluginModuleChild.cpp
  40. 528
      dom/plugins/ipc/PluginModuleParent.cpp
  41. 44
      dom/plugins/ipc/PluginModuleParent.h
  42. 3
      dom/promise/Promise.cpp
  43. 8
      gfx/gl/GfxTexturesReporter.cpp
  44. 9
      gfx/ipc/GPUChild.cpp
  45. 8
      gfx/ipc/GPUParent.cpp
  46. 19
      gfx/src/DriverCrashGuard.cpp
  47. 4
      gfx/src/gfxCrashReporterUtils.cpp
  48. 24
      gfx/tests/gtest/TestGfxPrefs.cpp
  49. 8
      gfx/thebes/gfxPlatform.cpp
  50. 103
      ipc/glue/CrashReporterHost.cpp
  51. 20
      ipc/glue/CrashReporterHost.h
  52. 23
      ipc/glue/CrashReporterMetadataShmem.cpp
  53. 4
      ipc/glue/CrashReporterMetadataShmem.h
  54. 31
      ipc/glue/GeckoChildProcessHost.cpp
  55. 11
      ipc/glue/IPCMessageUtils.h
  56. 4
      ipc/glue/MessageChannel.h
  57. 7
      ipc/glue/MessageLink.cpp
  58. 67
      ipc/glue/ProtocolUtils.cpp
  59. 12
      ipc/glue/ProtocolUtils.h
  60. 7
      ipc/ipdl/ipdl/lower.py
  61. 9
      js/xpconnect/src/XPCJSContext.cpp
  62. 23
      js/xpconnect/src/XPCShellImpl.cpp
  63. 293
      layout/style/nsLayoutStylesheetCache.cpp
  64. 4
      mobile/android/app/build.gradle
  65. 14
      mobile/android/base/AndroidManifest.xml.in
  66. 7
      mobile/android/base/AppConstants.java.in
  67. 6
      mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
  68. 6
      mobile/android/base/moz.build
  69. 4
      mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashHandler.java
  70. 4
      mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
  71. 8
      mobile/android/installer/package-manifest.in
  72. 14
      modules/libpref/nsPrefBranch.cpp
  73. 11
      netwerk/ipc/NeckoMessageUtils.h
  74. 66
      old-configure.in
  75. 1
      python/mozbuild/mozbuild/mozinfo.py
  76. 1
      python/mozbuild/mozbuild/test/test_mozinfo.py
  77. 6
      security/sandbox/linux/glue/SandboxCrash.cpp
  78. 25
      testing/gtest/mozilla/GTestRunner.cpp
  79. 1
      testing/gtest/rungtests.py
  80. 3
      testing/marionette/client/marionette_driver/geckoinstance.py
  81. 9
      testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
  82. 1
      testing/mozbase/mozrunner/mozrunner/base/browser.py
  83. 3
      testing/mozbase/mozrunner/mozrunner/base/device.py
  84. 1
      testing/mozbase/mozrunner/mozrunner/utils.py
  85. 1
      testing/runcppunittests.py
  86. 5
      testing/talos/talos/ffsetup.py
  87. 3
      testing/xpcshell/runxpcshelltests.py
  88. 3
      toolkit/components/moz.build
  89. 29
      toolkit/components/places/tests/cpp/places_test_harness_tail.h
  90. 11
      toolkit/components/terminator/nsTerminator.cpp
  91. 64
      toolkit/content/aboutSupport.js
  92. 28
      toolkit/content/aboutSupport.xhtml
  93. 26
      toolkit/content/browser-child.js
  94. 8
      toolkit/locales/Makefile.in
  95. 8
      toolkit/locales/l10n.mk
  96. 7
      toolkit/modules/AppConstants.jsm
  97. 9
      toolkit/modules/Services.jsm
  98. 13
      toolkit/modules/Troubleshoot.jsm
  99. 3
      toolkit/moz.build
  100. 4
      toolkit/profile/nsProfileLock.cpp
  101. Some files were not shown because too many files have changed in this diff Show More

16
Makefile.in

@ -299,13 +299,6 @@ MAKE_SYM_STORE_ARGS += --install-manifest=$(DEPTH)/_build_manifests/install/dist
SYM_STORE_SOURCE_DIRS := $(topsrcdir)
ifdef MOZ_CRASHREPORTER
include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
SYMBOL_INDEX_NAME = \
$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_TARGET)-$(BUILDID)-$(CPU_ARCH)-symbols.txt
endif
.PHONY: generatesymbols
generatesymbols:
echo building symbol store
@ -337,18 +330,9 @@ symbolsarchive: generatesymbols
cd $(DIST)/crashreporter-symbols && \
zip -r5D '../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' . -i '*.sym' -i '*.txt'
ifdef MOZ_CRASHREPORTER
buildsymbols: symbolsfullarchive symbolsarchive
else
buildsymbols:
endif
uploadsymbols:
ifdef MOZ_CRASHREPORTER
ifdef SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE
$(PYTHON) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
endif
endif
.PHONY: update-packaging
update-packaging:

10
accessible/base/nsAccessibilityService.cpp

@ -53,10 +53,6 @@
#include "Logging.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsImageFrame.h"
#include "nsIObserverService.h"
#include "nsLayoutUtils.h"
@ -1283,12 +1279,6 @@ nsAccessibilityService::Init()
NS_ADDREF(gApplicationAccessible); // will release in Shutdown()
gApplicationAccessible->Init();
#ifdef MOZ_CRASHREPORTER
CrashReporter::
AnnotateCrashReport(NS_LITERAL_CSTRING("Accessibility"),
NS_LITERAL_CSTRING("Active"));
#endif
#ifdef XP_WIN
sPendingPlugins = new nsTArray<nsCOMPtr<nsIContent> >;
sPluginTimers = new nsTArray<nsCOMPtr<nsITimer> >;

4
accessible/windows/msaa/IUnknownImpl.cpp

@ -9,10 +9,6 @@
#include "nsDebug.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
namespace mozilla {
namespace a11y {

40
browser/base/content/browser-plugins.js

@ -63,9 +63,7 @@ var gPluginHandler = {
msg.data.pluginID);
break;
case "PluginContent:SubmitReport":
if (AppConstants.MOZ_CRASHREPORTER) {
this.submitReport(msg.data.runID, msg.data.keyVals, msg.data.submitURLOptIn);
}
// Nothing to do here
break;
case "PluginContent:LinkClickCallback":
switch (msg.data.name) {
@ -98,11 +96,8 @@ var gPluginHandler = {
},
submitReport: function submitReport(runID, keyVals, submitURLOptIn) {
if (!AppConstants.MOZ_CRASHREPORTER) {
return;
}
Services.prefs.setBoolPref("dom.ipc.plugins.reportCrashURL", submitURLOptIn);
PluginCrashReporter.submitCrashReport(runID, keyVals);
/*** STUB ***/
return;
},
// Callback for user clicking a "reload page" link
@ -461,18 +456,7 @@ var gPluginHandler = {
// If we don't have a minidumpID, we can't (or didn't) submit anything.
// This can happen if the plugin is killed from the task manager.
let state;
if (!AppConstants.MOZ_CRASHREPORTER || !gCrashReporter.enabled) {
// This state tells the user that crash reporting is disabled, so we
// cannot send a report.
state = "noSubmit";
} else if (!pluginDumpID) {
// This state tells the user that there is no crash report available.
state = "noReport";
} else {
// This state asks the user to submit a crash report.
state = "please";
}
let state = "noSubmit";
let mm = window.getGroupMessageManager("browsers");
mm.broadcastAsyncMessage("BrowserPlugins:NPAPIPluginProcessCrashed",
@ -513,22 +497,6 @@ var gPluginHandler = {
callback: function() { browser.reload(); },
}];
if (AppConstants.MOZ_CRASHREPORTER &&
PluginCrashReporter.hasCrashReport(pluginID)) {
let submitLabel = gNavigatorBundle.getString("crashedpluginsMessage.submitButton.label");
let submitKey = gNavigatorBundle.getString("crashedpluginsMessage.submitButton.accesskey");
let submitButton = {
label: submitLabel,
accessKey: submitKey,
popup: null,
callback: () => {
PluginCrashReporter.submitCrashReport(pluginID);
},
};
buttons.push(submitButton);
}
notification = notificationBox.appendNotification(messageString, "plugin-crashed",
iconURL, priority, buttons);

29
browser/base/content/browser.js

@ -61,11 +61,6 @@ Cu.import("resource://gre/modules/NotificationDB.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
"resource://gre/modules/SafeBrowsing.jsm");
if (AppConstants.MOZ_CRASHREPORTER) {
XPCOMUtils.defineLazyModuleGetter(this, "PluginCrashReporter",
"resource:///modules/ContentCrashHandlers.jsm");
}
// lazy service getters
[
["Favicons", "@mozilla.org/browser/favicon-service;1", "mozIAsyncFavicons"],
@ -74,13 +69,6 @@ if (AppConstants.MOZ_CRASHREPORTER) {
["gDNSService", "@mozilla.org/network/dns-service;1", "nsIDNSService"],
].forEach(([name, cc, ci]) => XPCOMUtils.defineLazyServiceGetter(this, name, cc, ci));
if (AppConstants.MOZ_CRASHREPORTER) {
XPCOMUtils.defineLazyServiceGetter(this, "gCrashReporter",
"@mozilla.org/xre/app-info;1",
"nsICrashReporter");
}
XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function() {
let tmp = {};
Cu.import("resource://devtools/client/framework/ToolboxProcess.jsm", tmp);
@ -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
browser/components/nsBrowserGlue.js

@ -70,15 +70,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "AlertsService", "@mozilla.org/alerts-s
["webrtcUI", "resource:///modules/webrtcUI.jsm"],
].forEach(([name, resource]) => XPCOMUtils.defineLazyModuleGetter(this, name, resource));
if (AppConstants.MOZ_CRASHREPORTER) {
XPCOMUtils.defineLazyModuleGetter(this, "PluginCrashReporter",
"resource:///modules/ContentCrashHandlers.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "UnsubmittedCrashHandler",
"resource:///modules/ContentCrashHandlers.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "CrashSubmit",
"resource://gre/modules/CrashSubmit.jsm");
}
XPCOMUtils.defineLazyGetter(this, "gBrandBundle", function() {
return Services.strings.createBundle('chrome://branding/locale/brand.properties');
});
@ -710,10 +701,6 @@ BrowserGlue.prototype = {
}
TabCrashHandler.init();
if (AppConstants.MOZ_CRASHREPORTER) {
PluginCrashReporter.init();
UnsubmittedCrashHandler.init();
}
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
},

3
browser/components/preferences/in-content/advanced.js

@ -40,9 +40,6 @@ var gAdvancedPane = {
this.updateReadPrefs();
}
this.updateOfflineApps();
if (AppConstants.MOZ_CRASHREPORTER) {
this.initSubmitCrashes();
}
this.initTelemetry();
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this.initSubmitHealthReport();

23
browser/components/preferences/in-content/advanced.xul

@ -54,13 +54,6 @@
type="bool"/>
#endif
<!-- Data Choices tab -->
#ifdef MOZ_CRASHREPORTER
<preference id="browser.crashReports.unsubmittedCheck.autoSubmit2"
name="browser.crashReports.unsubmittedCheck.autoSubmit2"
type="bool"/>
#endif
<!-- Network tab -->
<preference id="browser.cache.disk.capacity"
name="browser.cache.disk.capacity"
@ -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
browser/installer/package-manifest.in

@ -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
browser/locales/Makefile.in

@ -165,11 +165,6 @@ else
endif
endif
ifdef MOZ_CRASHREPORTER
libs:: crashreporter-override.ini
$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
endif
ident:
@printf 'fx_revision '
@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py \

121
browser/modules/ContentCrashHandlers.jsm

@ -90,8 +90,6 @@ this.TabCrashHandler = {
Services.telemetry
.getHistogramById("FX_CONTENT_CRASH_DUMP_UNAVAILABLE")
.add(1);
} else if (AppConstants.MOZ_CRASHREPORTER) {
this.childMap.set(childID, dumpID);
}
if (!this.flushCrashedBrowserQueue(childID)) {
@ -115,15 +113,6 @@ this.TabCrashHandler = {
}
}
// check for environment affecting crash reporting
let env = Cc["@mozilla.org/process/environment;1"]
.getService(Ci.nsIEnvironment);
let shutdown = env.exists("MOZ_CRASHREPORTER_SHUTDOWN");
if (shutdown) {
Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
}
break;
}
case "oop-frameloader-crashed": {
@ -306,105 +295,10 @@ this.TabCrashHandler = {
/**
* Submits a crash report from about:tabcrashed, if the crash
* reporter is enabled and a crash report can be found.
*
* @param aBrowser
* The <xul:browser> that the report was sent from.
* @param aFormData
* An Object with the following properties:
*
* includeURL (bool):
* Whether to include the URL that the user was on
* in the crashed tab before the crash occurred.
* URL (String)
* The URL that the user was on in the crashed tab
* before the crash occurred.
* emailMe (bool):
* Whether or not to include the user's email address
* in the crash report.
* email (String):
* The email address of the user.
* comments (String):
* Any additional comments from the user.
*
* Note that it is expected that all properties are set,
* even if they are empty.
*/
maybeSendCrashReport(message) {
if (!AppConstants.MOZ_CRASHREPORTER) {
return;
}
if (!message.data.hasReport) {
// There was no report, so nothing to do.
return;
}
let browser = message.target.browser;
if (message.data.autoSubmit) {
// The user has opted in to autosubmitted backlogged
// crash reports in the future.
UnsubmittedCrashHandler.autoSubmit = true;
}
let childID = this.browserMap.get(browser.permanentKey);
let dumpID = this.childMap.get(childID);
if (!dumpID) {
return;
}
if (!message.data.sendReport) {
Services.telemetry.getHistogramById("FX_CONTENT_CRASH_NOT_SUBMITTED").add(1);
this.prefs.setBoolPref("sendReport", false);
return;
}
let {
includeURL,
comments,
email,
emailMe,
URL,
} = message.data;
let extraExtraKeyVals = {
"Comments": comments,
"Email": email,
"URL": URL,
};
// For the entries in extraExtraKeyVals, we only want to submit the
// extra data values where they are not the empty string.
for (let key in extraExtraKeyVals) {
let val = extraExtraKeyVals[key].trim();
if (!val) {
delete extraExtraKeyVals[key];
}
}
// URL is special, since it's already been written to extra data by
// default. In order to make sure we don't send it, we overwrite it
// with the empty string.
if (!includeURL) {
extraExtraKeyVals["URL"] = "";
}
CrashSubmit.submit(dumpID, {
recordSubmission: true,
extraExtraKeyVals,
}).then(null, Cu.reportError);
this.prefs.setBoolPref("sendReport", true);
this.prefs.setBoolPref("includeURL", includeURL);
this.prefs.setBoolPref("emailMe", emailMe);
if (emailMe) {
this.prefs.setCharPref("email", email);
} else {
this.prefs.setCharPref("email", "");
}
this.childMap.set(childID, null); // Avoid resubmission.
this.removeSubmitCheckboxesForSameCrash(childID);
/*** STUB ***/
return;
},
removeSubmitCheckboxesForSameCrash: function(childID) {
@ -518,17 +412,10 @@ this.TabCrashHandler = {
/**
* For some <xul:browser>, return a crash report dump ID for that browser
* if we have been informed of one. Otherwise, return null.
*
* @param browser (<xul:browser)
* The browser to try to get the dump ID for
* @returns dumpID (String)
*/
getDumpID(browser) {
if (!AppConstants.MOZ_CRASHREPORTER) {
return null;
}
return this.childMap.get(this.browserMap.get(browser.permanentKey));
/*** STUB ***/
return null;
},
}

26
browser/modules/PluginContent.jsm

@ -660,30 +660,8 @@ PluginContent.prototype = {
},
submitReport: function submitReport(plugin) {
if (!AppConstants.MOZ_CRASHREPORTER) {
return;
}
if (!plugin) {
Cu.reportError("Attempted to submit crash report without an associated plugin.");
return;
}
if (!(plugin instanceof Ci.nsIObjectLoadingContent)) {
Cu.reportError("Attempted to submit crash report on plugin that does not" +
"implement nsIObjectLoadingContent.");
return;
}
let runID = plugin.runID;
let submitURLOptIn = this.getPluginUI(plugin, "submitURLOptIn").checked;
let keyVals = {};
let userComment = this.getPluginUI(plugin, "submitComment").value.trim();
if (userComment)
keyVals.PluginUserComment = userComment;
if (submitURLOptIn)
keyVals.PluginContentURL = plugin.ownerDocument.URL;
this.global.sendAsyncMessage("PluginContent:SubmitReport",
{ runID, keyVals, submitURLOptIn });
/*** STUB ***/
return;
},
reloadPage: function () {

5
build/application.ini

@ -54,8 +54,3 @@ MaxVersion=@GRE_MILESTONE@
EnableProfileMigrator=1
#endif
#if MOZ_CRASHREPORTER
[Crash Reporter]
Enabled=1
ServerURL=https://crash-reports.mozilla.com/submit?id=@MOZ_APP_ID@&version=@MOZ_APP_VERSION@&buildid=@MOZ_BUILDID@
#endif

4
build/automation-build.mk

@ -48,11 +48,7 @@ else
AUTOMATION_PPARGS += -DIS_DEBUG_BUILD=0
endif
ifdef MOZ_CRASHREPORTER
AUTOMATION_PPARGS += -DCRASHREPORTER=1
else
AUTOMATION_PPARGS += -DCRASHREPORTER=0
endif
ifdef MOZ_ASAN
AUTOMATION_PPARGS += -DIS_ASAN=1

1
build/automation.py.in

@ -230,7 +230,6 @@ class Automation(object):
if crashreporter and not debugger:
env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
env['MOZ_CRASHREPORTER'] = '1'
else:
env['MOZ_CRASHREPORTER_DISABLE'] = '1'

1
build/mobile/b2gautomation.py

@ -157,7 +157,6 @@ class B2GRemoteAutomation(Automation):
env = {}
if crashreporter:
env['MOZ_CRASHREPORTER'] = '1'
env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
# We always hide the results table in B2G; it's much slower if we don't.

32
build/mobile/remoteautomation.py

@ -76,7 +76,6 @@ class RemoteAutomation(Automation):
if crashreporter and not debugger:
env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
env['MOZ_CRASHREPORTER'] = '1'
else:
env['MOZ_CRASHREPORTER_DISABLE'] = '1'
@ -215,36 +214,9 @@ class RemoteAutomation(Automation):
if javaException:
return True
# If crash reporting is disabled (MOZ_CRASHREPORTER!=1), we can't say
# anything.
if not self.CRASHREPORTER:
return False
# No crash reporting means we can't say anything.
return False
try:
dumpDir = tempfile.mkdtemp()
remoteCrashDir = posixpath.join(self._remoteProfile, 'minidumps')
if not self._devicemanager.dirExists(remoteCrashDir):
# If crash reporting is enabled (MOZ_CRASHREPORTER=1), the
# minidumps directory is automatically created when Fennec
# (first) starts, so its lack of presence is a hint that
# something went wrong.
print "Automation Error: No crash directory (%s) found on remote device" % remoteCrashDir
# Whilst no crash was found, the run should still display as a failure
return True
self._devicemanager.getDirectory(remoteCrashDir, dumpDir)
logger = get_default_logger()
if logger is not None:
crashed = mozcrash.log_crashes(logger, dumpDir, symbolsPath, test=self.lastTestSeen)
else:
crashed = Automation.checkForCrashes(self, dumpDir, symbolsPath)
finally:
try:
shutil.rmtree(dumpDir)
except:
print "WARNING: unable to remove directory: %s" % dumpDir
return crashed
def buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs):
# If remote profile is specified, use that instead

2
build/moz.build

@ -42,7 +42,7 @@ if CONFIG['MC_PALEMOON']:
if CONFIG['MOZ_APP_PROFILE']:
DEFINES['MOZ_APP_PROFILE'] = CONFIG['MOZ_APP_PROFILE']
for var in ('MOZ_CRASHREPORTER', 'MOZ_PROFILE_MIGRATOR',
for var in ('MOZ_PROFILE_MIGRATOR',
'MOZ_APP_STATIC_INI'):
if CONFIG[var]:
DEFINES[var] = True

7
caps/BasePrincipal.cpp

@ -7,9 +7,6 @@
#include "mozilla/BasePrincipal.h"
#include "nsDocShell.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsIAddonPolicyService.h"
#include "nsIContentSecurityPolicy.h"
#include "nsIEffectiveTLDService.h"
@ -149,10 +146,6 @@ OriginAttributes::CreateSuffix(nsACString& aStr) const
if (!mAddonId.IsEmpty()) {
if (mAddonId.FindCharInSet(dom::quota::QuotaManager::kReplaceChars) != kNotFound) {
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Crash_AddonId"),
NS_ConvertUTF16toUTF8(mAddonId));
#endif
MOZ_CRASH();
}
params->Set(NS_LITERAL_STRING("addonId"), mAddonId);

3
docshell/base/nsAboutRedirector.cpp

@ -50,9 +50,6 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::ALLOW_SCRIPT
},
{ "config", "chrome://global/content/config.xul", 0 },
#ifdef MOZ_CRASHREPORTER
{ "crashes", "chrome://global/content/crashes.xhtml", 0 },
#endif
{
"credits", "http://www.palemoon.org/Contributors.shtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |

7
docshell/base/nsDocShell.cpp

@ -2289,13 +2289,6 @@ nsDocShell::GetUseRemoteTabs(bool* aUseRemoteTabs)
NS_IMETHODIMP
nsDocShell::SetRemoteTabs(bool aUseRemoteTabs)
{
#ifdef MOZ_CRASHREPORTER
if (aUseRemoteTabs) {
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("DOMIPCEnabled"),
NS_LITERAL_CSTRING("1"));
}
#endif
mUseRemoteTabs = aUseRemoteTabs;
return NS_OK;
}

3
docshell/build/nsDocShellModule.cpp

@ -165,9 +165,6 @@ const mozilla::Module::ContractIDEntry kDocShellContracts[] = {
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "buildconfig", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "checkerboard", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "config", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
#ifdef MOZ_CRASHREPORTER
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "crashes", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
#endif
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "credits", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
#ifdef MOZ_DEVTOOLS
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "debugging", &kNS_ABOUT_REDIRECTOR_MODULE_CID },

4
dom/base/nsFrameMessageManager.cpp

@ -51,10 +51,6 @@
#include <algorithm>
#include "chrome/common/ipc_channel.h" // for IPC::Channel::kMaximumMessageSize
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#ifdef ANDROID
#include <android/log.h>
#endif

39
dom/ipc/ContentChild.cpp

@ -585,11 +585,6 @@ ContentChild::Init(MessageLoop* aIOLoop,
SendBackUpXResources(FileDescriptor(xSocketFd));
#endif
#ifdef MOZ_CRASHREPORTER
SendPCrashReporterConstructor(CrashReporter::CurrentThreadId(),
XRE_GetProcessType());
#endif
SendGetProcessAttributes(&mID, &mIsForApp, &mIsForBrowser);
InitProcessAttributes();
@ -1439,18 +1434,6 @@ ContentChild::RecvSetProcessSandbox(const MaybeFileDesc& aBroker)
sandboxEnabled = StartMacOSContentSandbox();
#endif
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("ContentSandboxEnabled"),
sandboxEnabled? NS_LITERAL_CSTRING("1") : NS_LITERAL_CSTRING("0"));
#if defined(XP_LINUX) && !defined(OS_ANDROID)
nsAutoCString flagsString;
flagsString.AppendInt(SandboxInfo::Get().AsInteger());
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("ContentSandboxCapabilities"), flagsString);
#endif /* XP_LINUX && !OS_ANDROID */
#endif /* MOZ_CRASHREPORTER */
#endif /* MOZ_CONTENT_SANDBOX */
return true;
@ -1740,11 +1723,7 @@ PCrashReporterChild*
ContentChild::AllocPCrashReporterChild(const mozilla::dom::NativeThreadId& id,
const uint32_t& processType)
{
#ifdef MOZ_CRASHREPORTER
return new CrashReporterChild();
#else
return nullptr;
#endif
}
bool
@ -2159,16 +2138,6 @@ ContentChild::ProcessingError(Result aCode, const char* aReason)
NS_RUNTIMEABORT("not reached");
}
#if defined(MOZ_CRASHREPORTER) && !defined(MOZ_B2G)
if (PCrashReporterChild* c = LoneManagedOrNullAsserts(ManagedPCrashReporterChild())) {
CrashReporterChild* crashReporter =
static_cast<CrashReporterChild*>(c);
nsDependentCString reason(aReason);
crashReporter->SendAnnotateCrashReport(
NS_LITERAL_CSTRING("ipc_channel_error"),
reason);
}
#endif
NS_RUNTIMEABORT("Content child abort due to IPC error");
}
@ -2872,10 +2841,6 @@ ContentChild::RecvShutdown()
// to wait for that event loop to finish. Otherwise we could prematurely
// terminate an "unload" or "pagehide" event handler (which might be doing a
// sync XHR, for example).
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCShutdownState"),
NS_LITERAL_CSTRING("RecvShutdown"));
#endif
nsCOMPtr<nsIThread> thread;
nsresult rv = NS_GetMainThread(getter_AddRefs(thread));
if (NS_SUCCEEDED(rv) && thread) {
@ -2923,10 +2888,6 @@ ContentChild::RecvShutdown()
// parent closes.
StartForceKillTimer();
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCShutdownState"),
NS_LITERAL_CSTRING("SendFinishShutdown"));
#endif
// Ignore errors here. If this fails, the parent will kill us after a
// timeout.
Unused << SendFinishShutdown();

71
dom/ipc/ContentParent.cpp

@ -249,10 +249,6 @@ using namespace mozilla::system;
#include "mozilla/widget/AudioSession.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsThread.h"
#endif
#ifdef ACCESSIBILITY
#include "nsAccessibilityService.h"
#endif
@ -273,9 +269,6 @@ using base::KillProcess;
using mozilla::ProfileGatherer;
#endif
#ifdef MOZ_CRASHREPORTER
using namespace CrashReporter;
#endif
using namespace mozilla::dom::power;
using namespace mozilla::media;
using namespace mozilla::embedding;
@ -1847,36 +1840,6 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
NS_LITERAL_CSTRING("content"), 1);
props->SetPropertyAsBool(NS_LITERAL_STRING("abnormal"), true);
#ifdef MOZ_CRASHREPORTER
// There's a window in which child processes can crash
// after IPC is established, but before a crash reporter
// is created.
if (PCrashReporterParent* p = LoneManagedOrNullAsserts(ManagedPCrashReporterParent())) {
CrashReporterParent* crashReporter =
static_cast<CrashReporterParent*>(p);
// If we're an app process, always stomp the latest URI
// loaded in the child process with our manifest URL. We
// would rather associate the crashes with apps than
// random child windows loaded in them.
//
// XXX would be nice if we could get both ...
if (!mAppManifestURL.IsEmpty()) {
crashReporter->AnnotateCrashReport(NS_LITERAL_CSTRING("URL"),
NS_ConvertUTF16toUTF8(mAppManifestURL));
}
// if mCreatedPairedMinidumps is true, we've already generated
// parent/child dumps for dekstop crashes.
if (!mCreatedPairedMinidumps) {
crashReporter->GenerateCrashReport(this, nullptr);
}
nsAutoString dumpID(crashReporter->ChildDumpID());
props->SetPropertyAsAString(NS_LITERAL_STRING("dumpID"), dumpID);
}
#endif
}
nsAutoString cpId;
cpId.AppendInt(static_cast<uint64_t>(this->ChildID()));
@ -3090,33 +3053,6 @@ ContentParent::KillHard(const char* aReason)
mCalledKillHard = true;
mForceKillTimer = nullptr;
#if defined(MOZ_CRASHREPORTER) && !defined(MOZ_B2G)
// We're about to kill the child process associated with this content.
// Something has gone wrong to get us here, so we generate a minidump
// of the parent and child for submission to the crash server.
if (PCrashReporterParent* p = LoneManagedOrNullAsserts(ManagedPCrashReporterParent())) {
CrashReporterParent* crashReporter =
static_cast<CrashReporterParent*>(p);
// GeneratePairedMinidump creates two minidumps for us - the main
// one is for the content process we're about to kill, and the other
// one is for the main browser process. That second one is the extra
// minidump tagging along, so we have to tell the crash reporter that
// it exists and is being appended.
nsAutoCString additionalDumps("browser");
crashReporter->AnnotateCrashReport(
NS_LITERAL_CSTRING("additional_minidumps"),
additionalDumps);
nsDependentCString reason(aReason);
crashReporter->AnnotateCrashReport(
NS_LITERAL_CSTRING("ipc_channel_error"),
reason);
// Generate the report and insert into the queue for submittal.
mCreatedPairedMinidumps = crashReporter->GenerateCompleteMinidump(this);
Telemetry::Accumulate(Telemetry::SUBPROCESS_KILL_HARD, reason, 1);
}
#endif
ProcessHandle otherProcessHandle;
if (!base::OpenProcessHandle(OtherPid(), &otherProcessHandle)) {
NS_ERROR("Failed to open child process when attempting kill.");
@ -3168,11 +3104,7 @@ PCrashReporterParent*
ContentParent::AllocPCrashReporterParent(const NativeThreadId& tid,
const uint32_t& processType)
{
#ifdef MOZ_CRASHREPORTER
return new CrashReporterParent();
#else
return nullptr;
#endif
}
bool
@ -5001,9 +4933,6 @@ ContentParent::RecvNotifyPushSubscriptionModifiedObservers(const nsCString& aSco
bool
ContentParent::RecvNotifyLowMemory()
{
#ifdef MOZ_CRASHREPORTER
nsThread::SaveMemoryReportNearOOM(nsThread::ShouldSaveMemoryReport::kForceReport);
#endif
return true;
}

83
dom/ipc/CrashReporterParent.cpp

@ -13,13 +13,6 @@
#include "mozilla/Telemetry.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#include "nsICrashService.h"
#include "mozilla/SyncRunnable.h"
#include "nsThreadUtils.h"
#endif
namespace mozilla {
namespace dom {
@ -29,9 +22,6 @@ void
CrashReporterParent::AnnotateCrashReport(const nsCString& key,
const nsCString& data)
{
#ifdef MOZ_CRASHREPORTER
mNotes.Put(key, data);
#endif
}
void
@ -49,9 +39,6 @@ CrashReporterParent::RecvAppendAppNotes(const nsCString& data)
CrashReporterParent::CrashReporterParent()
:
#ifdef MOZ_CRASHREPORTER
mNotes(4),
#endif
mStartTime(::time(nullptr))
, mInitialized(false)
{
@ -72,75 +59,5 @@ CrashReporterParent::SetChildData(const NativeThreadId& tid,
mProcessType = GeckoProcessType(processType);
}
#ifdef MOZ_CRASHREPORTER
bool
CrashReporterParent::GenerateCrashReportForMinidump(nsIFile* minidump,
const AnnotationTable* processNotes)
{
if (!CrashReporter::GetIDFromMinidump(minidump, mChildDumpID)) {
return false;
}
bool result = GenerateChildData(processNotes);
FinalizeChildData();
return result;
}
bool
CrashReporterParent::GenerateChildData(const AnnotationTable* processNotes)
{
MOZ_ASSERT(mInitialized);
if (mChildDumpID.IsEmpty()) {
NS_WARNING("problem with GenerateChildData: no child dump id yet!");
return false;
}
nsAutoCString type;
switch (mProcessType) {
case GeckoProcessType_Content:
type = NS_LITERAL_CSTRING("content");
break;
case GeckoProcessType_Plugin:
case GeckoProcessType_GMPlugin:
type = NS_LITERAL_CSTRING("plugin");
break;
default:
NS_ERROR("unknown process type");
break;
}
mNotes.Put(NS_LITERAL_CSTRING("ProcessType"), type);
char startTime[32];
SprintfLiteral(startTime, "%lld", static_cast<long long>(mStartTime));
mNotes.Put(NS_LITERAL_CSTRING("StartupTime"), nsDependentCString(startTime));
if (!mAppNotes.IsEmpty()) {
mNotes.Put(NS_LITERAL_CSTRING("Notes"), mAppNotes);
}
// Append these notes to the end of the extra file based on the current
// dump id we obtained from CreatePairedMinidumps.
bool ret = CrashReporter::AppendExtraData(mChildDumpID, mNotes);
if (ret && processNotes) {
ret = CrashReporter::AppendExtraData(mChildDumpID, *processNotes);
}
if (!ret) {
NS_WARNING("problem appending child data to .extra");
}
return ret;
}
void
CrashReporterParent::FinalizeChildData()
{
MOZ_ASSERT(mInitialized);
CrashReporterHost::NotifyCrashService(mProcessType, mChildDumpID, &mNotes);
mNotes.Clear();
}
#endif
} // namespace dom
} // namespace mozilla

236
dom/ipc/CrashReporterParent.h

@ -10,122 +10,16 @@
#include "mozilla/dom/PCrashReporterParent.h"
#include "mozilla/dom/TabMessageUtils.h"
#include "nsIFile.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#include "nsDataHashtable.h"
#endif
namespace mozilla {
namespace dom {
class CrashReporterParent : public PCrashReporterParent
{
#ifdef MOZ_CRASHREPORTER
typedef CrashReporter::AnnotationTable AnnotationTable;
#endif
public:
CrashReporterParent();
virtual ~CrashReporterParent();
#ifdef MOZ_CRASHREPORTER
/*
* Attempt to create a bare-bones crash report, along with extra process-
* specific annotations present in the given AnnotationTable. Calls
* GenerateChildData and FinalizeChildData.
*
* @returns true if successful, false otherwise.
*/
template<class Toplevel>
bool
GenerateCrashReport(Toplevel* t, const AnnotationTable* processNotes);
/*
* Attempt to generate a parent/child pair of minidumps from the given
* toplevel actor. This calls CrashReporter::CreateMinidumpsAndPair to
* generate the minidumps. Crash reporter annotations set prior to this
* call will be saved via PairedDumpCallbackExtra into an .extra file
* under the proper crash id. AnnotateCrashReport annotations are not
* set in this call and the report is not finalized.
*
* @returns true if successful, false otherwise.
*/
template<class Toplevel>
bool
GeneratePairedMinidump(Toplevel* t);
/*
* Attempts to take a minidump of the current process and pair that with
* a named minidump handed in by the caller.
*
* @param aTopLevel - top level actor this reporter is associated with.
* @param aMinidump - the minidump to associate with.
* @param aPairName - the name of the additional minidump.
* @returns true if successful, false otherwise.
*/
template<class Toplevel>
bool
GenerateMinidumpAndPair(Toplevel* aTopLevel, nsIFile* aMinidump,
const nsACString& aPairName);
/**
* Apply child process annotations to an existing paired mindump generated
* with GeneratePairedMinidump.
*
* Be careful about calling generate apis immediately after this call,
* see FinalizeChildData.
*
* @param processNotes (optional) - Additional notes to append. Annotations
* stored in mNotes will also be applied. processNotes can be null.
* @returns true if successful, false otherwise.
*/
bool
GenerateChildData(const AnnotationTable* processNotes);
/**
* Handles main thread finalization tasks after a report has been
* generated. Does the following:
* - register the finished report with the crash service manager
* - records telemetry related data about crashes
*
* Be careful about calling generate apis immediately after this call,
* if this api is called on a non-main thread it will fire off a runnable
* to complete its work async.
*/
void
FinalizeChildData();
/*
* Attempt to generate a full paired dump complete with any child
* annoations, and finalizes the report. Note this call is only valid
* on the main thread. Calling on a background thread will fail.
*
* @returns true if successful, false otherwise.
*/
template<class Toplevel>
bool
GenerateCompleteMinidump(Toplevel* t);
/**
* Submits a raw minidump handed in, calls GenerateChildData and
* FinalizeChildData. Used by content plugins and gmp.
*
* @returns true if successful, false otherwise.
*/
bool
GenerateCrashReportForMinidump(nsIFile* minidump,
const AnnotationTable* processNotes);
/*
* Instantiate a new crash reporter actor from a given parent that manages
* the protocol.
*
* @returns true if successful, false otherwise.
*/
template<class Toplevel>
static bool CreateCrashReporter(Toplevel* actor);
#endif // MOZ_CRASHREPORTER
/*
* Initialize this reporter with data from the child process.
*/
@ -160,14 +54,6 @@ public:
virtual bool RecvAppendAppNotes(const nsCString& aData) override;
#ifdef MOZ_CRASHREPORTER
void
NotifyCrashService();
#endif
#ifdef MOZ_CRASHREPORTER
AnnotationTable mNotes;
#endif
nsCString mAppNotes;
nsString mChildDumpID;
// stores the child main thread id
@ -178,128 +64,6 @@ public:
bool mInitialized;
};
#ifdef MOZ_CRASHREPORTER
template<class Toplevel>
inline bool
CrashReporterParent::GeneratePairedMinidump(Toplevel* t)
{
mozilla::ipc::ScopedProcessHandle child;
#ifdef XP_MACOSX
child = t->Process()->GetChildTask();
#else
if (!base::OpenPrivilegedProcessHandle(t->OtherPid(), &child.rwget())) {
NS_WARNING("Failed to open child process handle.");
return false;
}
#endif
nsCOMPtr<nsIFile> childDump;
if (CrashReporter::CreateMinidumpsAndPair(child,
mMainThread,
NS_LITERAL_CSTRING("browser"),
nullptr, // pair with a dump of this process and thread
getter_AddRefs(childDump)) &&
CrashReporter::GetIDFromMinidump(childDump, mChildDumpID)) {
return true;
}
return false;
}
template<class Toplevel>
inline bool
CrashReporterParent::GenerateMinidumpAndPair(Toplevel* aTopLevel,
nsIFile* aMinidumpToPair,
const nsACString& aPairName)
{
mozilla::ipc::ScopedProcessHandle childHandle;
#ifdef XP_MACOSX
childHandle = aTopLevel->Process()->GetChildTask();
#else
if (!base::OpenPrivilegedProcessHandle(aTopLevel->OtherPid(),
&childHandle.rwget())) {
NS_WARNING("Failed to open child process handle.");
return false;
}
#endif
nsCOMPtr<nsIFile> targetDump;
if (CrashReporter::CreateMinidumpsAndPair(childHandle,
mMainThread, // child thread id
aPairName,
aMinidumpToPair,
getter_AddRefs(targetDump)) &&
CrashReporter::GetIDFromMinidump(targetDump, mChildDumpID)) {
return true;
}
return false;
}
template<class Toplevel>
inline bool
CrashReporterParent::GenerateCrashReport(Toplevel* t,
const AnnotationTable* processNotes)
{
nsCOMPtr<nsIFile> crashDump;
if (t->TakeMinidump(getter_AddRefs(crashDump), nullptr) &&
CrashReporter::GetIDFromMinidump(crashDump, mChildDumpID)) {
bool result = GenerateChildData(processNotes);