nsICrashReporter

どうでもいいけど誰かの日記よりも自分の日記のほうがぜんぜんmoz-addonだ。

fx3からgoogle-breakpadというやつでクラッシュをハンドリングするようになっていて、nsICrashReporter経由で特定文字列をセットしておくと、crashReporterにセットされた文字列を入れてもらえる。
評価タイミングはannotateCrashReportが呼び出されたときなので、"クラッシュするとき"になにか処理をできるわけではありませんでした。残念。

google-breakpadはクライアントとサーバのセットになっていて、他のアプリケーションでも使えるのでおもしろそうです。

mozilla/browser/components/sessionstore/src/nsSessionStore.js

  /**
   * Annotate a breakpad crash report with the currently selected tab's URL.
   */
  _updateCrashReportURL: function sss_updateCrashReportURL(aWindow) {
    if (!Ci.nsICrashReporter) {
      // if breakpad isn't built, don't bother next time at all
      this._updateCrashReportURL = function(aWindow) {};
      return;
    }
    try {
      var currentUrl = aWindow.getBrowser().currentURI.spec;
      var cr = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsICrashReporter);
      cr.annotateCrashReport("URL", currentUrl);
    }

ちょうどクラッシュした。
Crash Reporter(crashreporter.app)っていうアプリケーションが別に起動する。