diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js index fa5cd48359..6221b23a6c 100644 --- a/chrome/content/zotero/xpcom/db.js +++ b/chrome/content/zotero/xpcom/db.js @@ -584,8 +584,10 @@ Zotero.DBConnection.prototype.waitForTransaction = function () { if (!this._inTransaction) { return Zotero.Promise.resolve().cancellable(); } - Zotero.debug("Waiting for transaction to finish"); - Zotero.debug((new Error).stack); + if (Zotero.Debug.enabled) { + Zotero.debug("Waiting for transaction to finish", 5); + Zotero.debug(Zotero.Debug.filterStack((new Error).stack), 6); + } return this._transactionPromise; }; diff --git a/chrome/content/zotero/xpcom/debug.js b/chrome/content/zotero/xpcom/debug.js index a2542c1ad5..7db8a74e89 100644 --- a/chrome/content/zotero/xpcom/debug.js +++ b/chrome/content/zotero/xpcom/debug.js @@ -204,4 +204,14 @@ Zotero.Debug = new function () { } return str.substr(1); }; + + + /** + * Strip Bluebird lines from a stack trace + * + * @param {String} stack + */ + this.filterStack = function (stack) { + return stack.split(/\n/).filter(line => line.indexOf('zotero/bluebird') == -1).join('\n'); + } }