/work/obj-fuzz/dist/include/mozilla/dom/WebComponentsBinding.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM WebComponents.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #ifndef mozilla_dom_WebComponentsBinding_h |
4 | | #define mozilla_dom_WebComponentsBinding_h |
5 | | |
6 | | #include "GeckoProfiler.h" |
7 | | #include "js/RootingAPI.h" |
8 | | #include "jspubtd.h" |
9 | | #include "mozilla/ErrorResult.h" |
10 | | #include "mozilla/dom/BindingDeclarations.h" |
11 | | #include "mozilla/dom/CallbackFunction.h" |
12 | | #include "mozilla/dom/Nullable.h" |
13 | | #include "mozilla/dom/ToJSValue.h" |
14 | | |
15 | | class nsIDocument; |
16 | | class nsIJSID; |
17 | | |
18 | | namespace mozilla { |
19 | | namespace dom { |
20 | | |
21 | | class LifecycleAdoptedCallback; |
22 | | class LifecycleAttributeChangedCallback; |
23 | | struct LifecycleCallbacksAtoms; |
24 | | class LifecycleConnectedCallback; |
25 | | class LifecycleDisconnectedCallback; |
26 | | class LifecycleGetCustomInterfaceCallback; |
27 | | struct NativePropertyHooks; |
28 | | class ProtoAndIfaceCache; |
29 | | |
30 | | } // namespace dom |
31 | | } // namespace mozilla |
32 | | |
33 | | namespace mozilla { |
34 | | namespace dom { |
35 | | |
36 | | struct LifecycleCallbacks : public DictionaryBase |
37 | | { |
38 | | MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<LifecycleAdoptedCallback>> mAdoptedCallback; |
39 | | MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<LifecycleAttributeChangedCallback>> mAttributeChangedCallback; |
40 | | MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<LifecycleConnectedCallback>> mConnectedCallback; |
41 | | MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<LifecycleDisconnectedCallback>> mDisconnectedCallback; |
42 | | MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<LifecycleGetCustomInterfaceCallback>> mGetCustomInterfaceCallback; |
43 | | |
44 | | LifecycleCallbacks(); |
45 | | |
46 | | explicit inline LifecycleCallbacks(const FastDictionaryInitializer& ) |
47 | 0 | { |
48 | 0 | // Do nothing here; this is used by our "Fast" subclass |
49 | 0 | } |
50 | | |
51 | | private: |
52 | | LifecycleCallbacks(const LifecycleCallbacks&) = delete; |
53 | | LifecycleCallbacks& operator=(const LifecycleCallbacks&) = delete; |
54 | | |
55 | | static bool |
56 | | InitIds(JSContext* cx, LifecycleCallbacksAtoms* atomsCache); |
57 | | |
58 | | public: |
59 | | bool |
60 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
61 | | |
62 | | bool |
63 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
64 | | |
65 | | void |
66 | | TraceDictionary(JSTracer* trc); |
67 | | |
68 | | inline void |
69 | | TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags) |
70 | 0 | { |
71 | 0 | ImplCycleCollectionTraverse(aCallback, mAdoptedCallback, "mAdoptedCallback", aFlags); |
72 | 0 | ImplCycleCollectionTraverse(aCallback, mAttributeChangedCallback, "mAttributeChangedCallback", aFlags); |
73 | 0 | ImplCycleCollectionTraverse(aCallback, mConnectedCallback, "mConnectedCallback", aFlags); |
74 | 0 | ImplCycleCollectionTraverse(aCallback, mDisconnectedCallback, "mDisconnectedCallback", aFlags); |
75 | 0 | ImplCycleCollectionTraverse(aCallback, mGetCustomInterfaceCallback, "mGetCustomInterfaceCallback", aFlags); |
76 | 0 | } |
77 | | |
78 | | inline void |
79 | | UnlinkForCC() |
80 | 0 | { |
81 | 0 | ImplCycleCollectionUnlink(mAdoptedCallback); |
82 | 0 | ImplCycleCollectionUnlink(mAttributeChangedCallback); |
83 | 0 | ImplCycleCollectionUnlink(mConnectedCallback); |
84 | 0 | ImplCycleCollectionUnlink(mDisconnectedCallback); |
85 | 0 | ImplCycleCollectionUnlink(mGetCustomInterfaceCallback); |
86 | 0 | } |
87 | | }; |
88 | | |
89 | | namespace binding_detail { |
90 | | struct FastLifecycleCallbacks : public LifecycleCallbacks |
91 | | { |
92 | | inline FastLifecycleCallbacks() |
93 | | : LifecycleCallbacks(FastDictionaryInitializer()) |
94 | 0 | { |
95 | 0 | // Doesn't matter what int we pass to the parent constructor |
96 | 0 | } |
97 | | }; |
98 | | } // namespace binding_detail |
99 | | |
100 | | |
101 | | class LifecycleConnectedCallback : public CallbackFunction |
102 | | { |
103 | | public: |
104 | | explicit inline LifecycleConnectedCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal) |
105 | | : CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal) |
106 | 0 | { |
107 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
108 | 0 | } |
109 | | |
110 | | explicit inline LifecycleConnectedCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& ) |
111 | | : CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
112 | 0 | { |
113 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
114 | 0 | } |
115 | | |
116 | | explicit inline LifecycleConnectedCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal) |
117 | | : CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal) |
118 | 0 | { |
119 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
120 | 0 | } |
121 | | |
122 | | explicit inline LifecycleConnectedCallback(CallbackFunction* aOther) |
123 | | : CallbackFunction(aOther) |
124 | 0 | { |
125 | 0 | } |
126 | | |
127 | | template <typename T> |
128 | | inline void |
129 | | Call(const T& thisVal, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
130 | 0 | { |
131 | 0 | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
132 | 0 | if (!aExecutionReason) { |
133 | 0 | aExecutionReason = "LifecycleConnectedCallback"; |
134 | 0 | } |
135 | 0 | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
136 | 0 | if (!s.GetContext()) { |
137 | 0 | MOZ_ASSERT(aRv.Failed()); |
138 | 0 | return; |
139 | 0 | } |
140 | 0 | JS::Rooted<JS::Value> thisValJS(s.GetContext()); |
141 | 0 | if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) { |
142 | 0 | aRv.Throw(NS_ERROR_FAILURE); |
143 | 0 | return; |
144 | 0 | } |
145 | 0 | return Call(s.GetContext(), thisValJS, aRv); |
146 | 0 | } |
147 | | |
148 | | inline void |
149 | | Call(ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
150 | 0 | { |
151 | 0 | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
152 | 0 | if (!aExecutionReason) { |
153 | 0 | aExecutionReason = "LifecycleConnectedCallback"; |
154 | 0 | } |
155 | 0 | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
156 | 0 | if (!s.GetContext()) { |
157 | 0 | MOZ_ASSERT(aRv.Failed()); |
158 | 0 | return; |
159 | 0 | } |
160 | 0 | return Call(s.GetContext(), JS::UndefinedHandleValue, aRv); |
161 | 0 | } |
162 | | |
163 | | template <typename T> |
164 | | inline void |
165 | | Call(const T& thisVal, const char* aExecutionReason = nullptr) |
166 | 0 | { |
167 | 0 | return Call(thisVal, IgnoreErrors(), aExecutionReason); |
168 | 0 | } |
169 | | |
170 | | inline void |
171 | | Call(const char* aExecutionReason = nullptr) |
172 | 0 | { |
173 | 0 | return Call(IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr); |
174 | 0 | } |
175 | | |
176 | | inline bool |
177 | | operator==(const LifecycleConnectedCallback& aOther) const |
178 | 0 | { |
179 | 0 | return CallbackFunction::operator==(aOther); |
180 | 0 | } |
181 | | |
182 | | private: |
183 | | void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, ErrorResult& aRv); |
184 | | }; |
185 | | |
186 | | |
187 | | class LifecycleDisconnectedCallback : public CallbackFunction |
188 | | { |
189 | | public: |
190 | | explicit inline LifecycleDisconnectedCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal) |
191 | | : CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal) |
192 | 0 | { |
193 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
194 | 0 | } |
195 | | |
196 | | explicit inline LifecycleDisconnectedCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& ) |
197 | | : CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
198 | 0 | { |
199 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
200 | 0 | } |
201 | | |
202 | | explicit inline LifecycleDisconnectedCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal) |
203 | | : CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal) |
204 | 0 | { |
205 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
206 | 0 | } |
207 | | |
208 | | explicit inline LifecycleDisconnectedCallback(CallbackFunction* aOther) |
209 | | : CallbackFunction(aOther) |
210 | 0 | { |
211 | 0 | } |
212 | | |
213 | | template <typename T> |
214 | | inline void |
215 | | Call(const T& thisVal, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
216 | 0 | { |
217 | 0 | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
218 | 0 | if (!aExecutionReason) { |
219 | 0 | aExecutionReason = "LifecycleDisconnectedCallback"; |
220 | 0 | } |
221 | 0 | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
222 | 0 | if (!s.GetContext()) { |
223 | 0 | MOZ_ASSERT(aRv.Failed()); |
224 | 0 | return; |
225 | 0 | } |
226 | 0 | JS::Rooted<JS::Value> thisValJS(s.GetContext()); |
227 | 0 | if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) { |
228 | 0 | aRv.Throw(NS_ERROR_FAILURE); |
229 | 0 | return; |
230 | 0 | } |
231 | 0 | return Call(s.GetContext(), thisValJS, aRv); |
232 | 0 | } |
233 | | |
234 | | inline void |
235 | | Call(ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
236 | 0 | { |
237 | 0 | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
238 | 0 | if (!aExecutionReason) { |
239 | 0 | aExecutionReason = "LifecycleDisconnectedCallback"; |
240 | 0 | } |
241 | 0 | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
242 | 0 | if (!s.GetContext()) { |
243 | 0 | MOZ_ASSERT(aRv.Failed()); |
244 | 0 | return; |
245 | 0 | } |
246 | 0 | return Call(s.GetContext(), JS::UndefinedHandleValue, aRv); |
247 | 0 | } |
248 | | |
249 | | template <typename T> |
250 | | inline void |
251 | | Call(const T& thisVal, const char* aExecutionReason = nullptr) |
252 | 0 | { |
253 | 0 | return Call(thisVal, IgnoreErrors(), aExecutionReason); |
254 | 0 | } |
255 | | |
256 | | inline void |
257 | | Call(const char* aExecutionReason = nullptr) |
258 | 0 | { |
259 | 0 | return Call(IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr); |
260 | 0 | } |
261 | | |
262 | | inline bool |
263 | | operator==(const LifecycleDisconnectedCallback& aOther) const |
264 | 0 | { |
265 | 0 | return CallbackFunction::operator==(aOther); |
266 | 0 | } |
267 | | |
268 | | private: |
269 | | void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, ErrorResult& aRv); |
270 | | }; |
271 | | |
272 | | |
273 | | class LifecycleAdoptedCallback : public CallbackFunction |
274 | | { |
275 | | public: |
276 | | explicit inline LifecycleAdoptedCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal) |
277 | | : CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal) |
278 | 0 | { |
279 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
280 | 0 | } |
281 | | |
282 | | explicit inline LifecycleAdoptedCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& ) |
283 | | : CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
284 | 0 | { |
285 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
286 | 0 | } |
287 | | |
288 | | explicit inline LifecycleAdoptedCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal) |
289 | | : CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal) |
290 | 0 | { |
291 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
292 | 0 | } |
293 | | |
294 | | explicit inline LifecycleAdoptedCallback(CallbackFunction* aOther) |
295 | | : CallbackFunction(aOther) |
296 | 0 | { |
297 | 0 | } |
298 | | |
299 | | template <typename T> |
300 | | inline void |
301 | | Call(const T& thisVal, nsIDocument* oldDocument, nsIDocument* newDocment, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
302 | 0 | { |
303 | 0 | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
304 | 0 | if (!aExecutionReason) { |
305 | 0 | aExecutionReason = "LifecycleAdoptedCallback"; |
306 | 0 | } |
307 | 0 | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
308 | 0 | if (!s.GetContext()) { |
309 | 0 | MOZ_ASSERT(aRv.Failed()); |
310 | 0 | return; |
311 | 0 | } |
312 | 0 | JS::Rooted<JS::Value> thisValJS(s.GetContext()); |
313 | 0 | if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) { |
314 | 0 | aRv.Throw(NS_ERROR_FAILURE); |
315 | 0 | return; |
316 | 0 | } |
317 | 0 | return Call(s.GetContext(), thisValJS, oldDocument, newDocment, aRv); |
318 | 0 | } |
319 | | |
320 | | inline void |
321 | | Call(nsIDocument* oldDocument, nsIDocument* newDocment, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
322 | 0 | { |
323 | 0 | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
324 | 0 | if (!aExecutionReason) { |
325 | 0 | aExecutionReason = "LifecycleAdoptedCallback"; |
326 | 0 | } |
327 | 0 | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
328 | 0 | if (!s.GetContext()) { |
329 | 0 | MOZ_ASSERT(aRv.Failed()); |
330 | 0 | return; |
331 | 0 | } |
332 | 0 | return Call(s.GetContext(), JS::UndefinedHandleValue, oldDocument, newDocment, aRv); |
333 | 0 | } |
334 | | |
335 | | template <typename T> |
336 | | inline void |
337 | | Call(const T& thisVal, nsIDocument* oldDocument, nsIDocument* newDocment, const char* aExecutionReason = nullptr) |
338 | 0 | { |
339 | 0 | return Call(thisVal, oldDocument, newDocment, IgnoreErrors(), aExecutionReason); |
340 | 0 | } |
341 | | |
342 | | inline void |
343 | | Call(nsIDocument* oldDocument, nsIDocument* newDocment, const char* aExecutionReason = nullptr) |
344 | 0 | { |
345 | 0 | return Call(oldDocument, newDocment, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr); |
346 | 0 | } |
347 | | |
348 | | inline bool |
349 | | operator==(const LifecycleAdoptedCallback& aOther) const |
350 | 0 | { |
351 | 0 | return CallbackFunction::operator==(aOther); |
352 | 0 | } |
353 | | |
354 | | private: |
355 | | void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, nsIDocument* oldDocument, nsIDocument* newDocment, ErrorResult& aRv); |
356 | | }; |
357 | | |
358 | | |
359 | | class LifecycleAttributeChangedCallback : public CallbackFunction |
360 | | { |
361 | | public: |
362 | | explicit inline LifecycleAttributeChangedCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal) |
363 | | : CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal) |
364 | 0 | { |
365 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
366 | 0 | } |
367 | | |
368 | | explicit inline LifecycleAttributeChangedCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& ) |
369 | | : CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
370 | 0 | { |
371 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
372 | 0 | } |
373 | | |
374 | | explicit inline LifecycleAttributeChangedCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal) |
375 | | : CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal) |
376 | 0 | { |
377 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
378 | 0 | } |
379 | | |
380 | | explicit inline LifecycleAttributeChangedCallback(CallbackFunction* aOther) |
381 | | : CallbackFunction(aOther) |
382 | 0 | { |
383 | 0 | } |
384 | | |
385 | | template <typename T> |
386 | | inline void |
387 | | Call(const T& thisVal, const nsAString& attrName, const nsAString& oldValue, const nsAString& newValue, const nsAString& namespaceURI, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
388 | 0 | { |
389 | 0 | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
390 | 0 | if (!aExecutionReason) { |
391 | 0 | aExecutionReason = "LifecycleAttributeChangedCallback"; |
392 | 0 | } |
393 | 0 | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
394 | 0 | if (!s.GetContext()) { |
395 | 0 | MOZ_ASSERT(aRv.Failed()); |
396 | 0 | return; |
397 | 0 | } |
398 | 0 | JS::Rooted<JS::Value> thisValJS(s.GetContext()); |
399 | 0 | if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) { |
400 | 0 | aRv.Throw(NS_ERROR_FAILURE); |
401 | 0 | return; |
402 | 0 | } |
403 | 0 | return Call(s.GetContext(), thisValJS, attrName, oldValue, newValue, namespaceURI, aRv); |
404 | 0 | } |
405 | | |
406 | | inline void |
407 | | Call(const nsAString& attrName, const nsAString& oldValue, const nsAString& newValue, const nsAString& namespaceURI, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
408 | 0 | { |
409 | 0 | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
410 | 0 | if (!aExecutionReason) { |
411 | 0 | aExecutionReason = "LifecycleAttributeChangedCallback"; |
412 | 0 | } |
413 | 0 | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
414 | 0 | if (!s.GetContext()) { |
415 | 0 | MOZ_ASSERT(aRv.Failed()); |
416 | 0 | return; |
417 | 0 | } |
418 | 0 | return Call(s.GetContext(), JS::UndefinedHandleValue, attrName, oldValue, newValue, namespaceURI, aRv); |
419 | 0 | } |
420 | | |
421 | | template <typename T> |
422 | | inline void |
423 | | Call(const T& thisVal, const nsAString& attrName, const nsAString& oldValue, const nsAString& newValue, const nsAString& namespaceURI, const char* aExecutionReason = nullptr) |
424 | 0 | { |
425 | 0 | return Call(thisVal, attrName, oldValue, newValue, namespaceURI, IgnoreErrors(), aExecutionReason); |
426 | 0 | } |
427 | | |
428 | | inline void |
429 | | Call(const nsAString& attrName, const nsAString& oldValue, const nsAString& newValue, const nsAString& namespaceURI, const char* aExecutionReason = nullptr) |
430 | 0 | { |
431 | 0 | return Call(attrName, oldValue, newValue, namespaceURI, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr); |
432 | 0 | } |
433 | | |
434 | | inline bool |
435 | | operator==(const LifecycleAttributeChangedCallback& aOther) const |
436 | 0 | { |
437 | 0 | return CallbackFunction::operator==(aOther); |
438 | 0 | } |
439 | | |
440 | | private: |
441 | | void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, const nsAString& attrName, const nsAString& oldValue, const nsAString& newValue, const nsAString& namespaceURI, ErrorResult& aRv); |
442 | | }; |
443 | | |
444 | | |
445 | | class LifecycleGetCustomInterfaceCallback : public CallbackFunction |
446 | | { |
447 | | public: |
448 | | explicit inline LifecycleGetCustomInterfaceCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal) |
449 | | : CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal) |
450 | 0 | { |
451 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
452 | 0 | } |
453 | | |
454 | | explicit inline LifecycleGetCustomInterfaceCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& ) |
455 | | : CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
456 | 0 | { |
457 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
458 | 0 | } |
459 | | |
460 | | explicit inline LifecycleGetCustomInterfaceCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal) |
461 | | : CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal) |
462 | 0 | { |
463 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
464 | 0 | } |
465 | | |
466 | | explicit inline LifecycleGetCustomInterfaceCallback(CallbackFunction* aOther) |
467 | | : CallbackFunction(aOther) |
468 | 0 | { |
469 | 0 | } |
470 | | |
471 | | template <typename T> |
472 | | inline void |
473 | | Call(const T& thisVal, nsIJSID* iid, JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
474 | 0 | { |
475 | 0 | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
476 | 0 | if (!aExecutionReason) { |
477 | 0 | aExecutionReason = "LifecycleGetCustomInterfaceCallback"; |
478 | 0 | } |
479 | 0 | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
480 | 0 | if (!s.GetContext()) { |
481 | 0 | MOZ_ASSERT(aRv.Failed()); |
482 | 0 | return; |
483 | 0 | } |
484 | 0 | JS::Rooted<JS::Value> thisValJS(s.GetContext()); |
485 | 0 | if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) { |
486 | 0 | aRv.Throw(NS_ERROR_FAILURE); |
487 | 0 | return; |
488 | 0 | } |
489 | 0 | return Call(s.GetContext(), thisValJS, iid, aRetVal, aRv); |
490 | 0 | } |
491 | | |
492 | | inline void |
493 | | Call(nsIJSID* iid, JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
494 | 0 | { |
495 | 0 | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
496 | 0 | if (!aExecutionReason) { |
497 | 0 | aExecutionReason = "LifecycleGetCustomInterfaceCallback"; |
498 | 0 | } |
499 | 0 | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
500 | 0 | if (!s.GetContext()) { |
501 | 0 | MOZ_ASSERT(aRv.Failed()); |
502 | 0 | return; |
503 | 0 | } |
504 | 0 | return Call(s.GetContext(), JS::UndefinedHandleValue, iid, aRetVal, aRv); |
505 | 0 | } |
506 | | |
507 | | template <typename T> |
508 | | inline void |
509 | | Call(const T& thisVal, nsIJSID* iid, JS::MutableHandle<JSObject*> aRetVal, const char* aExecutionReason = nullptr) |
510 | 0 | { |
511 | 0 | return Call(thisVal, iid, aRetVal, IgnoreErrors(), aExecutionReason); |
512 | 0 | } |
513 | | |
514 | | inline void |
515 | | Call(nsIJSID* iid, JS::MutableHandle<JSObject*> aRetVal, const char* aExecutionReason = nullptr) |
516 | 0 | { |
517 | 0 | return Call(iid, aRetVal, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr); |
518 | 0 | } |
519 | | |
520 | | inline bool |
521 | | operator==(const LifecycleGetCustomInterfaceCallback& aOther) const |
522 | 0 | { |
523 | 0 | return CallbackFunction::operator==(aOther); |
524 | 0 | } |
525 | | |
526 | | private: |
527 | | void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, nsIJSID* iid, JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv); |
528 | | }; |
529 | | |
530 | | |
531 | | namespace binding_detail { |
532 | | class FastLifecycleConnectedCallback : public LifecycleConnectedCallback |
533 | | { |
534 | | public: |
535 | | explicit inline FastLifecycleConnectedCallback(JSObject* aCallback, JSObject* aCallbackGlobal) |
536 | | : LifecycleConnectedCallback(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
537 | 0 | { |
538 | 0 | } |
539 | | |
540 | | inline void |
541 | | Trace(JSTracer* aTracer) |
542 | 0 | { |
543 | 0 | LifecycleConnectedCallback::Trace(aTracer); |
544 | 0 | } |
545 | | |
546 | | inline void |
547 | | FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx) |
548 | 0 | { |
549 | 0 | LifecycleConnectedCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx); |
550 | 0 | } |
551 | | }; |
552 | | } // namespace binding_detail |
553 | | |
554 | | |
555 | | namespace binding_detail { |
556 | | class FastLifecycleDisconnectedCallback : public LifecycleDisconnectedCallback |
557 | | { |
558 | | public: |
559 | | explicit inline FastLifecycleDisconnectedCallback(JSObject* aCallback, JSObject* aCallbackGlobal) |
560 | | : LifecycleDisconnectedCallback(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
561 | 0 | { |
562 | 0 | } |
563 | | |
564 | | inline void |
565 | | Trace(JSTracer* aTracer) |
566 | 0 | { |
567 | 0 | LifecycleDisconnectedCallback::Trace(aTracer); |
568 | 0 | } |
569 | | |
570 | | inline void |
571 | | FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx) |
572 | 0 | { |
573 | 0 | LifecycleDisconnectedCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx); |
574 | 0 | } |
575 | | }; |
576 | | } // namespace binding_detail |
577 | | |
578 | | |
579 | | namespace binding_detail { |
580 | | class FastLifecycleAdoptedCallback : public LifecycleAdoptedCallback |
581 | | { |
582 | | public: |
583 | | explicit inline FastLifecycleAdoptedCallback(JSObject* aCallback, JSObject* aCallbackGlobal) |
584 | | : LifecycleAdoptedCallback(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
585 | 0 | { |
586 | 0 | } |
587 | | |
588 | | inline void |
589 | | Trace(JSTracer* aTracer) |
590 | 0 | { |
591 | 0 | LifecycleAdoptedCallback::Trace(aTracer); |
592 | 0 | } |
593 | | |
594 | | inline void |
595 | | FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx) |
596 | 0 | { |
597 | 0 | LifecycleAdoptedCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx); |
598 | 0 | } |
599 | | }; |
600 | | } // namespace binding_detail |
601 | | |
602 | | |
603 | | namespace binding_detail { |
604 | | class FastLifecycleAttributeChangedCallback : public LifecycleAttributeChangedCallback |
605 | | { |
606 | | public: |
607 | | explicit inline FastLifecycleAttributeChangedCallback(JSObject* aCallback, JSObject* aCallbackGlobal) |
608 | | : LifecycleAttributeChangedCallback(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
609 | 0 | { |
610 | 0 | } |
611 | | |
612 | | inline void |
613 | | Trace(JSTracer* aTracer) |
614 | 0 | { |
615 | 0 | LifecycleAttributeChangedCallback::Trace(aTracer); |
616 | 0 | } |
617 | | |
618 | | inline void |
619 | | FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx) |
620 | 0 | { |
621 | 0 | LifecycleAttributeChangedCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx); |
622 | 0 | } |
623 | | }; |
624 | | } // namespace binding_detail |
625 | | |
626 | | |
627 | | namespace binding_detail { |
628 | | class FastLifecycleGetCustomInterfaceCallback : public LifecycleGetCustomInterfaceCallback |
629 | | { |
630 | | public: |
631 | | explicit inline FastLifecycleGetCustomInterfaceCallback(JSObject* aCallback, JSObject* aCallbackGlobal) |
632 | | : LifecycleGetCustomInterfaceCallback(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
633 | 0 | { |
634 | 0 | } |
635 | | |
636 | | inline void |
637 | | Trace(JSTracer* aTracer) |
638 | 0 | { |
639 | 0 | LifecycleGetCustomInterfaceCallback::Trace(aTracer); |
640 | 0 | } |
641 | | |
642 | | inline void |
643 | | FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx) |
644 | 0 | { |
645 | 0 | LifecycleGetCustomInterfaceCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx); |
646 | 0 | } |
647 | | }; |
648 | | } // namespace binding_detail |
649 | | |
650 | | |
651 | | } // namespace dom |
652 | | } // namespace mozilla |
653 | | |
654 | | #endif // mozilla_dom_WebComponentsBinding_h |