Don't unwrap objects passed to chrome
Unwrapping objects also waives the Xray wrappers for contained objects, which we need.
This commit is contained in:
parent
5857368131
commit
a09ff9c9ec
3 changed files with 14 additions and 18 deletions
|
@ -243,6 +243,13 @@ Zotero.OpenURL = new function() {
|
||||||
if(asObj) return entries;
|
if(asObj) return entries;
|
||||||
return entries.join("&");
|
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
|
* 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) {
|
if(complexAu.length && !lastCreator.lastName && !lastCreator.institutional) {
|
||||||
lastCreator.lastName = value;
|
lastCreator.lastName = value;
|
||||||
} else {
|
} 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") {
|
} else if(key == "rft.aufirst" || key == "rft.invfirst") {
|
||||||
var lastCreator = complexAu[complexAu.length-1];
|
var lastCreator = complexAu[complexAu.length-1];
|
||||||
if(complexAu.length && !lastCreator.firstName && !lastCreator.institutional) {
|
if(complexAu.length && !lastCreator.firstName && !lastCreator.institutional) {
|
||||||
lastCreator.firstName = value;
|
lastCreator.firstName = value;
|
||||||
} else {
|
} 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") {
|
} else if(key == "rft.au" || key == "rft.creator" || key == "rft.contributor" || key == "rft.inventor") {
|
||||||
if(key == "rft.contributor") {
|
if(key == "rft.contributor") {
|
||||||
|
@ -398,13 +405,9 @@ Zotero.OpenURL = new function() {
|
||||||
var type = "author";
|
var type = "author";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(value.indexOf(",") !== -1) {
|
item.creators.push(_cloneIfNecessary(Zotero.Utilities.cleanAuthor(value, type, value.indexOf(",") !== -1), item));
|
||||||
item.creators.push(Zotero.Utilities.cleanAuthor(value, type, true));
|
|
||||||
} else {
|
|
||||||
item.creators.push(Zotero.Utilities.cleanAuthor(value, type, false));
|
|
||||||
}
|
|
||||||
} else if(key == "rft.aucorp") {
|
} 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) {
|
} else if(key == "rft.isbn" && !item.ISBN) {
|
||||||
item.ISBN = value;
|
item.ISBN = value;
|
||||||
} else if(key == "rft.pub" || key == "rft.publisher") {
|
} else if(key == "rft.pub" || key == "rft.publisher") {
|
||||||
|
|
|
@ -462,16 +462,6 @@ Zotero.Translate.SandboxManager.prototype = {
|
||||||
if(isFunction) {
|
if(isFunction) {
|
||||||
attachTo[localKey] = function() {
|
attachTo[localKey] = function() {
|
||||||
var args = Array.prototype.slice.apply(arguments);
|
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<args.length; i++) {
|
|
||||||
if(typeof args[i] === "object" && args[i] !== null && args[i].wrappedJSObject) {
|
|
||||||
args[i] = args[i].wrappedJSObject;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(passAsFirstArgument) args.unshift(passAsFirstArgument);
|
if(passAsFirstArgument) args.unshift(passAsFirstArgument);
|
||||||
return me._copyObject(object[localKey].apply(object, args));
|
return me._copyObject(object[localKey].apply(object, args));
|
||||||
};
|
};
|
||||||
|
|
|
@ -910,6 +910,9 @@ Zotero.Utilities = {
|
||||||
* @param {Function} onDone Function to call when done
|
* @param {Function} onDone Function to call when done
|
||||||
*/
|
*/
|
||||||
"processAsync":function (sets, callbacks, onDone) {
|
"processAsync":function (sets, callbacks, onDone) {
|
||||||
|
if(sets.wrappedJSObject) sets = sets.wrappedJSObject;
|
||||||
|
if(callbacks.wrappedJSObject) callbacks = callbacks.wrappedJSObject;
|
||||||
|
|
||||||
var currentSet;
|
var currentSet;
|
||||||
var index = 0;
|
var index = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue