Fx60: Shim XPathResult in translator sandbox
As of Fx60, XPathResult is no longer available as nsIDOMXPathResult in XPCOM, so just shim its constants, which are all we need, when adding it to the sandbox.
This commit is contained in:
parent
433794916a
commit
5994e22359
2 changed files with 15 additions and 4 deletions
|
@ -369,7 +369,20 @@ Zotero.Translate.DOMWrapper = new function() {
|
|||
Zotero.Translate.SandboxManager = function(sandboxLocation) {
|
||||
this.sandbox = {
|
||||
Zotero: {},
|
||||
XPathResult: Components.interfaces.nsIDOMXPathResult,
|
||||
// As of Fx60, XPathResult is no longer available as nsIDOMXPathResult in XPCOM, so just
|
||||
// shim its constants, which are all we need
|
||||
XPathResult: {
|
||||
ANY_TYPE: 0,
|
||||
NUMBER_TYPE: 1,
|
||||
STRING_TYPE: 2,
|
||||
BOOLEAN_TYPE: 3,
|
||||
UNORDERED_NODE_ITERATOR_TYPE: 4,
|
||||
ORDERED_NODE_ITERATOR_TYPE: 5,
|
||||
UNORDERED_NODE_SNAPSHOT_TYPE: 6,
|
||||
ORDERED_NODE_SNAPSHOT_TYPE: 7,
|
||||
ANY_UNORDERED_NODE_TYPE: 8,
|
||||
FIRST_ORDERED_NODE_TYPE: 9
|
||||
},
|
||||
DOMParser: function() {
|
||||
return Components.classes["@mozilla.org/xmlextras/domparser;1"]
|
||||
.createInstance(Components.interfaces.nsIDOMParser);
|
||||
|
|
|
@ -91,9 +91,7 @@ Zotero.Utilities.Translate.prototype.getVersion = function() {
|
|||
Zotero.Utilities.Translate.prototype.gatherElementsOnXPath = function(doc, parentNode, xpath, nsResolver) {
|
||||
var elmts = [];
|
||||
|
||||
var iterator = doc.evaluate(xpath, parentNode, nsResolver,
|
||||
(Zotero.isFx ? Components.interfaces.nsIDOMXPathResult.ANY_TYPE : XPathResult.ANY_TYPE),
|
||||
null);
|
||||
var iterator = doc.evaluate(xpath, parentNode, nsResolver, XPathResult.ANY_TYPE, null);
|
||||
var elmt = iterator.iterateNext();
|
||||
var i = 0;
|
||||
while (elmt) {
|
||||
|
|
Loading…
Reference in a new issue