commit 22026e5cfb3ab4671a886b991b86277f97dd72b2
parent fbf1f5735285fa33ec00342f550f92e064f791da
Author: Simon Kornblith <simon@simonster.com>
Date: Sat, 5 Mar 2016 17:41:15 -0500
Fix sandbox permissions issue with .length on nested translators
Addresses #520
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js
@@ -91,9 +91,8 @@ Zotero.Translate.Sandbox = {
const allowedObjects = ["complete", "attachments", "seeAlso", "creators", "tags", "notes"];
// Create a new object here, so that we strip the "complete" property
- // (But don't create a new object if we're in a child translator, since that
- // would be a problem for the sandbox)
- var newItem = translate._parentTranslator ? item : {};
+ var newItem = {};
+ var oldItem = item;
for(var i in item) {
var val = item[i];
if(i === "complete" || (!val && val !== 0)) continue;
@@ -135,6 +134,11 @@ Zotero.Translate.Sandbox = {
// just return the item array
if(translate._libraryID === false || translate._parentTranslator) {
translate.newItems.push(item);
+ if(translate._parentTranslator && Zotero.isFx && !Zotero.isBookmarklet) {
+ // Copy object so it is accessible to child translator
+ item = translate._sandboxManager.copyObject(item);
+ item.complete = oldItem.complete;
+ }
translate._runHandler("itemDone", item, item);
return;
}