www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 9e75aba8fd64ee6c2c132061b535140f8afc9bd1
parent 59913cc5c02dc29b39644895d99d539ab75ee4ff
Author: Simon Kornblith <simon@simonster.com>
Date:   Mon, 30 Jul 2012 14:54:05 -0400

Convert arrays passed to Z.selectItems to objects

Diffstat:
Mchrome/content/zotero/xpcom/translation/translate.js | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js @@ -424,6 +424,15 @@ Zotero.Translate.Sandbox = { throw new Error("Translator called select items with no items"); } + // Some translators pass an array rather than an object to Zotero.selectItems. + // This will break messaging outside of Firefox, so we need to fix it. + if(Object.prototype.toString.call(items) === "[object Array]") { + translate._debug("WARNING: Zotero.selectItems should be called with an object, not an array"); + var itemsObj = {}; + for(var i in items) itemsObj[i] = items[i]; + items = itemsObj; + } + if(translate._selectedItems) { // if we have a set of selected items for this translation, use them return translate._selectedItems;