Fix DOMParser for Fx 17, and set minVersion to Fx 15
This commit is contained in:
parent
78dd74f391
commit
7d2c4e6b2d
3 changed files with 12 additions and 21 deletions
|
@ -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"};
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue