diff --git a/chrome/content/zotero/xpcom/data/dataObject.js b/chrome/content/zotero/xpcom/data/dataObject.js index 35aedb5a36..179ceb9642 100644 --- a/chrome/content/zotero/xpcom/data/dataObject.js +++ b/chrome/content/zotero/xpcom/data/dataObject.js @@ -790,10 +790,9 @@ Zotero.DataObject.prototype.editCheck = function () { * @return {Promise} Promise for itemID of new item, * TRUE on item update, or FALSE if item was unchanged */ -Zotero.DataObject.prototype.save = Zotero.Promise.coroutine(function* (options) { - options = options || {}; +Zotero.DataObject.prototype.save = Zotero.Promise.coroutine(function* (options = {}) { var env = { - options: options, + options: Object.assign({}, options), transactionOptions: {} }; @@ -880,8 +879,8 @@ Zotero.DataObject.prototype.save = Zotero.Promise.coroutine(function* (options) }); -Zotero.DataObject.prototype.saveTx = function (options) { - options = options || {}; +Zotero.DataObject.prototype.saveTx = function (options = {}) { + options = Object.assign({}, options); options.tx = true; return this.save(options); } @@ -1129,7 +1128,9 @@ Zotero.DataObject.prototype.erase = Zotero.Promise.coroutine(function* (options throw new Error("'options' must be an object"); } - var env = { options }; + var env = { + options: Object.assign({}, options) + }; if (!env.options.tx && !Zotero.DB.inTransaction()) { Zotero.logError("erase() called on Zotero." + this._ObjectType + " without a wrapping "