From 5d92a9c43df26a4b9debd8f3bd3fb5f53e1af0d4 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 2 Sep 2011 05:17:30 +0000 Subject: [PATCH] Change debug.store.submitLimit to debug.store.submitSize and have it be the number of characters in the output, defaulting to 1 million --- .../content/zotero/preferences/preferences.js | 2 +- chrome/content/zotero/xpcom/debug.js | 28 +++++++++++++------ defaults/preferences/zotero.js | 2 +- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/chrome/content/zotero/preferences/preferences.js b/chrome/content/zotero/preferences/preferences.js index cccc0864f..41c81ca85 100644 --- a/chrome/content/zotero/preferences/preferences.js +++ b/chrome/content/zotero/preferences/preferences.js @@ -1335,7 +1335,7 @@ Zotero_Preferences.Debug_Output = { var url = "https://repo.zotero.org/repo/report?debug=1"; var output = Zotero.Debug.get( - Zotero.Prefs.get('debug.store.submitLimit'), + Zotero.Prefs.get('debug.store.submitSize'), Zotero.Prefs.get('debug.store.submitLineLength') ); Zotero_Preferences.Debug_Output.setStore(false); diff --git a/chrome/content/zotero/xpcom/debug.js b/chrome/content/zotero/xpcom/debug.js index c1c58623e..2a1f07923 100644 --- a/chrome/content/zotero/xpcom/debug.js +++ b/chrome/content/zotero/xpcom/debug.js @@ -107,24 +107,36 @@ Zotero.Debug = new function () { } - this.get = function (limit, maxLength) { + this.get = function (maxChars, maxLineLength) { var output = _output; var total = output.length; - if (limit && limit < total) { - output = output.slice(limit * -1); + if (total == 0) { + return ""; } - if (maxLength) { + if (maxLineLength) { for (var i=0, len=output.length; i maxLength) { - output[i] = Zotero.Utilities.ellipsize(output[i], maxLength, true); + if (output[i].length > maxLineLength) { + output[i] = Zotero.Utilities.ellipsize(output[i], maxLineLength, true); } } } - return output.join('\n\n'); + output = output.join('\n\n'); + + if (maxChars) { + output = output.substr(maxChars * -1); + // Cut at two newlines + for (var i=1, len=output.length; i