commit 38df733a376f451226ef7128174876c9e875c392
parent 3741a75b1d75e089bdf01db4001e3adb24ada467
Author: Adomas VenĨkauskas <adomas.ven@gmail.com>
Date: Thu, 15 Sep 2016 13:29:20 +0300
Fixes overriden Zotero object in connector sandboxes
Occurs when not using `with` statement, which is highly discouraged and
unsupported in strict mode.
Diffstat:
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/chrome/content/zotero/tools/testTranslators/translatorTester.js b/chrome/content/zotero/tools/testTranslators/translatorTester.js
@@ -36,7 +36,7 @@ try {
var Zotero;
}
-Zotero_TranslatorTesters = new function() {
+var Zotero_TranslatorTesters = new function() {
const TEST_TYPES = ["web", "import", "export", "search"];
var collectedResults = {};
@@ -190,7 +190,7 @@ Zotero_TranslatorTesters = new function() {
* @param {Function} [debugCallback] A function to call to write debug output. If not present,
* Zotero.debug will be used.
*/
-Zotero_TranslatorTester = function(translator, type, debugCallback) {
+var Zotero_TranslatorTester = function(translator, type, debugCallback) {
this.type = type;
this.translator = translator;
this.output = "";
diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js
@@ -1741,9 +1741,12 @@ Zotero.Translate.Base.prototype = {
this._sandboxManager = new Zotero.Translate.SandboxManager(this._sandboxLocation);
}
const createArrays = "['creators', 'notes', 'tags', 'seeAlso', 'attachments']";
- var src = "var Zotero = {};"+
- "Zotero.Item = function (itemType) {"+
- "const createArrays = "+createArrays+";"+
+ var src = "";
+ if (Zotero.isFx && !Zotero.isBookmarklet) {
+ src = "var Zotero = {};";
+ }
+ src += "Zotero.Item = function (itemType) {"+
+ "var createArrays = "+createArrays+";"+
"this.itemType = itemType;"+
"for(var i=0, n=createArrays.length; i<n; i++) {"+
"this[createArrays[i]] = [];"+