From bb7ee9b436e5a33aeb22edde51ef3e2465485ca9 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 25 Oct 2012 14:40:22 -0400 Subject: [PATCH 1/7] Enable autocomplete for programmingLanguage --- chrome/content/zotero/xpcom/data/itemFields.js | 1 + 1 file changed, 1 insertion(+) diff --git a/chrome/content/zotero/xpcom/data/itemFields.js b/chrome/content/zotero/xpcom/data/itemFields.js index fbb56cc5e7..8fb1296b00 100644 --- a/chrome/content/zotero/xpcom/data/itemFields.js +++ b/chrome/content/zotero/xpcom/data/itemFields.js @@ -315,6 +315,7 @@ Zotero.ItemFields = new function() { 'archive', 'archiveLocation', 'language', + 'programmingLanguage', 'rights', // TEMP - NSF From e0e4699c3e33fd9dcb9f00ab2ddb440067ebd9a9 Mon Sep 17 00:00:00 2001 From: aurimasv Date: Sat, 22 Sep 2012 18:43:13 -0500 Subject: [PATCH 2/7] Fix cleanDOI Conflicts: chrome/content/zotero/xpcom/utilities.js --- chrome/content/zotero/locale/csl | 2 +- chrome/content/zotero/xpcom/utilities.js | 3 ++- translators | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/locale/csl b/chrome/content/zotero/locale/csl index 2288e745e7..36d26a584a 160000 --- a/chrome/content/zotero/locale/csl +++ b/chrome/content/zotero/locale/csl @@ -1 +1 @@ -Subproject commit 2288e745e7c13cac7a78bb294d09cf19ad2cf23e +Subproject commit 36d26a584ac869f2dfbdd528f57141a3bbcf016f diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index b7df62eb92..a77a89388b 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -262,7 +262,8 @@ Zotero.Utilities = { throw "cleanDOI: argument must be a string"; } - return x.match(/10\.[0-9]{4,}\/[^\s]*[^\s\.,]/); + var doi = x.match(/10\.[0-9]{4,}\/[^\s]*[^\s\.,]/); + return doi ? doi[0] : null; }, /** diff --git a/translators b/translators index af463b24e4..a685b279c6 160000 --- a/translators +++ b/translators @@ -1 +1 @@ -Subproject commit af463b24e40f0b426a40b55cf5f0d74dcab0d5b0 +Subproject commit a685b279c61b5c1b1368ea7997fc2b4914eedf8a From a8efc1b874096ed049026c954222a59389687e65 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 29 Oct 2012 15:51:53 -0400 Subject: [PATCH 3/7] Fix search translation for Firefox 17 sandboxing changes --- chrome/content/zotero/xpcom/translation/translate.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index b62cb76071..aa432ccb61 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -2097,7 +2097,10 @@ Zotero.Translate.Search.prototype.complete = function(returnValue, error) { /** * Pass search item to detect* and do* functions */ -Zotero.Translate.Search.prototype._getParameters = function() { return [this.search]; }; +Zotero.Translate.Search.prototype._getParameters = function() { + if(Zotero.isFx) return [this._sandboxManager.sandbox.Zotero._transferItem(JSON.stringify(this.search))]; + return [this.search]; +}; /** * Extract sandbox location from translator target From b41e2368a5b61a40e89ce18fa27376b01caee7b1 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Tue, 9 Oct 2012 18:29:21 -0400 Subject: [PATCH 4/7] Update for https://bugzilla.mozilla.org/show_bug.cgi?id=794602 --- chrome/content/zotero/xpcom/attachments.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index ec98767d9a..a0e58a95c2 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -344,7 +344,11 @@ Zotero.Attachments = new function(){ var nsIURL = Components.classes["@mozilla.org/network/standard-url;1"] .createInstance(Components.interfaces.nsIURL); nsIURL.spec = url; - wbp.saveURI(nsIURL, null, null, null, null, file); + try { + wbp.saveURI(nsIURL, null, null, null, null, file); + } catch(e if e.name === "NS_ERROR_XPC_NOT_ENOUGH_ARGS") { + wbp.saveURI(nsIURL, null, null, null, null, file, null); + } if(callback) callback(attachmentItem); From c6b812f0b16fb5c84c81a9abb96c8532f26cf879 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Wed, 10 Oct 2012 15:31:48 -0400 Subject: [PATCH 5/7] Fix typo --- chrome/content/zotero/recognizePDF.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/recognizePDF.js b/chrome/content/zotero/recognizePDF.js index 1d38991b5e..ffdf22238c 100644 --- a/chrome/content/zotero/recognizePDF.js +++ b/chrome/content/zotero/recognizePDF.js @@ -486,8 +486,8 @@ Zotero_RecognizePDF.Recognizer.prototype._selectItems = function(/**Zotero.Trans /**Object*/ items, /**Function**/ callback) { for(var i in items) { var obj = {}; - obj[i] = items; + obj[i] = items[i]; callback(obj); return; } -} \ No newline at end of file +} From 66347c27342ecee76740ba9d4de8b165b6a92d20 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Wed, 10 Oct 2012 15:33:40 -0400 Subject: [PATCH 6/7] Another fixe for https://bugzilla.mozilla.org/show_bug.cgi?id=794602 --- chrome/content/zotero/xpcom/attachments.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index a0e58a95c2..1838100549 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -347,6 +347,8 @@ Zotero.Attachments = new function(){ try { wbp.saveURI(nsIURL, null, null, null, null, file); } catch(e if e.name === "NS_ERROR_XPC_NOT_ENOUGH_ARGS") { + // https://bugzilla.mozilla.org/show_bug.cgi?id=794602 + // XXX Always use when we no longer support Firefox < 18 wbp.saveURI(nsIURL, null, null, null, null, file, null); } @@ -620,7 +622,13 @@ Zotero.Attachments = new function(){ throw (e); } }); - wbp.saveURI(nsIURL, null, null, null, null, file); + try { + wbp.saveURI(nsIURL, null, null, null, null, file); + } catch(e if e.name === "NS_ERROR_XPC_NOT_ENOUGH_ARGS") { + // https://bugzilla.mozilla.org/show_bug.cgi?id=794602 + // XXX Always use when we no longer support Firefox < 18 + wbp.saveURI(nsIURL, null, null, null, null, file, null); + } } // Add to collections From d13e7037c333264ac11dac7c3f86b963e2862a0c Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Wed, 10 Oct 2012 15:34:10 -0400 Subject: [PATCH 7/7] Fix Zotero.selectItems for Firefox 17 sandboxing changes --- .../content/zotero/xpcom/translation/translate.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index aa432ccb61..f9f4197691 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -432,13 +432,17 @@ Zotero.Translate.Sandbox = { * @param {Object} items An set of id => name pairs in object format */ "selectItems":function(translate, items, callback) { + function transferObject(obj) { + return Zotero.isFx ? translate._sandboxManager.sandbox.JSON.parse(JSON.stringify(obj)) : obj; + } + if(Zotero.Utilities.isEmpty(items)) { throw new Error("Translator called select items with no items"); } if(translate._selectedItems) { // if we have a set of selected items for this translation, use them - return translate._selectedItems; + return transferObject(translate._selectedItems); } else if(translate._handlers.select) { // whether the translator supports asynchronous selectItems var haveAsyncCallback = !!callback; @@ -452,7 +456,7 @@ Zotero.Translate.Sandbox = { // up to pop off the async process var newCallback = function(selectedItems) { callbackExecuted = true; - callback(selectedItems); + callback(transferObject(selectedItems)); if(haveAsyncHandler) translate.decrementAsyncProcesses("Zotero.selectItems()"); }; } else { @@ -464,7 +468,7 @@ Zotero.Translate.Sandbox = { if(haveAsyncHandler) { translate.translate(translate._libraryID, translate._saveAttachments, selectedItems); } else { - returnedItems = selectedItems; + returnedItems = transferObject(selectedItems); } }; } @@ -476,7 +480,7 @@ Zotero.Translate.Sandbox = { "Please pass items as to the callback provided as the third argument to "+ "the handler."); - returnedItems = returnValue; + returnedItems = transferObject(returnValue); haveAsyncHandler = false; } else { // if we don't have returnedItems set already, the handler is asynchronous @@ -495,7 +499,7 @@ Zotero.Translate.Sandbox = { } else { translate._debug("COMPAT WARNING: No callback was provided for "+ "Zotero.selectItems(). When executed outside of Firefox, a selectItems() call "+ - "will require that this translator to be called multiple times.", 1); + "will require this translator to be called multiple times.", 1); if(haveAsyncHandler) { // The select handler is asynchronous, but this translator doesn't support