Bug 1435666 - Part 3: Remove nsIDOMXPathResult. r=bz

MozReview-Commit-ID: 9j6dUlanNTi

--HG--
extra : rebase_source : 9a790516379441d4e048009bcacdd26e93fde6ae
This commit is contained in:
Cameron McCormack 2018-02-05 11:39:18 +08:00
Родитель 70af884bbd
Коммит 234b89c117
13 изменённых файлов: 19 добавлений и 54 удалений

Просмотреть файл

@ -41,7 +41,7 @@ function test() {
function getElementByXPath(aTab, aQuery) {
let doc = aTab.linkedBrowser.contentDocument;
let xptype = Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE;
let xptype = doc.defaultView.XPathResult.FIRST_ORDERED_NODE_TYPE;
return doc.evaluate(aQuery, doc, null, xptype, null).singleNodeValue;
}

Просмотреть файл

@ -29,7 +29,7 @@ function queryElement(data) {
}
if (data.hasOwnProperty("xpath")) {
let xptype = Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE;
let xptype = doc.defaultView.XPathResult.FIRST_ORDERED_NODE_TYPE;
return doc.evaluate(data.xpath, doc, null, xptype, null).singleNodeValue;
}

Просмотреть файл

@ -1430,7 +1430,7 @@ module.exports = {
"numberValue": {
"!type": "number",
"!url": "https://developer.mozilla.org/en/docs/XPathResult",
"!doc": "Refer to nsIDOMXPathResult for more detail."
"!doc": "Refer to XPathResult for more detail."
},
"resultType": {
"!type": "number",
@ -1445,7 +1445,7 @@ module.exports = {
"snapshotLength": {
"!type": "number",
"!url": "https://developer.mozilla.org/en/docs/XPathResult",
"!doc": "Refer to nsIDOMXPathResult for more detail."
"!doc": "Refer to XPathResult for more detail."
},
"stringValue": {
"!type": "string",
@ -1473,7 +1473,7 @@ module.exports = {
"FIRST_ORDERED_NODE_TYPE": "number"
},
"!url": "https://developer.mozilla.org/en/docs/XPathResult",
"!doc": "Refer to nsIDOMXPathResult for more detail."
"!doc": "Refer to XPathResult for more detail."
},
"ClientRect": {
"!type": "fn()",

Просмотреть файл

@ -983,12 +983,9 @@ WebConsoleFrame.prototype = {
let attribute = !WORKERTYPES_PREFKEYS.includes(prefKey)
? "filter" : "workerType";
let xpath = ".//*[contains(@class, 'message') and " +
"@" + attribute + "='" + prefKey + "']";
let result = doc.evaluate(xpath, outputNode, null,
Ci.nsIDOMXPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (let i = 0; i < result.snapshotLength; i++) {
let node = result.snapshotItem(i);
let selector = "[" + attribute + "='" + prefKey + "'].message";
let result = outputNode.querySelectorAll(selector);
for (let node of result) {
if (state) {
node.classList.remove("filtered-by-type");
} else {

Просмотреть файл

@ -372,7 +372,7 @@ WebConsoleCommands._registerOriginal("$x", function (owner, xPath, context) {
context = context || doc;
let results = doc.evaluate(xPath, context, null,
Ci.nsIDOMXPathResult.ANY_TYPE, null);
owner.window.XPathResult.ANY_TYPE, null);
let node;
while ((node = results.iterateNext())) {
nodes.push(node);

Просмотреть файл

@ -4,7 +4,7 @@
const C_i = Components.interfaces;
const UNORDERED_TYPE = C_i.nsIDOMXPathResult.ANY_UNORDERED_NODE_TYPE;
const UNORDERED_TYPE = 8; // XPathResult.ANY_UNORDERED_NODE_TYPE
/**
* Determine if the data node has only ignorable white-space.

Просмотреть файл

@ -9,7 +9,6 @@ with Files("**"):
XPIDL_SOURCES += [
'nsIDOMXPathEvaluator.idl',
'nsIDOMXPathResult.idl',
]
XPIDL_MODULE = 'dom_xpath'

Просмотреть файл

@ -1,26 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Corresponds to http://www.w3.org/TR/2002/WD-DOM-Level-3-XPath-20020208
*/
#include "nsISupports.idl"
[uuid(75506f84-b504-11d5-a7f2-ca108ab8b6fc)]
interface nsIDOMXPathResult : nsISupports
{
// XPathResultType
const unsigned short ANY_TYPE = 0;
const unsigned short NUMBER_TYPE = 1;
const unsigned short STRING_TYPE = 2;
const unsigned short BOOLEAN_TYPE = 3;
const unsigned short UNORDERED_NODE_ITERATOR_TYPE = 4;
const unsigned short ORDERED_NODE_ITERATOR_TYPE = 5;
const unsigned short UNORDERED_NODE_SNAPSHOT_TYPE = 6;
const unsigned short ORDERED_NODE_SNAPSHOT_TYPE = 7;
const unsigned short ANY_UNORDERED_NODE_TYPE = 8;
const unsigned short FIRST_ORDERED_NODE_TYPE = 9;
};

Просмотреть файл

@ -46,7 +46,7 @@ function queryElement(contentWindow, data) {
}
if (data.hasOwnProperty("xpath")) {
let xptype = Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE;
let xptype = XPathResult.FIRST_ORDERED_NODE_TYPE;
return doc.evaluate(data.xpath, doc, null, xptype, null).singleNodeValue;
}

Просмотреть файл

@ -53,10 +53,9 @@ this.EXPORTED_SYMBOLS = [
"WebElement",
];
const {
FIRST_ORDERED_NODE_TYPE,
ORDERED_NODE_ITERATOR_TYPE,
} = Ci.nsIDOMXPathResult;
const ORDERED_NODE_ITERATOR_TYPE = 5;
const FIRST_ORDERED_NODE_TYPE = 9;
const ELEMENT_NODE = 1;
const DOCUMENT_NODE = 9;

Просмотреть файл

@ -25,10 +25,9 @@ this.EXPORTED_SYMBOLS = [
"WebElement",
];
const {
FIRST_ORDERED_NODE_TYPE,
ORDERED_NODE_ITERATOR_TYPE,
} = Ci.nsIDOMXPathResult;
const ORDERED_NODE_ITERATOR_TYPE = 5;
const FIRST_ORDERED_NODE_TYPE = 9;
const ELEMENT_NODE = 1;
const DOCUMENT_NODE = 9;

Просмотреть файл

@ -120,7 +120,7 @@ var FormDataInternal = {
* Resolves an XPath query generated by node.generateXPath.
*/
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.bind(this), xptype, null).singleNodeValue;
},
@ -173,7 +173,7 @@ var FormDataInternal = {
this.restorableFormNodesXPath,
doc,
this.resolveNS.bind(this),
Ci.nsIDOMXPathResult.UNORDERED_NODE_ITERATOR_TYPE, null
doc.defaultView.XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null
);
let node;

Просмотреть файл

@ -66,7 +66,6 @@
#include "nsIDOMWheelEvent.h"
#include "nsIDOMXMLDocument.h"
#include "nsIDOMXPathEvaluator.h"
#include "nsIDOMXPathResult.h"
#include "nsIDOMXULCommandEvent.h"
#include "nsIDOMXULElement.h"
#include "nsIFrameLoader.h"
@ -163,7 +162,6 @@
#include "mozilla/dom/XMLHttpRequestUploadBinding.h"
#include "mozilla/dom/XMLSerializerBinding.h"
#include "mozilla/dom/XPathEvaluatorBinding.h"
#include "mozilla/dom/XPathResultBinding.h"
#include "mozilla/dom/XULCommandEventBinding.h"
#include "mozilla/dom/XULDocumentBinding.h"
#include "mozilla/dom/XULElementBinding.h"
@ -290,7 +288,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIXMLHttpRequestEventTarget, XMLHttpRequestEventTarget),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIXMLHttpRequestUpload, XMLHttpRequestUpload),
DEFINE_SHIM(XPathEvaluator),
DEFINE_SHIM(XPathResult),
DEFINE_SHIM(XULCommandEvent),
DEFINE_SHIM(XULElement),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsISelection, Selection),