Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM XPathNSResolver.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_XPathNSResolverBinding_h
4 : #define mozilla_dom_XPathNSResolverBinding_h
5 :
6 : #include "js/RootingAPI.h"
7 : #include "jspubtd.h"
8 : #include "mozilla/ErrorResult.h"
9 : #include "mozilla/dom/BindingDeclarations.h"
10 : #include "mozilla/dom/CallbackInterface.h"
11 : #include "mozilla/dom/Nullable.h"
12 : #include "mozilla/dom/ToJSValue.h"
13 :
14 : namespace mozilla {
15 : namespace dom {
16 :
17 : struct NativePropertyHooks;
18 : class ProtoAndIfaceCache;
19 : class XPathNSResolver;
20 : struct XPathNSResolverAtoms;
21 :
22 : } // namespace dom
23 : } // namespace mozilla
24 :
25 : namespace mozilla {
26 : namespace dom {
27 :
28 0 : class XPathNSResolver : public CallbackInterface
29 : {
30 : public:
31 : explicit inline XPathNSResolver(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
32 : : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
33 : {
34 : }
35 :
36 0 : explicit inline XPathNSResolver(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
37 0 : : CallbackInterface(aCallback, FastCallbackConstructor())
38 : {
39 0 : }
40 :
41 : explicit inline XPathNSResolver(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
42 : : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
43 : {
44 : }
45 :
46 : template <typename T>
47 : inline void
48 : LookupNamespaceURI(const T& thisVal, const nsAString& prefix, nsString& aRetVal, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
49 : {
50 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
51 : if (!aExecutionReason) {
52 : aExecutionReason = "XPathNSResolver.lookupNamespaceURI";
53 : }
54 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
55 : if (!s.GetContext()) {
56 : MOZ_ASSERT(aRv.Failed());
57 : return;
58 : }
59 : JS::Rooted<JS::Value> thisValJS(s.GetContext());
60 : if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
61 : aRv.Throw(NS_ERROR_FAILURE);
62 : return;
63 : }
64 : return LookupNamespaceURI(s.GetContext(), thisValJS, prefix, aRetVal, aRv);
65 : }
66 :
67 : inline void
68 0 : LookupNamespaceURI(const nsAString& prefix, nsString& aRetVal, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
69 : {
70 0 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
71 0 : if (!aExecutionReason) {
72 0 : aExecutionReason = "XPathNSResolver.lookupNamespaceURI";
73 : }
74 0 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
75 0 : if (!s.GetContext()) {
76 0 : MOZ_ASSERT(aRv.Failed());
77 0 : return;
78 : }
79 0 : return LookupNamespaceURI(s.GetContext(), JS::UndefinedHandleValue, prefix, aRetVal, aRv);
80 : }
81 :
82 : template <typename T>
83 : inline void
84 : LookupNamespaceURI(const T& thisVal, const nsAString& prefix, nsString& aRetVal, const char* aExecutionReason = nullptr)
85 : {
86 : IgnoredErrorResult rv;
87 : return LookupNamespaceURI(thisVal, prefix, aRetVal, rv, aExecutionReason);
88 : }
89 :
90 : inline void
91 : LookupNamespaceURI(const nsAString& prefix, nsString& aRetVal, const char* aExecutionReason = nullptr)
92 : {
93 : IgnoredErrorResult rv;
94 : return LookupNamespaceURI(prefix, aRetVal, rv, aExecutionReason, eReportExceptions, nullptr);
95 : }
96 :
97 : inline bool
98 : operator==(const XPathNSResolver& aOther) const
99 : {
100 : return CallbackInterface::operator==(aOther);
101 : }
102 :
103 : private:
104 : void LookupNamespaceURI(JSContext* cx, JS::Handle<JS::Value> aThisVal, const nsAString& prefix, nsString& aRetVal, ErrorResult& aRv);
105 :
106 : static bool
107 : InitIds(JSContext* cx, XPathNSResolverAtoms* atomsCache);
108 : };
109 :
110 :
111 : namespace binding_detail {
112 0 : class FastXPathNSResolver : public XPathNSResolver
113 : {
114 : public:
115 0 : explicit inline FastXPathNSResolver(JS::Handle<JSObject*> aCallback)
116 0 : : XPathNSResolver(aCallback, FastCallbackConstructor())
117 : {
118 0 : }
119 :
120 : inline void
121 0 : Trace(JSTracer* aTracer)
122 : {
123 0 : XPathNSResolver::Trace(aTracer);
124 0 : }
125 :
126 : inline void
127 0 : FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
128 : {
129 0 : XPathNSResolver::FinishSlowJSInitIfMoreThanOneOwner(aCx);
130 0 : }
131 : };
132 : } // namespace binding_detail
133 :
134 :
135 : } // namespace dom
136 : } // namespace mozilla
137 :
138 : #endif // mozilla_dom_XPathNSResolverBinding_h
|