Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/XPathExpression.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#ifndef mozilla_dom_XPathExpression_h
7
#define mozilla_dom_XPathExpression_h
8
9
#include "nsAutoPtr.h"
10
#include "nsCycleCollectionParticipant.h"
11
#include "nsIWeakReferenceUtils.h"
12
#include "mozilla/Attributes.h"
13
#include "mozilla/dom/NonRefcountedDOMObject.h"
14
#include "mozilla/dom/XPathExpressionBinding.h"
15
16
class Expr;
17
class nsIDocument;
18
class nsINode;
19
class txResultRecycler;
20
21
namespace mozilla {
22
namespace dom {
23
24
class XPathResult;
25
26
/**
27
 * A class for evaluating an XPath expression string
28
 */
29
class XPathExpression final : public NonRefcountedDOMObject
30
{
31
public:
32
    XPathExpression(nsAutoPtr<Expr>&& aExpression, txResultRecycler* aRecycler,
33
                    nsIDocument *aDocument);
34
    ~XPathExpression();
35
36
    bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
37
0
    {
38
0
        return XPathExpression_Binding::Wrap(aCx, this, aGivenProto, aReflector);
39
0
    }
40
41
    already_AddRefed<XPathResult>
42
        Evaluate(JSContext* aCx, nsINode& aContextNode, uint16_t aType,
43
                 JS::Handle<JSObject*> aInResult, ErrorResult& aRv)
44
0
    {
45
0
        return EvaluateWithContext(aCx, aContextNode, 1, 1, aType, aInResult,
46
0
                                   aRv);
47
0
    }
48
    already_AddRefed<XPathResult>
49
        EvaluateWithContext(JSContext* aCx, nsINode& aContextNode,
50
                            uint32_t aContextPosition, uint32_t aContextSize,
51
                            uint16_t aType, JS::Handle<JSObject*> aInResult,
52
                            ErrorResult& aRv);
53
    already_AddRefed<XPathResult>
54
        Evaluate(nsINode& aContextNode, uint16_t aType, XPathResult* aInResult,
55
                 ErrorResult& aRv)
56
0
    {
57
0
        return EvaluateWithContext(aContextNode, 1, 1, aType, aInResult, aRv);
58
0
    }
59
    already_AddRefed<XPathResult>
60
        EvaluateWithContext(nsINode& aContextNode, uint32_t aContextPosition,
61
                            uint32_t aContextSize, uint16_t aType,
62
                            XPathResult* aInResult, ErrorResult& aRv);
63
64
private:
65
    nsAutoPtr<Expr> mExpression;
66
    RefPtr<txResultRecycler> mRecycler;
67
    nsWeakPtr mDocument;
68
    bool mCheckDocument;
69
};
70
71
} // namespace dom
72
} // namespace mozilla
73
74
#endif /* mozilla_dom_XPathExpression_h */