2005-11-02 10:35:22 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2005-11-02 10:35:22 +03:00
|
|
|
|
2013-08-24 01:11:30 +04:00
|
|
|
#ifndef mozilla_dom_XPathEvaluator_h
|
|
|
|
#define mozilla_dom_XPathEvaluator_h
|
2005-11-02 10:35:22 +03:00
|
|
|
|
2018-02-05 08:05:45 +03:00
|
|
|
#include "mozilla/dom/NonRefcountedDOMObject.h"
|
2005-11-02 10:39:53 +03:00
|
|
|
#include "nsIWeakReference.h"
|
2005-11-02 10:40:48 +03:00
|
|
|
#include "nsAutoPtr.h"
|
2006-07-13 18:21:53 +04:00
|
|
|
#include "nsString.h"
|
2012-06-19 06:30:09 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-12-14 23:10:49 +04:00
|
|
|
#include "mozilla/ErrorResult.h"
|
2013-07-04 19:39:24 +04:00
|
|
|
#include "nsIDocument.h"
|
2012-12-14 23:10:49 +04:00
|
|
|
|
2013-08-24 01:11:30 +04:00
|
|
|
class nsINode;
|
2013-09-02 20:01:55 +04:00
|
|
|
class txIParseContext;
|
2013-07-04 19:39:24 +04:00
|
|
|
class txResultRecycler;
|
2013-08-24 01:11:30 +04:00
|
|
|
|
2012-12-03 20:07:49 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2013-08-24 01:11:30 +04:00
|
|
|
|
2012-12-03 20:07:49 +04:00
|
|
|
class GlobalObject;
|
2014-06-27 23:39:50 +04:00
|
|
|
class XPathExpression;
|
2014-10-14 18:27:24 +04:00
|
|
|
class XPathNSResolver;
|
2013-07-04 19:40:06 +04:00
|
|
|
class XPathResult;
|
2005-11-02 10:35:22 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A class for evaluating an XPath expression string
|
|
|
|
*/
|
2018-02-05 08:05:45 +03:00
|
|
|
class XPathEvaluator final : public NonRefcountedDOMObject
|
2005-11-02 10:35:22 +03:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 04:49:25 +04:00
|
|
|
explicit XPathEvaluator(nsIDocument* aDocument = nullptr);
|
2018-02-05 08:05:45 +03:00
|
|
|
~XPathEvaluator();
|
2005-11-02 10:35:22 +03:00
|
|
|
|
2012-12-14 23:10:49 +04:00
|
|
|
// WebIDL API
|
Bug 1117172 part 2. Change the non-wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, Codegen.py, and
StructuredClone.cpp. The rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/WrapObject\((JSContext *\* *(?:aCx|cx)),(\s*)(JS::MutableHandle<JSObject\*> aReflector)/WrapObject(\1,\2JS::Handle<JSObject*> aGivenProto,\2\3/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx)), this, aReflector/\1, this, aGivenProto, aReflector/'
2015-03-19 17:13:32 +03:00
|
|
|
bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
|
2014-03-15 23:00:15 +04:00
|
|
|
nsIDocument* GetParentObject()
|
2013-07-04 19:39:24 +04:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
|
2014-03-15 23:00:15 +04:00
|
|
|
return doc;
|
2013-07-04 19:39:24 +04:00
|
|
|
}
|
2018-02-05 08:05:45 +03:00
|
|
|
static XPathEvaluator*
|
2013-08-24 01:11:30 +04:00
|
|
|
Constructor(const GlobalObject& aGlobal, ErrorResult& rv);
|
2014-06-27 23:39:50 +04:00
|
|
|
XPathExpression*
|
2012-12-14 23:10:49 +04:00
|
|
|
CreateExpression(const nsAString& aExpression,
|
2014-10-14 18:27:24 +04:00
|
|
|
XPathNSResolver* aResolver,
|
2013-08-24 01:11:30 +04:00
|
|
|
ErrorResult& rv);
|
2013-09-02 20:01:55 +04:00
|
|
|
XPathExpression*
|
|
|
|
CreateExpression(const nsAString& aExpression,
|
|
|
|
nsINode* aResolver,
|
|
|
|
ErrorResult& aRv);
|
2014-10-14 18:27:24 +04:00
|
|
|
nsINode* CreateNSResolver(nsINode& aNodeResolver)
|
|
|
|
{
|
|
|
|
return &aNodeResolver;
|
|
|
|
}
|
2013-07-04 19:40:06 +04:00
|
|
|
already_AddRefed<XPathResult>
|
|
|
|
Evaluate(JSContext* aCx, const nsAString& aExpression,
|
2014-11-04 12:20:08 +03:00
|
|
|
nsINode& aContextNode, XPathNSResolver* aResolver,
|
2013-07-04 19:40:06 +04:00
|
|
|
uint16_t aType, JS::Handle<JSObject*> aResult,
|
|
|
|
ErrorResult& rv);
|
2005-11-02 10:35:22 +03:00
|
|
|
private:
|
2013-09-02 20:01:55 +04:00
|
|
|
XPathExpression*
|
|
|
|
CreateExpression(const nsAString& aExpression,
|
|
|
|
txIParseContext* aContext,
|
|
|
|
nsIDocument* aDocument,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
2005-11-02 10:39:53 +03:00
|
|
|
nsWeakPtr mDocument;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<txResultRecycler> mRecycler;
|
2005-11-02 10:35:22 +03:00
|
|
|
};
|
|
|
|
|
2013-08-24 01:11:30 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* mozilla_dom_XPathEvaluator_h */
|