Bug 1422269 - Allow asan-reporter to report crashed tabs immediately. r?mconley
MozReview-Commit-ID: BsO3LID1J9s
--- a/browser/extensions/asan-reporter/bootstrap.js
+++ b/browser/extensions/asan-reporter/bootstrap.js
@@ -26,22 +26,47 @@ const PREF_LOG_LEVEL = "asanreporter.log
// Setup logging
const LOGGER_NAME = "extensions.asanreporter";
let logger = Log.repository.getLogger(LOGGER_NAME);
logger.addAppender(new Log.ConsoleAppender(new Log.BasicFormatter()));
logger.addAppender(new Log.DumpAppender(new Log.BasicFormatter()));
logger.level = Preferences.get(PREF_LOG_LEVEL, Log.Level.Info);
+this.TabCrashObserver = {
+ init() {
+ if (this.initialized)
+ return;
+ this.initialized = true;
+
+ Services.obs.addObserver(this, "ipc:content-shutdown");
+ },
+
+ observe(aSubject, aTopic, aData) {
+ if (aTopic == "ipc:content-shutdown") {
+ aSubject.QueryInterface(Ci.nsIPropertyBag2);
+ if (!aSubject.get("abnormal")) {
+ return;
+ }
+ processDirectory("/tmp");
+ }
+ },
+};
+
function install(aData, aReason) {}
function uninstall(aData, aReason) {}
function startup(aData, aReason) {
logger.info("Starting up...");
+
+ // Install a handler to observe tab crashes, so we can report those right
+ // after they happen instead of relying on the user to restart the browser.
+ TabCrashObserver.init();
+
// We could use OS.Constants.Path.tmpDir here, but unfortunately there is
// no way in C++ to get the same value *prior* to xpcom initialization.
// Since ASan needs its options, including the "log_path" option already
// at early startup, there is no way to pass this on to ASan.
//
// Instead, we hardcode the /tmp directory here, which should be fine in
// most cases, as long as we are on Linux and Mac (the main targets for
// this addon at the time of writing).
--- a/browser/extensions/asan-reporter/clone_asan_reporter.sh
+++ b/browser/extensions/asan-reporter/clone_asan_reporter.sh
@@ -1,11 +1,11 @@
#!/bin/sh
mkdir tmp/
git clone --no-checkout --depth 1 https://github.com/choller/firefox-asan-reporter tmp/
-(cd tmp && git reset --hard e1a5d7dc5a2706af72bac0f11eab34b3afdb48ba)
+(cd tmp && git reset --hard d508c6e3f5df752a9a7a2d6f1e4e7261ec2290e7)
# Copy only whitelisted files
cp tmp/bootstrap.js tmp/install.rdf.in tmp/moz.build tmp/README.md tmp/LICENSE .
# Remove the temporary directory
rm -Rf tmp/