From e8ac371042d7d392f5a5995c03213aa1ff5808c2 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sun, 1 Jul 2012 16:35:18 -0400 Subject: [PATCH 01/10] Rename Zotero.OAuth to Zotero.API, part 2 --- chrome/content/zotero/xpcom/connector/translate_item.js | 6 +++--- chrome/content/zotero/xpcom/translation/translate.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/xpcom/connector/translate_item.js b/chrome/content/zotero/xpcom/connector/translate_item.js index e0dbcd74a1..b01710237a 100644 --- a/chrome/content/zotero/xpcom/connector/translate_item.js +++ b/chrome/content/zotero/xpcom/connector/translate_item.js @@ -127,7 +127,7 @@ Zotero.Translate.ItemSaver.prototype = { } var me = this; - Zotero.OAuth.createItem({"items":newItems}, null, function(statusCode, response) { + Zotero.API.createItem({"items":newItems}, null, function(statusCode, response) { if(statusCode !== 201) { callback(false, new Error("Save to server failed")); } else { @@ -190,7 +190,7 @@ Zotero.Translate.ItemSaver.prototype = { }); } - Zotero.OAuth.createItem({"items":attachmentPayload}, itemKey, function(statusCode, response) { + Zotero.API.createItem({"items":attachmentPayload}, itemKey, function(statusCode, response) { var err; if(statusCode === 201) { try { @@ -362,7 +362,7 @@ Zotero.Translate.ItemSaver.prototype = { Zotero.Translate.ItemSaver._attachmentCallbacks[attachment.id] = function(status, error) { attachmentCallback(attachment, status, error); }; - Zotero.OAuth.uploadAttachment(attachment); + Zotero.API.uploadAttachment(attachment); }, /** diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index b629d66bc8..9a4e0357f2 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -1569,7 +1569,7 @@ Zotero.Translate.Web.prototype._translateTranslatorLoaded = function() { }, function(obj) { me._translateRPCComplete(obj) }); } else if(runMode === Zotero.Translator.RUN_MODE_ZOTERO_SERVER) { var me = this; - Zotero.OAuth.createItem({"url":this.document.location.href.toString()}, null, + Zotero.API.createItem({"url":this.document.location.href.toString()}, null, function(statusCode, response) { me._translateServerComplete(statusCode, response); }); @@ -1618,7 +1618,7 @@ Zotero.Translate.Web.prototype._translateServerComplete = function(statusCode, r var me = this; this._runHandler("select", response, function(selectedItems) { - Zotero.OAuth.createItem({ + Zotero.API.createItem({ "url":me.document.location.href.toString(), "items":selectedItems }, null, From 6bed648eb2fb95baddb0275efb5688360d2c419a Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 2 Jul 2012 00:11:35 -0400 Subject: [PATCH 02/10] Dump stack on translation failure in newer versions of Firefox, where it appears to have ceased to be enumerable --- chrome/content/zotero/xpcom/translation/translate.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 9a4e0357f2..bb29810368 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -1406,7 +1406,6 @@ Zotero.Translate.Base.prototype = { Zotero.debug(string, level); } }, - /** * Generates a string from an exception * @param {String|Exception} error @@ -1416,13 +1415,17 @@ Zotero.Translate.Base.prototype = { if(typeof(error) == "string") { errorString = "\nthrown exception => "+error; } else { + var haveStack = false; for(var i in error) { if(typeof(error[i]) != "object") { + if(i === "stack") haveStack = true; errorString += "\n"+i+' => '+error[i]; } } - if(error) { - errorString += "\nstring => "+error.toString(); + errorString += "\nstring => "+error.toString(); + if(!haveStack && error.stack) { + // In case the stack is not enumerable + errorString += "\nstack => "+error.stack.toString(); } } From 73761723c0e79152165b6c5c330c5aa88ba1f8fa Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 2 Jul 2012 00:22:14 -0400 Subject: [PATCH 03/10] Don't use instanceof Array check in ZU.xpath. It fails in Firefox because Array in the sandbox != Array outside of the sandbox. Instead, just check for a length property. --- chrome/content/zotero/xpcom/utilities.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index ef2882e21f..8850963233 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -963,7 +963,7 @@ Zotero.Utilities = { }; } - if(!(elements instanceof Array)) elements = [elements]; + if(!("length" in elements)) elements = [elements]; var results = []; for(var i=0, n=elements.length; i Date: Mon, 2 Jul 2012 21:49:10 -0400 Subject: [PATCH 04/10] Update to citeproc-js 1.0.353 --- chrome/content/zotero/xpcom/citeproc.js | 115 ++++++++++++++---------- 1 file changed, 66 insertions(+), 49 deletions(-) diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index 3e817f4cbe..c21957b6f5 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -57,7 +57,7 @@ if (!Array.indexOf) { }; } var CSL = { - PROCESSOR_VERSION: "1.0.351", + PROCESSOR_VERSION: "1.0.353", STATUTE_SUBDIV_GROUPED_REGEX: /((?:^| )(?:art|ch|Ch|subch|p|pp|para|subpara|pt|r|sec|subsec|Sec|sch|tit)\.)/g, STATUTE_SUBDIV_PLAIN_REGEX: /(?:(?:^| )(?:art|ch|Ch|subch|p|pp|para|subpara|pt|r|sec|subsec|Sec|sch|tit)\.)/, STATUTE_SUBDIV_STRINGS: { @@ -9590,7 +9590,7 @@ CSL.Transform = function (state) { secondary_tok.strings.prefix = " "; } for (var i = secondary_tok.decorations.length - 1; i > -1; i += -1) { - if (secondary_tok.decorations[i][0] === '@quotes') { + if (['@quotes/true','@font-style/italic','@font-style/oblique','@font-weight/bold'].indexOf(secondary_tok.decorations[i].join('/')) > -1) { secondary_tok.decorations = secondary_tok.decorations.slice(0, i).concat(secondary_tok.decorations.slice(i + 1)) } } @@ -9604,7 +9604,7 @@ CSL.Transform = function (state) { tertiary_tok.strings.prefix = " "; } for (var i = tertiary_tok.decorations.length - 1; i > -1; i += -1) { - if (tertiary_tok.decorations[i][0] === '@quotes') { + if (['@quotes/true','@font-style/italic','@font-style/oblique','@font-weight/bold'].indexOf(tertiary_tok.decorations[i].join('/')) > -1) { tertiary_tok.decorations = tertiary_tok.decorations.slice(0, i).concat(tertiary_tok.decorations.slice(i + 1)) } } @@ -10531,66 +10531,83 @@ CSL.Util.Dates.year.numeric = function (state, num) { } return (pre + num); }; -CSL.Util.Dates.month = {}; -CSL.Util.Dates.month.numeric = function (state, num) { - if (num) { - num = parseInt(num, 10); - if (num > 12) { - num = ""; - } - } - var ret = "" + num; - return ret; -}; -CSL.Util.Dates.month["numeric-leading-zeros"] = function (state, num) { +CSL.Util.Dates.normalizeMonth = function (num, useSeason) { + var ret; if (!num) { num = 0; } - num = parseInt(num, 10); - if (num > 12) { + num = "" + num; + if (!num.match(/^[0-9]+$/)) { num = 0; } - num = "" + num; - while (num.length < 2) { - num = "0" + num; + num = parseInt(num, 10); + if (useSeason) { + var res = {stub: "month-", num: num}; + if (res.num < 1 || res.num > 20) { + res.num = 0; + } else if (res.num > 16) { + res.stub = "season-"; + res.num = res.num - 16; + } else if (res.num > 12) { + res.stub = "season-"; + res.num = res.num - 12; + } + ret = res; + } else { + if (num < 1 || num > 12) { + num = 0; + } + ret = num; } - return num.toString(); + return ret; +} +CSL.Util.Dates.month = {}; +CSL.Util.Dates.month.numeric = function (state, num) { + var num = CSL.Util.Dates.normalizeMonth(num); + if (!num) { + num = ""; + } + return num; +}; +CSL.Util.Dates.month["numeric-leading-zeros"] = function (state, num) { + var num = CSL.Util.Dates.normalizeMonth(num); + if (!num) { + num = ""; + } else { + num = "" + num; + while (num.length < 2) { + num = "0" + num; + } + } + return num; }; CSL.Util.Dates.month["long"] = function (state, num) { - var stub = "month-"; - num = parseInt(num, 10); - if (num > 12) { - stub = "season-"; - if (num > 16) { - num = num - 16; - } else { - num = num - 12; + var res = CSL.Util.Dates.normalizeMonth(num, true); + var num = res.num; + if (!num) { + num = ""; + } else { + num = "" + num; + while (num.length < 2) { + num = "0" + num; } + num = state.getTerm(res.stub + num, "long", 0); } - num = "" + num; - while (num.length < 2) { - num = "0" + num; - } - num = stub + num; - return state.getTerm(num, "long", 0); + return num; }; CSL.Util.Dates.month["short"] = function (state, num) { - var stub = "month-"; - num = parseInt(num, 10); - if (num > 12) { - stub = "season-"; - if (num > 16) { - num = num - 16; - } else { - num = num - 12; + var res = CSL.Util.Dates.normalizeMonth(num, true); + var num = res.num; + if (!num) { + num = ""; + } else { + num = "" + num; + while (num.length < 2) { + num = "0" + num; } + num = state.getTerm(res.stub + num, "short", 0); } - num = "" + num; - while (num.length < 2) { - num = "0" + num; - } - num = "month-" + num; - return state.getTerm(num, "short", 0); + return num; }; CSL.Util.Dates.day = {}; CSL.Util.Dates.day.numeric = function (state, num) { From e6cb523e3cdb173d9c58a987729ce692748e0f9f Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 3 Jul 2012 00:17:19 -0400 Subject: [PATCH 05/10] Update repotime and submodules --- chrome/content/zotero/locale/csl | 2 +- repotime.txt | 2 +- translators | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/locale/csl b/chrome/content/zotero/locale/csl index 0e599ae2a6..1e4594c2bf 160000 --- a/chrome/content/zotero/locale/csl +++ b/chrome/content/zotero/locale/csl @@ -1 +1 @@ -Subproject commit 0e599ae2a6625607673901749ff45b9d6f5f2157 +Subproject commit 1e4594c2bf0af2b716d7279b8619de961ad832e1 diff --git a/repotime.txt b/repotime.txt index 97e742b84a..254d26565b 100644 --- a/repotime.txt +++ b/repotime.txt @@ -1 +1 @@ -2012-05-04 03:15:00 +2012-07-02 23:20:00 diff --git a/translators b/translators index 8ac8cc1e52..153776b6d3 160000 --- a/translators +++ b/translators @@ -1 +1 @@ -Subproject commit 8ac8cc1e52c3cb80bf74626da135942ccd1b4c49 +Subproject commit 153776b6d3644f0bfaa0b52b72eae9da4080d1e6 From ca6184ac7443a9b65a70ed3f0a6229795bad7188 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 3 Jul 2012 00:19:04 -0400 Subject: [PATCH 06/10] Update versions --- chrome/content/zotero/xpcom/zotero.js | 2 +- install.rdf | 2 +- update.rdf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 0f9635045a..5fab54bf38 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -35,7 +35,7 @@ const ZOTERO_CONFIG = { API_URL: 'https://api.zotero.org/', PREF_BRANCH: 'extensions.zotero.', BOOKMARKLET_URL: 'https://www.zotero.org/bookmarklet/', - VERSION: "3.0.6.SOURCE" + VERSION: "3.0.8.SOURCE" }; /* diff --git a/install.rdf b/install.rdf index db941fc4c0..bfb30488fb 100644 --- a/install.rdf +++ b/install.rdf @@ -6,7 +6,7 @@ zotero@chnm.gmu.edu Zotero - 3.0.7.SOURCE + 3.0.8.SOURCE Center for History and New Media
George Mason University
Dan Cohen Sean Takats diff --git a/update.rdf b/update.rdf index 2572c96353..dc394f8da2 100644 --- a/update.rdf +++ b/update.rdf @@ -7,7 +7,7 @@ - 3.0.7.SOURCE + 3.0.8.SOURCE {ec8030f7-c20a-464f-9b0e-13a3a9e97384} From d9bdc42aec8029b8c895bb9d9ed55e296c474d4c Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 3 Jul 2012 00:28:23 -0400 Subject: [PATCH 07/10] Update repotime --- repotime.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repotime.txt b/repotime.txt index 254d26565b..1fc46855f9 100644 --- a/repotime.txt +++ b/repotime.txt @@ -1 +1 @@ -2012-07-02 23:20:00 +2012-07-02 23:25:00 From 4226f8e1dda72a43ccb57971ceba3548cf4be6d4 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 3 Jul 2012 23:09:24 -0400 Subject: [PATCH 08/10] Update repotime and submodules --- repotime.txt | 2 +- translators | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/repotime.txt b/repotime.txt index 1fc46855f9..4ab8cebdc2 100644 --- a/repotime.txt +++ b/repotime.txt @@ -1 +1 @@ -2012-07-02 23:25:00 +2012-07-03 17:00:00 diff --git a/translators b/translators index 153776b6d3..cda5ac5ef0 160000 --- a/translators +++ b/translators @@ -1 +1 @@ -Subproject commit 153776b6d3644f0bfaa0b52b72eae9da4080d1e6 +Subproject commit cda5ac5ef0f6c59d359e49d61fb8846c859ef6c0 From 6586d309444fd7661d9e7693884a87cbeeb31344 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 3 Jul 2012 23:13:06 -0400 Subject: [PATCH 09/10] Fix repotime, once more --- repotime.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repotime.txt b/repotime.txt index 4ab8cebdc2..388815aa0a 100644 --- a/repotime.txt +++ b/repotime.txt @@ -1 +1 @@ -2012-07-03 17:00:00 +2012-07-03 23:35:00 From d02fe6d9ab87f6bb888c8f00ac433da414643222 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Wed, 4 Jul 2012 18:22:45 -0400 Subject: [PATCH 10/10] Include speed of Fx5DOMWrapper --- .../xpcom/translation/translate_firefox.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/xpcom/translation/translate_firefox.js b/chrome/content/zotero/xpcom/translation/translate_firefox.js index 442789d2b9..d43e158ab0 100644 --- a/chrome/content/zotero/xpcom/translation/translate_firefox.js +++ b/chrome/content/zotero/xpcom/translation/translate_firefox.js @@ -96,19 +96,19 @@ Zotero.Translate.SandboxManager.Fx5DOMWrapper = function(obj, parent) { return null; } - var type = typeof obj; - if(type === "function") { + if(typeof obj === "function") { var me = this; var val = function() { var nArgs = arguments.length; var args = new Array(nArgs); for(var i=0; i