diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 877d92eb8..e32783434 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -1337,7 +1337,8 @@ Zotero.Translate.Base.prototype = { // https://bugzilla.mozilla.org/show_bug.cgi?id=609143 - can't pass E4X to sandbox in Fx4 src += "Zotero.getXML = function() {"+ "var xml = Zotero._getXML();"+ - "if(typeof xml == 'string') return new XML(xml);"+ + "if(typeof xml == 'string') { return new XML(xml);}"+ + "return xml;"+ "};"; } } @@ -2229,11 +2230,12 @@ Zotero.Translate.IO.String.prototype = { "_getXML":function() { if(this._mode == "xml/dom") { try { - return Zotero.Translate.IO.parseDOMXML(this.string); + var xml = Zotero.Translate.IO.parseDOMXML(this.string); } catch(e) { this._xmlInvalid = true; throw e; } + return (Zotero.isFx5 ? Zotero.Translate.SandboxManager.Fx5DOMWrapper(xml) : xml); } else { return this.string.replace(/<\?xml[^>]+\?>/, ""); } diff --git a/chrome/content/zotero/xpcom/translation/translate_firefox.js b/chrome/content/zotero/xpcom/translation/translate_firefox.js index 1c8b4a779..f0e709c88 100644 --- a/chrome/content/zotero/xpcom/translation/translate_firefox.js +++ b/chrome/content/zotero/xpcom/translation/translate_firefox.js @@ -732,7 +732,13 @@ Zotero.Translate.IO.Read.prototype = { "_getXML":function() { if(this._mode == "xml/dom") { - return Zotero.Translate.IO.parseDOMXML(this._rawStream, this._charset, this.file.fileSize); + try { + var xml = Zotero.Translate.IO.parseDOMXML(this._rawStream, this._charset, this.file.fileSize); + } catch(e) { + this._xmlInvalid = true; + throw e; + } + return (Zotero.isFx5 ? Zotero.Translate.SandboxManager.Fx5DOMWrapper(xml) : xml); } else { return this._readToString().replace(/<\?xml[^>]+\?>/, ""); } diff --git a/chrome/content/zotero/xpcom/utilities_translate.js b/chrome/content/zotero/xpcom/utilities_translate.js index 4fd1c2099..90253a836 100644 --- a/chrome/content/zotero/xpcom/utilities_translate.js +++ b/chrome/content/zotero/xpcom/utilities_translate.js @@ -158,7 +158,7 @@ Zotero.Utilities.Translate.prototype.getItemArray = function(doc, inHere, urlRe, var links = inHere[j].getElementsByTagName("a"); for(var i=0; i