Bug 1435728 - Replace nsIDOMXPathResult with XPathResult. r=frg
authorBill Gianopoulos <wgianopoulos@gmail.com>
Fri, 09 Feb 2018 09:22:14 -0500
changeset 31083 94bd1ee91bc089d3e8efe6f924d41588d7b6368a
parent 31082 42bf9c98f0865fed58eaab2f753b88a627c3c9b7
child 31084 6e3049a56aa61816f5250d088cf85b686880754a
push id383
push userclokep@gmail.com
push dateMon, 07 May 2018 21:52:48 +0000
reviewersfrg
bugs1435728, 1435666
Bug 1435728 - Replace nsIDOMXPathResult with XPathResult. r=frg Port bug 1435666 [remove some SVG- and XPath-related XPCOM interfaces] to SeaMonkey.
suite/common/src/nsSessionStore.js
suite/common/tests/browser/browser_346337.js
--- a/suite/common/src/nsSessionStore.js
+++ b/suite/common/src/nsSessionStore.js
@@ -1883,17 +1883,17 @@ SessionStoreService.prototype = {
   /**
    * collect the state of all form elements
    * @param aDocument
    *        document reference
    */
   _collectFormDataForFrame: function sss_collectFormDataForFrame(aDocument) {
     let formNodes = aDocument.evaluate(XPathHelper.restorableFormNodes, aDocument,
                                        XPathHelper.resolveNS,
-                                       Components.interfaces.nsIDOMXPathResult.UNORDERED_NODE_ITERATOR_TYPE, null);
+                                       aDocument.defaultView.XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null);
     let node = formNodes.iterateNext();
     if (!node)
       return null;
 
     const MAX_GENERATED_XPATHS = 100;
     let generatedCount = 0;
 
     let data = {};
@@ -4023,17 +4023,17 @@ var XPathHelper = {
            (nName ? "[@name=" + this.quoteArgument(nName) + "]" : "") +
            (count ? "[" + (count + 1) + "]" : "");
   },
 
   /**
    * Resolves an XPath query generated by XPathHelper.generate
    */
   resolve: function sss_xph_resolve(aDocument, aQuery) {
-    let xptype = Components.interfaces.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE;
+    let xptype = aDocument.defaultView.XPathResult.FIRST_ORDERED_NODE_TYPE;
     return aDocument.evaluate(aQuery, aDocument, this.resolveNS, xptype, null).singleNodeValue;
   },
 
   /**
    * Namespace resolver for the above XPath resolver
    */
   resolveNS: function sss_xph_resolveNS(aPrefix) {
     return XPathHelper.namespaceURIs[aPrefix] || null;
--- a/suite/common/tests/browser/browser_346337.js
+++ b/suite/common/tests/browser/browser_346337.js
@@ -31,17 +31,17 @@ function test() {
     "//textarea[2]":              "Some text... " + Math.random(),
     "//textarea[3]":              "Some more text\n" + new Date(),
     "//input[@type='file'][1]":   [filePath1],
     "//input[@type='file'][2]":   [filePath1, filePath2]
   };
 
   function getElementByXPath(aTab, aQuery) {
     let doc = aTab.linkedBrowser.contentDocument;
-    let xptype = Components.interfaces.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE;
+    let xptype = doc.defaultView.XPathResult.FIRST_ORDERED_NODE_TYPE;
     return doc.evaluate(aQuery, doc, null, xptype, null).singleNodeValue;
   }
 
   function setFormValue(aTab, aQuery, aValue) {
     let node = getElementByXPath(aTab, aQuery);
     if (typeof aValue == "string")
       node.value = aValue;
     else if (typeof aValue == "boolean")