diff --git a/chrome/content/zotero/xpcom/translation/translate_firefox.js b/chrome/content/zotero/xpcom/translation/translate_firefox.js index b68c1d882b..c9cc2acfef 100644 --- a/chrome/content/zotero/xpcom/translation/translate_firefox.js +++ b/chrome/content/zotero/xpcom/translation/translate_firefox.js @@ -45,22 +45,17 @@ Zotero.Translate.SandboxManager = function(sandboxLocation) { // import functions missing from global scope into Fx sandbox this.sandbox.XPathResult = Components.interfaces.nsIDOMXPathResult; this.sandbox.DOMParser = function() { + var uri, principal; // get URI - // DEBUG: In Fx 4 we can just use document.nodePrincipal, but in Fx 3.6 this doesn't work if(typeof sandboxLocation === "string") { // if sandbox specified by URI - var uri = sandboxLocation; + var secMan = Services.scriptSecurityManager; + uri = Services.io.newURI(sandboxLocation, "UTF-8", null); + principal = (secMan.getCodebasePrincipal || secMan.getSimpleCodebasePrincipal)(uri); } else { // if sandbox specified by DOM document - var uri = sandboxLocation.location.toString(); + principal = sandboxLocation.document.nodePrincipal; + uri = sandboxLocation.document.documentURIObject; } - // get principal from URI - var secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"] - .getService(Components.interfaces.nsIScriptSecurityManager); - var ioService = Components.classes["@mozilla.org/network/io-service;1"] - .getService(Components.interfaces.nsIIOService); - uri = ioService.newURI(uri, "UTF-8", null); - var principal = secMan.getCodebasePrincipal(uri); - // initialize DOM parser var _DOMParser = Components.classes["@mozilla.org/xmlextras/domparser;1"] .createInstance(Components.interfaces.nsIDOMParser); @@ -68,12 +63,8 @@ Zotero.Translate.SandboxManager = function(sandboxLocation) { // expose parseFromString this.__exposedProps__ = {"parseFromString":"r"}; - if(Zotero.isFx5) { - this.parseFromString = function(str, contentType) { - return Zotero.Translate.SandboxManager.Fx5DOMWrapper(_DOMParser.parseFromString(str, contentType)); - } - } else { - this.parseFromString = function(str, contentType) _DOMParser.parseFromString(str, contentType); + this.parseFromString = function(str, contentType) { + return Zotero.Translate.SandboxManager.Fx5DOMWrapper(_DOMParser.parseFromString(str, contentType)); } }; this.sandbox.DOMParser.__exposedProps__ = {"prototype":"r"}; diff --git a/install.rdf b/install.rdf index bfb30488fb..71bdaf0a72 100644 --- a/install.rdf +++ b/install.rdf @@ -25,8 +25,8 @@ {ec8030f7-c20a-464f-9b0e-13a3a9e97384} - 3.6 - 15.0a1 + 5.0 + 19.0a1 diff --git a/update.rdf b/update.rdf index dc394f8da2..b7f16c2497 100644 --- a/update.rdf +++ b/update.rdf @@ -11,8 +11,8 @@ {ec8030f7-c20a-464f-9b0e-13a3a9e97384} - 3.6 - 15.0a1 + 5.0 + 19.0a1 http://download.zotero.org/extension/zotero.xpi sha1: