commit fd1ac3104a4ad3ba5d0087c5ef6d86f36c3b0ef8 parent e84f7f6ef84f293e848980113a64cee4e772c5ca Author: Dan Stillman <dstillman@zotero.org> Date: Thu, 12 Feb 2009 08:00:29 +0000 - Fix "creator.serialize() is not a function" sync error - Added Zotero.Utilities.isEmpty(obj) Diffstat:
| M | chrome/content/zotero/xpcom/sync.js | | | 4 | +++- |
| M | chrome/content/zotero/xpcom/utilities.js | | | 14 | ++++++++++++++ |
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js @@ -2452,7 +2452,9 @@ Zotero.Sync.Server.Data = new function() { }; if (type == 'item') { - io.dataIn.changedCreators = changedCreators; + if (!Zotero.Utilities.prototype.isEmpty(changedCreators)) { + io.dataIn.changedCreators = changedCreators; + } } var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js @@ -291,6 +291,20 @@ Zotero.Utilities.prototype.isInt = function(x) { } + +/** + * Test if an object is empty + * + * @param {Object} + */ +Zotero.Utilities.prototype.isEmpty = function (obj) { + for (var i in obj) { + return false; + } + return true; +} + + /** * Compares an array with another and returns an array with * the values from array2 that don't exist in array1