Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/PlacesObserversBinding.h
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM PlacesObservers.webidl BY Codegen.py - DO NOT EDIT */
2
3
#ifndef mozilla_dom_PlacesObserversBinding_h
4
#define mozilla_dom_PlacesObserversBinding_h
5
6
#include "GeckoProfiler.h"
7
#include "PlacesEventBinding.h"
8
#include "js/RootingAPI.h"
9
#include "jspubtd.h"
10
#include "mozilla/ErrorResult.h"
11
#include "mozilla/dom/BindingDeclarations.h"
12
#include "mozilla/dom/CallbackFunction.h"
13
#include "mozilla/dom/Nullable.h"
14
#include "mozilla/dom/PrototypeList.h"
15
#include "mozilla/dom/ToJSValue.h"
16
17
namespace mozilla {
18
namespace dom {
19
20
struct NativePropertyHooks;
21
class PlacesEvent;
22
class PlacesEventCallback;
23
class PlacesObservers;
24
struct PlacesObserversAtoms;
25
class PlacesWeakCallbackWrapper;
26
struct PlacesWeakCallbackWrapperAtoms;
27
class ProtoAndIfaceCache;
28
29
} // namespace dom
30
} // namespace mozilla
31
32
namespace mozilla {
33
namespace dom {
34
35
class PlacesEventCallback : public CallbackFunction
36
{
37
public:
38
  explicit inline PlacesEventCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
39
    : CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
40
0
  {
41
0
    MOZ_ASSERT(JS::IsCallable(mCallback));
42
0
  }
43
44
  explicit inline PlacesEventCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
45
    : CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor())
46
0
  {
47
0
    MOZ_ASSERT(JS::IsCallable(mCallback));
48
0
  }
49
50
  explicit inline PlacesEventCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
51
    : CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
52
0
  {
53
0
    MOZ_ASSERT(JS::IsCallable(mCallback));
54
0
  }
55
56
  explicit inline PlacesEventCallback(CallbackFunction* aOther)
57
    : CallbackFunction(aOther)
58
0
  {
59
0
  }
60
61
  template <typename T>
62
  inline void
63
  Call(const T& thisVal, const Sequence<OwningNonNull<PlacesEvent>>& events, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
64
  {
65
    MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
66
    if (!aExecutionReason) {
67
      aExecutionReason = "PlacesEventCallback";
68
    }
69
    CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
70
    if (!s.GetContext()) {
71
      MOZ_ASSERT(aRv.Failed());
72
      return;
73
    }
74
    JS::Rooted<JS::Value> thisValJS(s.GetContext());
75
    if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
76
      aRv.Throw(NS_ERROR_FAILURE);
77
      return;
78
    }
79
    return Call(s.GetContext(), thisValJS, events, aRv);
80
  }
81
82
  inline void
83
  Call(const Sequence<OwningNonNull<PlacesEvent>>& events, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
84
0
  {
85
0
    MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
86
0
    if (!aExecutionReason) {
87
0
      aExecutionReason = "PlacesEventCallback";
88
0
    }
89
0
    CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
90
0
    if (!s.GetContext()) {
91
0
      MOZ_ASSERT(aRv.Failed());
92
0
      return;
93
0
    }
94
0
    return Call(s.GetContext(), JS::UndefinedHandleValue, events, aRv);
95
0
  }
96
97
  template <typename T>
98
  inline void
99
  Call(const T& thisVal, const Sequence<OwningNonNull<PlacesEvent>>& events, const char* aExecutionReason = nullptr)
100
  {
101
    return Call(thisVal, events, IgnoreErrors(), aExecutionReason);
102
  }
103
104
  inline void
105
  Call(const Sequence<OwningNonNull<PlacesEvent>>& events, const char* aExecutionReason = nullptr)
106
0
  {
107
0
    return Call(events, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
108
0
  }
109
110
  inline bool
111
  operator==(const PlacesEventCallback& aOther) const
112
0
  {
113
0
    return CallbackFunction::operator==(aOther);
114
0
  }
115
116
private:
117
  void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, const Sequence<OwningNonNull<PlacesEvent>>& events, ErrorResult& aRv);
118
};
119
120
121
namespace binding_detail {
122
class FastPlacesEventCallback : public PlacesEventCallback
123
{
124
public:
125
  explicit inline FastPlacesEventCallback(JSObject* aCallback, JSObject* aCallbackGlobal)
126
    : PlacesEventCallback(aCallback, aCallbackGlobal, FastCallbackConstructor())
127
0
  {
128
0
  }
129
130
  inline void
131
  Trace(JSTracer* aTracer)
132
0
  {
133
0
    PlacesEventCallback::Trace(aTracer);
134
0
  }
135
136
  inline void
137
  FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
138
0
  {
139
0
    PlacesEventCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
140
0
  }
141
};
142
} // namespace binding_detail
143
144
145
namespace PlacesObservers_Binding {
146
147
  typedef mozilla::dom::PlacesObservers NativeType;
148
149
  bool
150
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
151
152
  // We declare this as an array so that retrieving a pointer to this
153
  // binding's property hooks only requires compile/link-time resolvable
154
  // address arithmetic.  Declaring it as a pointer instead would require
155
  // doing a run-time load to fetch a pointer to this binding's property
156
  // hooks.  And then structures which embedded a pointer to this structure
157
  // would require a run-time load for proper initialization, which would
158
  // then induce static constructors.  Lots of static constructors.
159
  extern const NativePropertyHooks sNativePropertyHooks[];
160
161
  void
162
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
163
164
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
165
0
  {
166
0
    /* Get the interface object for this class.  This will create the object as
167
0
       needed. */
168
0
169
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::PlacesObservers,
170
0
                                       &CreateInterfaceObjects,
171
0
                                       aDefineOnGlobal);
172
0
  }
173
174
  JSObject*
175
  GetConstructorObject(JSContext* aCx);
176
177
} // namespace PlacesObservers_Binding
178
179
180
181
namespace PlacesWeakCallbackWrapper_Binding {
182
183
  typedef mozilla::dom::PlacesWeakCallbackWrapper NativeType;
184
185
  bool
186
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
187
188
  const JSClass*
189
  GetJSClass();
190
191
  bool
192
  Wrap(JSContext* aCx, mozilla::dom::PlacesWeakCallbackWrapper* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
193
194
  template <class T>
195
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
196
0
  {
197
0
    JS::Rooted<JSObject*> reflector(aCx);
198
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
199
0
  }
200
201
  // We declare this as an array so that retrieving a pointer to this
202
  // binding's property hooks only requires compile/link-time resolvable
203
  // address arithmetic.  Declaring it as a pointer instead would require
204
  // doing a run-time load to fetch a pointer to this binding's property
205
  // hooks.  And then structures which embedded a pointer to this structure
206
  // would require a run-time load for proper initialization, which would
207
  // then induce static constructors.  Lots of static constructors.
208
  extern const NativePropertyHooks sNativePropertyHooks[];
209
210
  void
211
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
212
213
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
214
0
  {
215
0
    /* Get the interface prototype object for this class.  This will create the
216
0
       object as needed. */
217
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::PlacesWeakCallbackWrapper,
218
0
                                       &CreateInterfaceObjects,
219
0
                                       /* aDefineOnGlobal = */ true);
220
0
221
0
  }
222
223
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
224
0
  {
225
0
    /* Get the interface object for this class.  This will create the object as
226
0
       needed. */
227
0
228
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::PlacesWeakCallbackWrapper,
229
0
                                       &CreateInterfaceObjects,
230
0
                                       aDefineOnGlobal);
231
0
  }
232
233
  JSObject*
234
  GetConstructorObject(JSContext* aCx);
235
236
} // namespace PlacesWeakCallbackWrapper_Binding
237
238
239
240
} // namespace dom
241
} // namespace mozilla
242
243
#endif // mozilla_dom_PlacesObserversBinding_h