/work/obj-fuzz/dist/include/mozilla/dom/PaymentRequestBinding.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM PaymentRequest.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #ifndef mozilla_dom_PaymentRequestBinding_h |
4 | | #define mozilla_dom_PaymentRequestBinding_h |
5 | | |
6 | | #include "GeckoProfiler.h" |
7 | | #include "PaymentRequestBinding.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/Nullable.h" |
13 | | #include "mozilla/dom/PrototypeList.h" |
14 | | |
15 | | namespace mozilla { |
16 | | namespace dom { |
17 | | |
18 | | struct AddressErrors; |
19 | | struct AddressErrorsAtoms; |
20 | | struct NativePropertyHooks; |
21 | | struct PayerErrorFields; |
22 | | struct PayerErrorFieldsAtoms; |
23 | | struct PaymentCurrencyAmount; |
24 | | struct PaymentCurrencyAmountAtoms; |
25 | | struct PaymentDetailsBaseAtoms; |
26 | | struct PaymentDetailsInitAtoms; |
27 | | struct PaymentDetailsModifier; |
28 | | struct PaymentDetailsModifierAtoms; |
29 | | struct PaymentDetailsUpdateAtoms; |
30 | | struct PaymentItem; |
31 | | struct PaymentItemAtoms; |
32 | | struct PaymentMethodDataAtoms; |
33 | | struct PaymentOptionsAtoms; |
34 | | class PaymentRequest; |
35 | | struct PaymentRequestAtoms; |
36 | | struct PaymentShippingOption; |
37 | | struct PaymentShippingOptionAtoms; |
38 | | struct PaymentValidationErrorsAtoms; |
39 | | class ProtoAndIfaceCache; |
40 | | |
41 | | } // namespace dom |
42 | | } // namespace mozilla |
43 | | |
44 | | namespace mozilla { |
45 | | namespace dom { |
46 | | |
47 | | enum class PaymentItemType : uint8_t { |
48 | | Tax, |
49 | | EndGuard_ |
50 | | }; |
51 | | |
52 | | namespace PaymentItemTypeValues { |
53 | | extern const EnumEntry strings[2]; |
54 | | } // namespace PaymentItemTypeValues |
55 | | |
56 | | bool |
57 | | ToJSValue(JSContext* aCx, PaymentItemType aArgument, JS::MutableHandle<JS::Value> aValue); |
58 | | |
59 | | |
60 | | enum class PaymentShippingType : uint8_t { |
61 | | Shipping, |
62 | | Delivery, |
63 | | Pickup, |
64 | | EndGuard_ |
65 | | }; |
66 | | |
67 | | namespace PaymentShippingTypeValues { |
68 | | extern const EnumEntry strings[4]; |
69 | | } // namespace PaymentShippingTypeValues |
70 | | |
71 | | bool |
72 | | ToJSValue(JSContext* aCx, PaymentShippingType aArgument, JS::MutableHandle<JS::Value> aValue); |
73 | | |
74 | | |
75 | | struct AddressErrors : public DictionaryBase |
76 | | { |
77 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mAddressLine; |
78 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mCity; |
79 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mCountry; |
80 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mDependentLocality; |
81 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mOrganization; |
82 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mPhone; |
83 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mPostalCode; |
84 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mRecipient; |
85 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mRegion; |
86 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mRegionCode; |
87 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mSortingCode; |
88 | | |
89 | | AddressErrors(); |
90 | | |
91 | | explicit inline AddressErrors(const FastDictionaryInitializer& ) |
92 | 0 | { |
93 | 0 | // Do nothing here; this is used by our "Fast" subclass |
94 | 0 | } |
95 | | |
96 | | explicit inline AddressErrors(const AddressErrors& aOther) |
97 | 0 | { |
98 | 0 | *this = aOther; |
99 | 0 | } |
100 | | |
101 | | bool |
102 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
103 | | |
104 | | bool |
105 | | Init(const nsAString& aJSON); |
106 | | |
107 | | bool |
108 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
109 | | |
110 | | bool |
111 | | ToJSON(nsAString& aJSON) const; |
112 | | |
113 | | void |
114 | | TraceDictionary(JSTracer* trc); |
115 | | |
116 | | AddressErrors& |
117 | | operator=(const AddressErrors& aOther); |
118 | | |
119 | | private: |
120 | | static bool |
121 | | InitIds(JSContext* cx, AddressErrorsAtoms* atomsCache); |
122 | | }; |
123 | | |
124 | | namespace binding_detail { |
125 | | struct FastAddressErrors : public AddressErrors |
126 | | { |
127 | | inline FastAddressErrors() |
128 | | : AddressErrors(FastDictionaryInitializer()) |
129 | 0 | { |
130 | 0 | // Doesn't matter what int we pass to the parent constructor |
131 | 0 | } |
132 | | }; |
133 | | } // namespace binding_detail |
134 | | |
135 | | |
136 | | struct PayerErrorFields : public DictionaryBase |
137 | | { |
138 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mEmail; |
139 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mName; |
140 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mPhone; |
141 | | |
142 | | PayerErrorFields(); |
143 | | |
144 | | explicit inline PayerErrorFields(const FastDictionaryInitializer& ) |
145 | 0 | { |
146 | 0 | // Do nothing here; this is used by our "Fast" subclass |
147 | 0 | } |
148 | | |
149 | | explicit inline PayerErrorFields(const PayerErrorFields& aOther) |
150 | 0 | { |
151 | 0 | *this = aOther; |
152 | 0 | } |
153 | | |
154 | | bool |
155 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
156 | | |
157 | | bool |
158 | | Init(const nsAString& aJSON); |
159 | | |
160 | | bool |
161 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
162 | | |
163 | | bool |
164 | | ToJSON(nsAString& aJSON) const; |
165 | | |
166 | | void |
167 | | TraceDictionary(JSTracer* trc); |
168 | | |
169 | | PayerErrorFields& |
170 | | operator=(const PayerErrorFields& aOther); |
171 | | |
172 | | private: |
173 | | static bool |
174 | | InitIds(JSContext* cx, PayerErrorFieldsAtoms* atomsCache); |
175 | | }; |
176 | | |
177 | | namespace binding_detail { |
178 | | struct FastPayerErrorFields : public PayerErrorFields |
179 | | { |
180 | | inline FastPayerErrorFields() |
181 | | : PayerErrorFields(FastDictionaryInitializer()) |
182 | 0 | { |
183 | 0 | // Doesn't matter what int we pass to the parent constructor |
184 | 0 | } |
185 | | }; |
186 | | } // namespace binding_detail |
187 | | |
188 | | |
189 | | struct PaymentCurrencyAmount : public DictionaryBase |
190 | | { |
191 | | MOZ_INIT_OUTSIDE_CTOR nsString mCurrency; |
192 | | MOZ_INIT_OUTSIDE_CTOR nsString mCurrencySystem; |
193 | | MOZ_INIT_OUTSIDE_CTOR nsString mValue; |
194 | | |
195 | | PaymentCurrencyAmount(); |
196 | | |
197 | | explicit inline PaymentCurrencyAmount(const FastDictionaryInitializer& ) |
198 | 0 | { |
199 | 0 | // Do nothing here; this is used by our "Fast" subclass |
200 | 0 | } |
201 | | |
202 | | explicit inline PaymentCurrencyAmount(const PaymentCurrencyAmount& aOther) |
203 | 0 | { |
204 | 0 | *this = aOther; |
205 | 0 | } |
206 | | |
207 | | bool |
208 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
209 | | |
210 | | bool |
211 | | Init(const nsAString& aJSON); |
212 | | |
213 | | bool |
214 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
215 | | |
216 | | bool |
217 | | ToJSON(nsAString& aJSON) const; |
218 | | |
219 | | void |
220 | | TraceDictionary(JSTracer* trc); |
221 | | |
222 | | PaymentCurrencyAmount& |
223 | | operator=(const PaymentCurrencyAmount& aOther); |
224 | | |
225 | | private: |
226 | | static bool |
227 | | InitIds(JSContext* cx, PaymentCurrencyAmountAtoms* atomsCache); |
228 | | }; |
229 | | |
230 | | namespace binding_detail { |
231 | | struct FastPaymentCurrencyAmount : public PaymentCurrencyAmount |
232 | | { |
233 | | inline FastPaymentCurrencyAmount() |
234 | | : PaymentCurrencyAmount(FastDictionaryInitializer()) |
235 | 0 | { |
236 | 0 | // Doesn't matter what int we pass to the parent constructor |
237 | 0 | } |
238 | | }; |
239 | | } // namespace binding_detail |
240 | | |
241 | | |
242 | | struct PaymentMethodData : public DictionaryBase |
243 | | { |
244 | | MOZ_INIT_OUTSIDE_CTOR Optional<JSObject*> mData; |
245 | | MOZ_INIT_OUTSIDE_CTOR nsString mSupportedMethods; |
246 | | |
247 | | PaymentMethodData(); |
248 | | |
249 | | explicit inline PaymentMethodData(const FastDictionaryInitializer& ) |
250 | 0 | { |
251 | 0 | // Do nothing here; this is used by our "Fast" subclass |
252 | 0 | } |
253 | | |
254 | | private: |
255 | | PaymentMethodData(const PaymentMethodData&) = delete; |
256 | | PaymentMethodData& operator=(const PaymentMethodData&) = delete; |
257 | | |
258 | | static bool |
259 | | InitIds(JSContext* cx, PaymentMethodDataAtoms* atomsCache); |
260 | | |
261 | | public: |
262 | | bool |
263 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
264 | | |
265 | | bool |
266 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
267 | | |
268 | | void |
269 | | TraceDictionary(JSTracer* trc); |
270 | | }; |
271 | | |
272 | | namespace binding_detail { |
273 | | struct FastPaymentMethodData : public PaymentMethodData |
274 | | { |
275 | | inline FastPaymentMethodData() |
276 | | : PaymentMethodData(FastDictionaryInitializer()) |
277 | 0 | { |
278 | 0 | // Doesn't matter what int we pass to the parent constructor |
279 | 0 | } |
280 | | }; |
281 | | } // namespace binding_detail |
282 | | |
283 | | |
284 | | struct PaymentOptions : public DictionaryBase |
285 | | { |
286 | | MOZ_INIT_OUTSIDE_CTOR bool mRequestPayerEmail; |
287 | | MOZ_INIT_OUTSIDE_CTOR bool mRequestPayerName; |
288 | | MOZ_INIT_OUTSIDE_CTOR bool mRequestPayerPhone; |
289 | | MOZ_INIT_OUTSIDE_CTOR bool mRequestShipping; |
290 | | MOZ_INIT_OUTSIDE_CTOR PaymentShippingType mShippingType; |
291 | | |
292 | | PaymentOptions(); |
293 | | |
294 | | explicit inline PaymentOptions(const FastDictionaryInitializer& ) |
295 | 0 | { |
296 | 0 | // Do nothing here; this is used by our "Fast" subclass |
297 | 0 | } |
298 | | |
299 | | explicit inline PaymentOptions(const PaymentOptions& aOther) |
300 | 0 | { |
301 | 0 | *this = aOther; |
302 | 0 | } |
303 | | |
304 | | bool |
305 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
306 | | |
307 | | bool |
308 | | Init(const nsAString& aJSON); |
309 | | |
310 | | bool |
311 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
312 | | |
313 | | bool |
314 | | ToJSON(nsAString& aJSON) const; |
315 | | |
316 | | void |
317 | | TraceDictionary(JSTracer* trc); |
318 | | |
319 | | PaymentOptions& |
320 | | operator=(const PaymentOptions& aOther); |
321 | | |
322 | | private: |
323 | | static bool |
324 | | InitIds(JSContext* cx, PaymentOptionsAtoms* atomsCache); |
325 | | }; |
326 | | |
327 | | namespace binding_detail { |
328 | | struct FastPaymentOptions : public PaymentOptions |
329 | | { |
330 | | inline FastPaymentOptions() |
331 | | : PaymentOptions(FastDictionaryInitializer()) |
332 | 0 | { |
333 | 0 | // Doesn't matter what int we pass to the parent constructor |
334 | 0 | } |
335 | | }; |
336 | | } // namespace binding_detail |
337 | | |
338 | | |
339 | | struct PaymentItem : public DictionaryBase |
340 | | { |
341 | | MOZ_INIT_OUTSIDE_CTOR PaymentCurrencyAmount mAmount; |
342 | | MOZ_INIT_OUTSIDE_CTOR nsString mLabel; |
343 | | MOZ_INIT_OUTSIDE_CTOR bool mPending; |
344 | | MOZ_INIT_OUTSIDE_CTOR Optional<PaymentItemType> mType; |
345 | | |
346 | | PaymentItem(); |
347 | | |
348 | | explicit inline PaymentItem(const FastDictionaryInitializer& ) |
349 | | : mAmount(FastDictionaryInitializer()) |
350 | 0 | { |
351 | 0 | // Do nothing here; this is used by our "Fast" subclass |
352 | 0 | } |
353 | | |
354 | | explicit inline PaymentItem(const PaymentItem& aOther) |
355 | | : mAmount(FastDictionaryInitializer()) |
356 | 0 | { |
357 | 0 | *this = aOther; |
358 | 0 | } |
359 | | |
360 | | bool |
361 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
362 | | |
363 | | bool |
364 | | Init(const nsAString& aJSON); |
365 | | |
366 | | bool |
367 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
368 | | |
369 | | bool |
370 | | ToJSON(nsAString& aJSON) const; |
371 | | |
372 | | void |
373 | | TraceDictionary(JSTracer* trc); |
374 | | |
375 | | PaymentItem& |
376 | | operator=(const PaymentItem& aOther); |
377 | | |
378 | | private: |
379 | | static bool |
380 | | InitIds(JSContext* cx, PaymentItemAtoms* atomsCache); |
381 | | }; |
382 | | |
383 | | namespace binding_detail { |
384 | | struct FastPaymentItem : public PaymentItem |
385 | | { |
386 | | inline FastPaymentItem() |
387 | | : PaymentItem(FastDictionaryInitializer()) |
388 | 0 | { |
389 | 0 | // Doesn't matter what int we pass to the parent constructor |
390 | 0 | } |
391 | | }; |
392 | | } // namespace binding_detail |
393 | | |
394 | | |
395 | | struct PaymentShippingOption : public DictionaryBase |
396 | | { |
397 | | MOZ_INIT_OUTSIDE_CTOR PaymentCurrencyAmount mAmount; |
398 | | MOZ_INIT_OUTSIDE_CTOR nsString mId; |
399 | | MOZ_INIT_OUTSIDE_CTOR nsString mLabel; |
400 | | MOZ_INIT_OUTSIDE_CTOR bool mSelected; |
401 | | |
402 | | PaymentShippingOption(); |
403 | | |
404 | | explicit inline PaymentShippingOption(const FastDictionaryInitializer& ) |
405 | | : mAmount(FastDictionaryInitializer()) |
406 | 0 | { |
407 | 0 | // Do nothing here; this is used by our "Fast" subclass |
408 | 0 | } |
409 | | |
410 | | explicit inline PaymentShippingOption(const PaymentShippingOption& aOther) |
411 | | : mAmount(FastDictionaryInitializer()) |
412 | 0 | { |
413 | 0 | *this = aOther; |
414 | 0 | } |
415 | | |
416 | | bool |
417 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
418 | | |
419 | | bool |
420 | | Init(const nsAString& aJSON); |
421 | | |
422 | | bool |
423 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
424 | | |
425 | | bool |
426 | | ToJSON(nsAString& aJSON) const; |
427 | | |
428 | | void |
429 | | TraceDictionary(JSTracer* trc); |
430 | | |
431 | | PaymentShippingOption& |
432 | | operator=(const PaymentShippingOption& aOther); |
433 | | |
434 | | private: |
435 | | static bool |
436 | | InitIds(JSContext* cx, PaymentShippingOptionAtoms* atomsCache); |
437 | | }; |
438 | | |
439 | | namespace binding_detail { |
440 | | struct FastPaymentShippingOption : public PaymentShippingOption |
441 | | { |
442 | | inline FastPaymentShippingOption() |
443 | | : PaymentShippingOption(FastDictionaryInitializer()) |
444 | 0 | { |
445 | 0 | // Doesn't matter what int we pass to the parent constructor |
446 | 0 | } |
447 | | }; |
448 | | } // namespace binding_detail |
449 | | |
450 | | |
451 | | struct PaymentValidationErrors : public DictionaryBase |
452 | | { |
453 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mError; |
454 | | MOZ_INIT_OUTSIDE_CTOR PayerErrorFields mPayer; |
455 | | MOZ_INIT_OUTSIDE_CTOR Optional<JSObject*> mPaymentMethod; |
456 | | MOZ_INIT_OUTSIDE_CTOR AddressErrors mShippingAddress; |
457 | | |
458 | | PaymentValidationErrors(); |
459 | | |
460 | | explicit inline PaymentValidationErrors(const FastDictionaryInitializer& ) |
461 | | : mPayer(FastDictionaryInitializer()), |
462 | | mShippingAddress(FastDictionaryInitializer()) |
463 | 0 | { |
464 | 0 | // Do nothing here; this is used by our "Fast" subclass |
465 | 0 | } |
466 | | |
467 | | private: |
468 | | PaymentValidationErrors(const PaymentValidationErrors&) = delete; |
469 | | PaymentValidationErrors& operator=(const PaymentValidationErrors&) = delete; |
470 | | |
471 | | static bool |
472 | | InitIds(JSContext* cx, PaymentValidationErrorsAtoms* atomsCache); |
473 | | |
474 | | public: |
475 | | bool |
476 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
477 | | |
478 | | bool |
479 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
480 | | |
481 | | void |
482 | | TraceDictionary(JSTracer* trc); |
483 | | }; |
484 | | |
485 | | namespace binding_detail { |
486 | | struct FastPaymentValidationErrors : public PaymentValidationErrors |
487 | | { |
488 | | inline FastPaymentValidationErrors() |
489 | | : PaymentValidationErrors(FastDictionaryInitializer()) |
490 | 0 | { |
491 | 0 | // Doesn't matter what int we pass to the parent constructor |
492 | 0 | } |
493 | | }; |
494 | | } // namespace binding_detail |
495 | | |
496 | | |
497 | | struct PaymentDetailsModifier : public DictionaryBase |
498 | | { |
499 | | MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<PaymentItem>> mAdditionalDisplayItems; |
500 | | MOZ_INIT_OUTSIDE_CTOR Optional<JSObject*> mData; |
501 | | MOZ_INIT_OUTSIDE_CTOR nsString mSupportedMethods; |
502 | | MOZ_INIT_OUTSIDE_CTOR PaymentItem mTotal; |
503 | | |
504 | | PaymentDetailsModifier(); |
505 | | |
506 | | explicit inline PaymentDetailsModifier(const FastDictionaryInitializer& ) |
507 | | : mTotal(FastDictionaryInitializer()) |
508 | 0 | { |
509 | 0 | // Do nothing here; this is used by our "Fast" subclass |
510 | 0 | } |
511 | | |
512 | | private: |
513 | | PaymentDetailsModifier(const PaymentDetailsModifier&) = delete; |
514 | | PaymentDetailsModifier& operator=(const PaymentDetailsModifier&) = delete; |
515 | | |
516 | | static bool |
517 | | InitIds(JSContext* cx, PaymentDetailsModifierAtoms* atomsCache); |
518 | | |
519 | | public: |
520 | | bool |
521 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
522 | | |
523 | | bool |
524 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
525 | | |
526 | | void |
527 | | TraceDictionary(JSTracer* trc); |
528 | | }; |
529 | | |
530 | | namespace binding_detail { |
531 | | struct FastPaymentDetailsModifier : public PaymentDetailsModifier |
532 | | { |
533 | | inline FastPaymentDetailsModifier() |
534 | | : PaymentDetailsModifier(FastDictionaryInitializer()) |
535 | 0 | { |
536 | 0 | // Doesn't matter what int we pass to the parent constructor |
537 | 0 | } |
538 | | }; |
539 | | } // namespace binding_detail |
540 | | |
541 | | |
542 | | struct PaymentDetailsBase : public DictionaryBase |
543 | | { |
544 | | MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<PaymentItem>> mDisplayItems; |
545 | | MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<PaymentDetailsModifier>> mModifiers; |
546 | | MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<PaymentShippingOption>> mShippingOptions; |
547 | | |
548 | | PaymentDetailsBase(); |
549 | | |
550 | | explicit inline PaymentDetailsBase(const FastDictionaryInitializer& ) |
551 | 0 | { |
552 | 0 | // Do nothing here; this is used by our "Fast" subclass |
553 | 0 | } |
554 | | |
555 | | private: |
556 | | PaymentDetailsBase(const PaymentDetailsBase&) = delete; |
557 | | PaymentDetailsBase& operator=(const PaymentDetailsBase&) = delete; |
558 | | |
559 | | static bool |
560 | | InitIds(JSContext* cx, PaymentDetailsBaseAtoms* atomsCache); |
561 | | |
562 | | public: |
563 | | bool |
564 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
565 | | |
566 | | bool |
567 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
568 | | |
569 | | void |
570 | | TraceDictionary(JSTracer* trc); |
571 | | }; |
572 | | |
573 | | namespace binding_detail { |
574 | | struct FastPaymentDetailsBase : public PaymentDetailsBase |
575 | | { |
576 | | inline FastPaymentDetailsBase() |
577 | | : PaymentDetailsBase(FastDictionaryInitializer()) |
578 | 0 | { |
579 | 0 | // Doesn't matter what int we pass to the parent constructor |
580 | 0 | } |
581 | | }; |
582 | | } // namespace binding_detail |
583 | | |
584 | | |
585 | | struct PaymentDetailsInit : public PaymentDetailsBase |
586 | | { |
587 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mId; |
588 | | MOZ_INIT_OUTSIDE_CTOR PaymentItem mTotal; |
589 | | |
590 | | PaymentDetailsInit(); |
591 | | |
592 | | explicit inline PaymentDetailsInit(const FastDictionaryInitializer& ) |
593 | | : PaymentDetailsBase(FastDictionaryInitializer()), |
594 | | mTotal(FastDictionaryInitializer()) |
595 | 0 | { |
596 | 0 | // Do nothing here; this is used by our "Fast" subclass |
597 | 0 | } |
598 | | |
599 | | private: |
600 | | PaymentDetailsInit(const PaymentDetailsInit&) = delete; |
601 | | PaymentDetailsInit& operator=(const PaymentDetailsInit&) = delete; |
602 | | |
603 | | static bool |
604 | | InitIds(JSContext* cx, PaymentDetailsInitAtoms* atomsCache); |
605 | | |
606 | | public: |
607 | | bool |
608 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
609 | | |
610 | | bool |
611 | | Init(const nsAString& aJSON); |
612 | | |
613 | | bool |
614 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
615 | | |
616 | | bool |
617 | | ToJSON(nsAString& aJSON) const; |
618 | | |
619 | | void |
620 | | TraceDictionary(JSTracer* trc); |
621 | | }; |
622 | | |
623 | | namespace binding_detail { |
624 | | struct FastPaymentDetailsInit : public PaymentDetailsInit |
625 | | { |
626 | | inline FastPaymentDetailsInit() |
627 | | : PaymentDetailsInit(FastDictionaryInitializer()) |
628 | 0 | { |
629 | 0 | // Doesn't matter what int we pass to the parent constructor |
630 | 0 | } |
631 | | }; |
632 | | } // namespace binding_detail |
633 | | |
634 | | |
635 | | struct PaymentDetailsUpdate : public PaymentDetailsBase |
636 | | { |
637 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mError; |
638 | | MOZ_INIT_OUTSIDE_CTOR PayerErrorFields mPayerErrors; |
639 | | MOZ_INIT_OUTSIDE_CTOR Optional<JSObject*> mPaymentMethodErrors; |
640 | | MOZ_INIT_OUTSIDE_CTOR AddressErrors mShippingAddressErrors; |
641 | | MOZ_INIT_OUTSIDE_CTOR PaymentItem mTotal; |
642 | | |
643 | | PaymentDetailsUpdate(); |
644 | | |
645 | | explicit inline PaymentDetailsUpdate(const FastDictionaryInitializer& ) |
646 | | : PaymentDetailsBase(FastDictionaryInitializer()), |
647 | | mPayerErrors(FastDictionaryInitializer()), |
648 | | mShippingAddressErrors(FastDictionaryInitializer()), |
649 | | mTotal(FastDictionaryInitializer()) |
650 | 0 | { |
651 | 0 | // Do nothing here; this is used by our "Fast" subclass |
652 | 0 | } |
653 | | |
654 | | private: |
655 | | PaymentDetailsUpdate(const PaymentDetailsUpdate&) = delete; |
656 | | PaymentDetailsUpdate& operator=(const PaymentDetailsUpdate&) = delete; |
657 | | |
658 | | static bool |
659 | | InitIds(JSContext* cx, PaymentDetailsUpdateAtoms* atomsCache); |
660 | | |
661 | | public: |
662 | | bool |
663 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
664 | | |
665 | | bool |
666 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
667 | | |
668 | | void |
669 | | TraceDictionary(JSTracer* trc); |
670 | | }; |
671 | | |
672 | | namespace binding_detail { |
673 | | struct FastPaymentDetailsUpdate : public PaymentDetailsUpdate |
674 | | { |
675 | | inline FastPaymentDetailsUpdate() |
676 | | : PaymentDetailsUpdate(FastDictionaryInitializer()) |
677 | 0 | { |
678 | 0 | // Doesn't matter what int we pass to the parent constructor |
679 | 0 | } |
680 | | }; |
681 | | } // namespace binding_detail |
682 | | |
683 | | |
684 | | namespace PaymentRequest_Binding { |
685 | | |
686 | | typedef mozilla::dom::PaymentRequest NativeType; |
687 | | |
688 | | bool |
689 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
690 | | |
691 | | const JSClass* |
692 | | GetJSClass(); |
693 | | |
694 | | bool |
695 | | Wrap(JSContext* aCx, mozilla::dom::PaymentRequest* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
696 | | |
697 | | template <class T> |
698 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
699 | 0 | { |
700 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
701 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
702 | 0 | } |
703 | | |
704 | | // We declare this as an array so that retrieving a pointer to this |
705 | | // binding's property hooks only requires compile/link-time resolvable |
706 | | // address arithmetic. Declaring it as a pointer instead would require |
707 | | // doing a run-time load to fetch a pointer to this binding's property |
708 | | // hooks. And then structures which embedded a pointer to this structure |
709 | | // would require a run-time load for proper initialization, which would |
710 | | // then induce static constructors. Lots of static constructors. |
711 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
712 | | |
713 | | void |
714 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
715 | | |
716 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
717 | 0 | { |
718 | 0 | /* Get the interface prototype object for this class. This will create the |
719 | 0 | object as needed. */ |
720 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::PaymentRequest, |
721 | 0 | &CreateInterfaceObjects, |
722 | 0 | /* aDefineOnGlobal = */ true); |
723 | 0 |
|
724 | 0 | } |
725 | | |
726 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
727 | 0 | { |
728 | 0 | /* Get the interface object for this class. This will create the object as |
729 | 0 | needed. */ |
730 | 0 |
|
731 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::PaymentRequest, |
732 | 0 | &CreateInterfaceObjects, |
733 | 0 | aDefineOnGlobal); |
734 | 0 | } |
735 | | |
736 | | JSObject* |
737 | | GetConstructorObject(JSContext* aCx); |
738 | | |
739 | | } // namespace PaymentRequest_Binding |
740 | | |
741 | | |
742 | | |
743 | | } // namespace dom |
744 | | } // namespace mozilla |
745 | | |
746 | | #endif // mozilla_dom_PaymentRequestBinding_h |