diff --git a/chrome/content/zotero/xpcom/openurl.js b/chrome/content/zotero/xpcom/openurl.js index d28156275..b0545b612 100644 --- a/chrome/content/zotero/xpcom/openurl.js +++ b/chrome/content/zotero/xpcom/openurl.js @@ -243,6 +243,13 @@ Zotero.OpenURL = new function() { if(asObj) return entries; return entries.join("&"); } + + function _cloneIfNecessary(obj1, obj2) { + if(Zotero.isFx && !Zotero.isBookmarklet && Zotero.platformMajorVersion >= 32) { + return Components.utils.cloneInto(obj1, obj2); + } + return obj1; + } /* * Generates an item in the format returned by item.fromArray() given an @@ -380,14 +387,14 @@ Zotero.OpenURL = new function() { if(complexAu.length && !lastCreator.lastName && !lastCreator.institutional) { lastCreator.lastName = value; } else { - complexAu.push({lastName:value, creatorType:(key == "rft.aulast" ? "author" : "inventor"), offset:item.creators.length}); + complexAu.push(_cloneIfNecessary({lastName:value, creatorType:(key == "rft.aulast" ? "author" : "inventor"), offset:item.creators.length}, item)); } } else if(key == "rft.aufirst" || key == "rft.invfirst") { var lastCreator = complexAu[complexAu.length-1]; if(complexAu.length && !lastCreator.firstName && !lastCreator.institutional) { lastCreator.firstName = value; } else { - complexAu.push({firstName:value, creatorType:(key == "rft.aufirst" ? "author" : "inventor"), offset:item.creators.length}); + complexAu.push(_cloneIfNecessary({firstName:value, creatorType:(key == "rft.aufirst" ? "author" : "inventor"), offset:item.creators.length}, item)); } } else if(key == "rft.au" || key == "rft.creator" || key == "rft.contributor" || key == "rft.inventor") { if(key == "rft.contributor") { @@ -398,13 +405,9 @@ Zotero.OpenURL = new function() { var type = "author"; } - if(value.indexOf(",") !== -1) { - item.creators.push(Zotero.Utilities.cleanAuthor(value, type, true)); - } else { - item.creators.push(Zotero.Utilities.cleanAuthor(value, type, false)); - } + item.creators.push(_cloneIfNecessary(Zotero.Utilities.cleanAuthor(value, type, value.indexOf(",") !== -1), item)); } else if(key == "rft.aucorp") { - complexAu.push({lastName:value, isInstitution:true}); + complexAu.push(_cloneIfNecessary({lastName:value, isInstitution:true}, item)); } else if(key == "rft.isbn" && !item.ISBN) { item.ISBN = value; } else if(key == "rft.pub" || key == "rft.publisher") { diff --git a/chrome/content/zotero/xpcom/translation/translate_firefox.js b/chrome/content/zotero/xpcom/translation/translate_firefox.js index 46204c6d4..bff1f2d00 100644 --- a/chrome/content/zotero/xpcom/translation/translate_firefox.js +++ b/chrome/content/zotero/xpcom/translation/translate_firefox.js @@ -462,16 +462,6 @@ Zotero.Translate.SandboxManager.prototype = { if(isFunction) { attachTo[localKey] = function() { var args = Array.prototype.slice.apply(arguments); - if(Zotero.platformMajorVersion >= 32) { - // This is necessary on Nightly and works - // fine on 31, but apparently breaks - // ZU.xpath in an unusual way on 24 - for(var i=0; i