www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 7d2c4e6b2d4951acd292bb25d8275057346ede7f
parent 78dd74f391b44d236fe3313a6f08da8c04351099
Author: Simon Kornblith <simon@simonster.com>
Date:   Mon, 29 Oct 2012 18:01:23 -0400

Fix DOMParser for Fx 17, and set minVersion to Fx 15

Diffstat:
Mchrome/content/zotero/xpcom/translation/translate_firefox.js | 25++++++++-----------------
Minstall.rdf | 4++--
Mupdate.rdf | 4++--
3 files changed, 12 insertions(+), 21 deletions(-)

diff --git 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 @@ -25,8 +25,8 @@ <em:targetApplication> <Description> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> - <em:minVersion>3.6</em:minVersion> - <em:maxVersion>15.0a1</em:maxVersion> + <em:minVersion>5.0</em:minVersion> + <em:maxVersion>19.0a1</em:maxVersion> </Description> </em:targetApplication> diff --git a/update.rdf b/update.rdf @@ -11,8 +11,8 @@ <targetApplication> <RDF:Description> <id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</id> - <minVersion>3.6</minVersion> - <maxVersion>15.0a1</maxVersion> + <minVersion>5.0</minVersion> + <maxVersion>19.0a1</maxVersion> <updateLink>http://download.zotero.org/extension/zotero.xpi</updateLink> <updateHash>sha1:</updateHash> </RDF:Description>