mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1435666 - Part 4: Remove nsIDOMXPathEvaluator. r=bz
MozReview-Commit-ID: 2nZmbJ9mdwI --HG-- extra : rebase_source : 3acc54ac7726de2ff00a9b7ddadfcb7e28f573eb
This commit is contained in:
parent
234b89c117
commit
73774a4b98
@ -223,7 +223,6 @@
|
||||
@RESPATH@/components/dom_workers.xpt
|
||||
@RESPATH@/components/dom_xbl.xpt
|
||||
@RESPATH@/components/dom_xhr.xpt
|
||||
@RESPATH@/components/dom_xpath.xpt
|
||||
@RESPATH@/components/dom_xul.xpt
|
||||
@RESPATH@/components/dom_presentation.xpt
|
||||
@RESPATH@/components/downloads.xpt
|
||||
|
@ -1811,7 +1811,6 @@ NS_INTERFACE_TABLE_HEAD(nsDocument)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIRadioGroupContainer)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIMutationObserver)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIApplicationCacheContainer)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMXPathEvaluator)
|
||||
NS_INTERFACE_TABLE_END
|
||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsDocument)
|
||||
NS_INTERFACE_MAP_END
|
||||
@ -1972,7 +1971,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStyleAttrStyleSheet)
|
||||
#endif
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mXPathEvaluator)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLayoutHistoryState)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOnloadBlocker)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFirstBaseNodeWithHref)
|
||||
@ -2065,7 +2063,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
|
||||
|
||||
tmp->UnlinkOriginalDocumentIfStatic();
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mXPathEvaluator)
|
||||
tmp->mCachedRootElement = nullptr; // Avoid a dangling pointer
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDisplayDocument)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFirstBaseNodeWithHref)
|
||||
@ -12161,15 +12158,6 @@ nsIDocument::Evaluate(JSContext* aCx, const nsAString& aExpression,
|
||||
aType, aResult, rv);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::Evaluate(const nsAString& aExpression, nsIDOMNode* aContextNode,
|
||||
nsIDOMNode* aResolver, uint16_t aType,
|
||||
nsISupports* aInResult, nsISupports** aResult)
|
||||
{
|
||||
return XPathEvaluator()->Evaluate(aExpression, aContextNode, aResolver, aType,
|
||||
aInResult, aResult);
|
||||
}
|
||||
|
||||
nsIDocument*
|
||||
nsIDocument::GetTopLevelContentDocument()
|
||||
{
|
||||
@ -12513,9 +12501,9 @@ XPathEvaluator*
|
||||
nsIDocument::XPathEvaluator()
|
||||
{
|
||||
if (!mXPathEvaluator) {
|
||||
mXPathEvaluator = new dom::XPathEvaluator(this);
|
||||
mXPathEvaluator.reset(new dom::XPathEvaluator(this));
|
||||
}
|
||||
return mXPathEvaluator;
|
||||
return mXPathEvaluator.get();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDocumentEncoder>
|
||||
|
@ -66,7 +66,6 @@
|
||||
#include "nsDataHashtable.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsIDOMXPathEvaluator.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "CustomElementRegistry.h"
|
||||
@ -328,8 +327,7 @@ class nsDocument : public nsIDocument,
|
||||
public nsIScriptObjectPrincipal,
|
||||
public nsIRadioGroupContainer,
|
||||
public nsIApplicationCacheContainer,
|
||||
public nsStubMutationObserver,
|
||||
public nsIDOMXPathEvaluator
|
||||
public nsStubMutationObserver
|
||||
{
|
||||
friend class nsIDocument;
|
||||
|
||||
@ -660,8 +658,6 @@ public:
|
||||
// nsIApplicationCacheContainer
|
||||
NS_DECL_NSIAPPLICATIONCACHECONTAINER
|
||||
|
||||
NS_DECL_NSIDOMXPATHEVALUATOR
|
||||
|
||||
virtual nsresult Init();
|
||||
|
||||
virtual already_AddRefed<Element> CreateElem(const nsAString& aName,
|
||||
|
@ -3711,7 +3711,7 @@ protected:
|
||||
|
||||
uint32_t mInSyncOperationCount;
|
||||
|
||||
RefPtr<mozilla::dom::XPathEvaluator> mXPathEvaluator;
|
||||
mozilla::UniquePtr<mozilla::dom::XPathEvaluator> mXPathEvaluator;
|
||||
|
||||
nsTArray<RefPtr<mozilla::dom::AnonymousContent>> mAnonymousContents;
|
||||
|
||||
|
@ -177,7 +177,6 @@ function getParsedDocument(aPath) {
|
||||
|
||||
function processParsedDocument(doc) {
|
||||
Assert.ok(doc.documentElement.localName != "parsererror");
|
||||
Assert.ok(doc instanceof C_i.nsIDOMXPathEvaluator);
|
||||
Assert.ok(doc instanceof C_i.nsIDOMDocument);
|
||||
|
||||
// Clean out whitespace.
|
||||
|
@ -1,15 +0,0 @@
|
||||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
with Files("**"):
|
||||
BUG_COMPONENT = ("Core", "XSLT")
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIDOMXPathEvaluator.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'dom_xpath'
|
||||
|
@ -1,24 +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 "domstubs.idl"
|
||||
|
||||
interface XPathException;
|
||||
|
||||
[uuid(92584002-d0e2-4b88-9af9-fa6ff59ee002)]
|
||||
interface nsIDOMXPathEvaluator : nsISupports
|
||||
{
|
||||
nsISupports evaluate(in DOMString expression,
|
||||
in nsIDOMNode contextNode,
|
||||
in nsIDOMNode resolver,
|
||||
in unsigned short type,
|
||||
in nsISupports result)
|
||||
raises(XPathException,
|
||||
DOMException);
|
||||
};
|
@ -22,7 +22,6 @@ interfaces = [
|
||||
'sidebar',
|
||||
'range',
|
||||
'xbl',
|
||||
'xpath',
|
||||
'xul',
|
||||
'security',
|
||||
'storage',
|
||||
|
@ -91,4 +91,3 @@ Window implements LegacyQueryInterface;
|
||||
XMLHttpRequest implements LegacyQueryInterface;
|
||||
XMLHttpRequestUpload implements LegacyQueryInterface;
|
||||
XMLSerializer implements LegacyQueryInterface;
|
||||
XPathEvaluator implements LegacyQueryInterface;
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
[Constructor]
|
||||
interface XPathEvaluator {
|
||||
// Based on nsIDOMXPathEvaluator
|
||||
[NewObject, Throws]
|
||||
XPathExpression createExpression(DOMString expression,
|
||||
optional XPathNSResolver? resolver = null);
|
||||
|
@ -66,8 +66,6 @@ private:
|
||||
bool mIsCaseSensitive;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(XPathEvaluator, nsIDOMXPathEvaluator)
|
||||
|
||||
XPathEvaluator::XPathEvaluator(nsIDocument* aDocument)
|
||||
: mDocument(do_GetWeakReference(aDocument))
|
||||
{
|
||||
@ -77,40 +75,6 @@ XPathEvaluator::~XPathEvaluator()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XPathEvaluator::Evaluate(const nsAString & aExpression,
|
||||
nsIDOMNode *aContextNode,
|
||||
nsIDOMNode *aResolver,
|
||||
uint16_t aType,
|
||||
nsISupports *aInResult,
|
||||
nsISupports **aResult)
|
||||
{
|
||||
nsCOMPtr<nsINode> resolver = do_QueryInterface(aResolver);
|
||||
ErrorResult rv;
|
||||
nsAutoPtr<XPathExpression> expression(CreateExpression(aExpression,
|
||||
resolver, rv));
|
||||
if (rv.Failed()) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aContextNode);
|
||||
if (!node) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIXPathResult> inResult = do_QueryInterface(aInResult);
|
||||
RefPtr<XPathResult> result =
|
||||
expression->Evaluate(*node, aType,
|
||||
static_cast<XPathResult*>(inResult.get()), rv);
|
||||
if (rv.Failed()) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
*aResult = ToSupports(result.forget().take());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
XPathExpression*
|
||||
XPathEvaluator::CreateExpression(const nsAString& aExpression,
|
||||
XPathNSResolver* aResolver, ErrorResult& aRv)
|
||||
@ -164,13 +128,11 @@ XPathEvaluator::WrapObject(JSContext* aCx,
|
||||
return dom::XPathEvaluatorBinding::Wrap(aCx, this, aGivenProto, aReflector);
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<XPathEvaluator>
|
||||
/* static */ XPathEvaluator*
|
||||
XPathEvaluator::Constructor(const GlobalObject& aGlobal,
|
||||
ErrorResult& rv)
|
||||
{
|
||||
RefPtr<XPathEvaluator> newObj = new XPathEvaluator(nullptr);
|
||||
return newObj.forget();
|
||||
return new XPathEvaluator(nullptr);
|
||||
}
|
||||
|
||||
already_AddRefed<XPathResult>
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef mozilla_dom_XPathEvaluator_h
|
||||
#define mozilla_dom_XPathEvaluator_h
|
||||
|
||||
#include "nsIDOMXPathEvaluator.h"
|
||||
#include "mozilla/dom/NonRefcountedDOMObject.h"
|
||||
#include "nsIWeakReference.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsString.h"
|
||||
@ -29,17 +29,11 @@ class XPathResult;
|
||||
/**
|
||||
* A class for evaluating an XPath expression string
|
||||
*/
|
||||
class XPathEvaluator final : public nsIDOMXPathEvaluator
|
||||
class XPathEvaluator final : public NonRefcountedDOMObject
|
||||
{
|
||||
~XPathEvaluator();
|
||||
|
||||
public:
|
||||
explicit XPathEvaluator(nsIDocument* aDocument = nullptr);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMXPathEvaluator interface
|
||||
NS_DECL_NSIDOMXPATHEVALUATOR
|
||||
~XPathEvaluator();
|
||||
|
||||
// WebIDL API
|
||||
bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
|
||||
@ -48,7 +42,7 @@ public:
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
|
||||
return doc;
|
||||
}
|
||||
static already_AddRefed<XPathEvaluator>
|
||||
static XPathEvaluator*
|
||||
Constructor(const GlobalObject& aGlobal, ErrorResult& rv);
|
||||
XPathExpression*
|
||||
CreateExpression(const nsAString& aExpression,
|
||||
@ -78,16 +72,6 @@ private:
|
||||
RefPtr<txResultRecycler> mRecycler;
|
||||
};
|
||||
|
||||
inline nsISupports*
|
||||
ToSupports(XPathEvaluator* e)
|
||||
{
|
||||
return static_cast<nsIDOMXPathEvaluator*>(e);
|
||||
}
|
||||
|
||||
/* d0a75e02-b5e7-11d5-a7f2-df109fb8a1fc */
|
||||
#define TRANSFORMIIX_XPATH_EVALUATOR_CID \
|
||||
{ 0xd0a75e02, 0xb5e7, 0x11d5, { 0xa7, 0xf2, 0xdf, 0x10, 0x9f, 0xb8, 0xa1, 0xfc } }
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -223,7 +223,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(HTMLEditor)
|
||||
already_AddRefed<nsIPresentationService> NS_CreatePresentationService();
|
||||
|
||||
// Factory Constructor
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(XPathEvaluator)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(txNodeSetAdaptor, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMSerializer)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(XMLHttpRequestMainThread, Init)
|
||||
@ -593,7 +592,6 @@ NS_DEFINE_NAMED_CID(NS_PLUGINDOCLOADERFACTORY_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_PLUGINDOCUMENT_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_VIDEODOCUMENT_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_STYLESHEETSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(TRANSFORMIIX_XPATH_EVALUATOR_CID);
|
||||
NS_DEFINE_NAMED_CID(TRANSFORMIIX_NODESET_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_XMLSERIALIZER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_FORMDATA_CID);
|
||||
@ -844,7 +842,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
|
||||
{ &kNS_PLUGINDOCUMENT_CID, false, nullptr, CreatePluginDocument },
|
||||
{ &kNS_VIDEODOCUMENT_CID, false, nullptr, CreateVideoDocument },
|
||||
{ &kNS_STYLESHEETSERVICE_CID, false, nullptr, nsStyleSheetServiceConstructor },
|
||||
{ &kTRANSFORMIIX_XPATH_EVALUATOR_CID, false, nullptr, XPathEvaluatorConstructor },
|
||||
{ &kTRANSFORMIIX_NODESET_CID, false, nullptr, txNodeSetAdaptorConstructor },
|
||||
{ &kNS_XMLSERIALIZER_CID, false, nullptr, nsDOMSerializerConstructor },
|
||||
{ &kNS_FORMDATA_CID, false, nullptr, FormDataConstructor },
|
||||
@ -961,7 +958,6 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
|
||||
{ NS_WINDOWCONTROLLER_CONTRACTID, &kNS_WINDOWCONTROLLER_CID },
|
||||
{ PLUGIN_DLF_CONTRACTID, &kNS_PLUGINDOCLOADERFACTORY_CID },
|
||||
{ NS_STYLESHEETSERVICE_CONTRACTID, &kNS_STYLESHEETSERVICE_CID },
|
||||
{ NS_XPATH_EVALUATOR_CONTRACTID, &kTRANSFORMIIX_XPATH_EVALUATOR_CID },
|
||||
{ TRANSFORMIIX_NODESET_CONTRACTID, &kTRANSFORMIIX_NODESET_CID },
|
||||
{ NS_XMLSERIALIZER_CONTRACTID, &kNS_XMLSERIALIZER_CID },
|
||||
{ NS_FORMDATA_CONTRACTID, &kNS_FORMDATA_CID },
|
||||
|
@ -147,7 +147,6 @@
|
||||
#endif
|
||||
@BINPATH@/components/dom_xbl.xpt
|
||||
@BINPATH@/components/dom_xhr.xpt
|
||||
@BINPATH@/components/dom_xpath.xpt
|
||||
@BINPATH@/components/dom_xul.xpt
|
||||
@BINPATH@/components/dom_presentation.xpt
|
||||
@BINPATH@/components/downloads.xpt
|
||||
|
@ -65,7 +65,6 @@
|
||||
#include "nsIDOMValidityState.h"
|
||||
#include "nsIDOMWheelEvent.h"
|
||||
#include "nsIDOMXMLDocument.h"
|
||||
#include "nsIDOMXPathEvaluator.h"
|
||||
#include "nsIDOMXULCommandEvent.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIFrameLoader.h"
|
||||
@ -161,7 +160,6 @@
|
||||
#include "mozilla/dom/XMLHttpRequestEventTargetBinding.h"
|
||||
#include "mozilla/dom/XMLHttpRequestUploadBinding.h"
|
||||
#include "mozilla/dom/XMLSerializerBinding.h"
|
||||
#include "mozilla/dom/XPathEvaluatorBinding.h"
|
||||
#include "mozilla/dom/XULCommandEventBinding.h"
|
||||
#include "mozilla/dom/XULDocumentBinding.h"
|
||||
#include "mozilla/dom/XULElementBinding.h"
|
||||
@ -287,7 +285,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
|
||||
DEFINE_SHIM(XMLDocument),
|
||||
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIXMLHttpRequestEventTarget, XMLHttpRequestEventTarget),
|
||||
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIXMLHttpRequestUpload, XMLHttpRequestUpload),
|
||||
DEFINE_SHIM(XPathEvaluator),
|
||||
DEFINE_SHIM(XULCommandEvent),
|
||||
DEFINE_SHIM(XULElement),
|
||||
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsISelection, Selection),
|
||||
|
Loading…
Reference in New Issue
Block a user