diff --git a/chrome/content/zotero/addCitationDialog.js b/chrome/content/zotero/addCitationDialog.js index 96d132667..077def9a5 100644 --- a/chrome/content/zotero/addCitationDialog.js +++ b/chrome/content/zotero/addCitationDialog.js @@ -159,6 +159,8 @@ var Zotero_Citation_Dialog = new function () { if(io.items.length) { io.locatorTypes = new Array(document.getElementById("tree-locator-type").selectedItem.value); io.locators = new Array(document.getElementById("tree-locator").value); + } else { + io.items = undefined; } } } diff --git a/chrome/content/zotero/xpcom/cite.js b/chrome/content/zotero/xpcom/cite.js index 6da7e9fdb..5f536c53f 100644 --- a/chrome/content/zotero/xpcom/cite.js +++ b/chrome/content/zotero/xpcom/cite.js @@ -1272,14 +1272,13 @@ Zotero.CSL.ItemSet.prototype.add = function(items) { * or item IDs */ Zotero.CSL.ItemSet.prototype.remove = function(items) { - Zotero.debug("removing!") for(var i in items) { + if(!item) continue; if(items[i] instanceof Zotero.CSL.Item) { var item = items[i]; } else { var item = this.itemsById[items[i]]; } - Zotero.debug("old index was "+this.items.indexOf(item)) this.itemsById[item.getID()] = undefined; this.items.splice(this.items.indexOf(item), 1); } diff --git a/chrome/content/zotero/xpcom/cite_compat.js b/chrome/content/zotero/xpcom/cite_compat.js index bfc3d2430..052f86613 100644 --- a/chrome/content/zotero/xpcom/cite_compat.js +++ b/chrome/content/zotero/xpcom/cite_compat.js @@ -295,10 +295,12 @@ Zotero.CSL.Compat.ItemSet.prototype.getItemsByIds = function(ids) { Zotero.CSL.Compat.ItemSet.prototype.add = function(items) { this.items = this.items.concat(items); + Zotero.debug(this.items); } Zotero.CSL.Compat.ItemSet.prototype.remove = function(items) { for(var i in items) { + if(!item) continue; if(items[i] instanceof Zotero.Item) { var item = items[i]; } else { diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index a1b6f3ec2..f6c967176 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -306,12 +306,16 @@ Zotero.Integration.DataListener.prototype._bodyData = function() { var utf8Stream = Components.classes["@mozilla.org/intl/converter-input-stream;1"] .createInstance(Components.interfaces.nsIConverterInputStream); - utf8Stream.init(dataStream, "UTF-8", 1024, "?"); + utf8Stream.init(dataStream, "UTF-8", 4096, "?"); + + this.body = ""; var string = {}; - utf8Stream.readString(this.bodyLength, string) + while(utf8Stream.readString(this.bodyLength, string)) { + this.body += string.value; + } // handle envelope - var output = Zotero.Integration.handleEnvelope(string.value); + var output = Zotero.Integration.handleEnvelope(this.body); this._requestFinished(output); } } @@ -382,6 +386,16 @@ Zotero.Integration.SOAP = new function() { var citation, update; for(var i=3; i