From 25ba8c70063d791b54b4529bf6386c914c3e2fc6 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 2 Nov 2011 16:07:50 -0400 Subject: [PATCH] Prepend error info (except other add-ons info) to debug output --- chrome/content/zotero/xpcom/debug.js | 5 ++- chrome/content/zotero/xpcom/zotero.js | 52 +++++++++++++++++---------- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/chrome/content/zotero/xpcom/debug.js b/chrome/content/zotero/xpcom/debug.js index ae6672271..b401d5598 100644 --- a/chrome/content/zotero/xpcom/debug.js +++ b/chrome/content/zotero/xpcom/debug.js @@ -136,7 +136,10 @@ Zotero.Debug = new function () { } } - return output; + return Zotero.getErrors(true).join('\n\n') + + "\n\n" + Zotero.getSystemInfo() + "\n\n" + + "=========================================================\n\n" + + output; } diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index dc5742e10..3cf9afb24 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -1208,28 +1208,44 @@ const ZOTERO_CONFIG = { } + /** + * Get versions, platform, etc. + * + * Can be used synchronously or asynchronously; info on other add-ons + * is available only in async mode + */ function getSystemInfo(callback) { var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]. getService(Components.interfaces.nsIXULAppInfo); - Zotero.getInstalledExtensions(function(extensions) { - var info = { - version: Zotero.version, - platform: Zotero.platform, - oscpu: Zotero.oscpu, - locale: Zotero.locale, - appName: appInfo.name, - appVersion: appInfo.version, - extensions: extensions.join(', ') - }; - - var str = ''; - for (var key in info) { - str += key + ' => ' + info[key] + ', '; - } - str = str.substr(0, str.length - 2); - callback(str); - }); + var info = { + version: Zotero.version, + platform: Zotero.platform, + oscpu: Zotero.oscpu, + locale: Zotero.locale, + appName: appInfo.name, + appVersion: appInfo.version + }; + + if (callback) { + Zotero.getInstalledExtensions(function(extensions) { + info.extensions = extensions.join(', '); + + var str = ''; + for (var key in info) { + str += key + ' => ' + info[key] + ', '; + } + str = str.substr(0, str.length - 2); + callback(str); + }); + } + + var str = ''; + for (var key in info) { + str += key + ' => ' + info[key] + ', '; + } + str = str.substr(0, str.length - 2); + return str; }