LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dom/bindings - PaymentAddressBinding.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 278 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 25 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM PaymentAddress.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "PaymentAddressBinding.h"
       4             : #include "WrapperFactory.h"
       5             : #include "XrayWrapper.h"
       6             : #include "mozilla/OwningNonNull.h"
       7             : #include "mozilla/dom/BindingUtils.h"
       8             : #include "mozilla/dom/DOMJSClass.h"
       9             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      10             : #include "mozilla/dom/PaymentAddress.h"
      11             : #include "mozilla/dom/PaymentRequest.h"
      12             : #include "mozilla/dom/XrayExpandoClass.h"
      13             : 
      14             : namespace mozilla {
      15             : namespace dom {
      16             : 
      17             : namespace PaymentAddressBinding {
      18             : 
      19             : static bool
      20           0 : get_country(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PaymentAddress* self, JSJitGetterCallArgs args)
      21             : {
      22           0 :   DOMString result;
      23           0 :   self->GetCountry(result);
      24           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      25           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
      26           0 :     return false;
      27             :   }
      28           0 :   return true;
      29             : }
      30             : 
      31             : static const JSJitInfo country_getterinfo = {
      32             :   { (JSJitGetterOp)get_country },
      33             :   { prototypes::id::PaymentAddress },
      34             :   { PrototypeTraits<prototypes::id::PaymentAddress>::Depth },
      35             :   JSJitInfo::Getter,
      36             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      37             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
      38             :   false,  /* isInfallible. False in setters. */
      39             :   false,  /* isMovable.  Not relevant for setters. */
      40             :   false, /* isEliminatable.  Not relevant for setters. */
      41             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      42             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      43             :   false,  /* isTypedMethod.  Only relevant for methods. */
      44             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      45             : };
      46             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      47             : static_assert(0 < 2, "There is no slot for us");
      48             : 
      49             : static bool
      50           0 : get_addressLine(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PaymentAddress* self, JSJitGetterCallArgs args)
      51             : {
      52             :   // Have to either root across the getter call or reget after.
      53             :   bool isXray;
      54           0 :   JS::Rooted<JSObject*> slotStorage(cx, GetCachedSlotStorageObject(cx, obj, &isXray));
      55           0 :   if (!slotStorage) {
      56           0 :     return false;
      57             :   }
      58           0 :   const size_t slotIndex = isXray ? (xpc::JSSLOT_EXPANDO_COUNT + 0) : (DOM_INSTANCE_RESERVED_SLOTS + 0);
      59           0 :   MOZ_ASSERT(JSCLASS_RESERVED_SLOTS(js::GetObjectClass(slotStorage)) > slotIndex);
      60             :   {
      61             :     // Scope for cachedVal
      62           0 :     JS::Value cachedVal = js::GetReservedSlot(slotStorage, slotIndex);
      63           0 :     if (!cachedVal.isUndefined()) {
      64           0 :       args.rval().set(cachedVal);
      65             :       // The cached value is in the compartment of slotStorage,
      66             :       // so wrap into the caller compartment as needed.
      67           0 :       return MaybeWrapNonDOMObjectValue(cx, args.rval());
      68             :     }
      69             :   }
      70             : 
      71           0 :   nsTArray<nsString> result;
      72           0 :   self->GetAddressLine(result);
      73           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      74             :   {
      75           0 :     JS::Rooted<JSObject*> conversionScope(cx, isXray ? obj : slotStorage);
      76           0 :     JSAutoCompartment ac(cx, conversionScope);
      77             :     do { // block we break out of when done wrapping
      78             : 
      79           0 :       uint32_t length = result.Length();
      80           0 :       JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
      81           0 :       if (!returnArray) {
      82           0 :         return false;
      83             :       }
      84             :       // Scope for 'tmp'
      85             :       {
      86           0 :         JS::Rooted<JS::Value> tmp(cx);
      87           0 :         for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
      88             :           // Control block to let us common up the JS_DefineElement calls when there
      89             :           // are different ways to succeed at wrapping the object.
      90             :           do {
      91           0 :             if (!xpc::NonVoidStringToJsval(cx, result[sequenceIdx0], &tmp)) {
      92           0 :               return false;
      93             :             }
      94           0 :             break;
      95             :           } while (0);
      96           0 :           if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
      97             :                                 JSPROP_ENUMERATE)) {
      98           0 :             return false;
      99             :           }
     100             :         }
     101             :       }
     102           0 :       args.rval().setObject(*returnArray);
     103           0 :       break;
     104             :     } while (0);
     105           0 :     JS::Rooted<JSObject*> rvalObj(cx, &args.rval().toObject());
     106           0 :     if (!JS_FreezeObject(cx, rvalObj)) {
     107           0 :       return false;
     108             :     }
     109             :   }
     110             :   { // And now store things in the compartment of our slotStorage.
     111           0 :     JSAutoCompartment ac(cx, slotStorage);
     112             :     // Make a copy so that we don't do unnecessary wrapping on args.rval().
     113           0 :     JS::Rooted<JS::Value> storedVal(cx, args.rval());
     114           0 :     if (!MaybeWrapNonDOMObjectValue(cx, &storedVal)) {
     115           0 :       return false;
     116             :     }
     117           0 :     js::SetReservedSlot(slotStorage, slotIndex, storedVal);
     118           0 :     if (!isXray) {
     119             :       // In the Xray case we don't need to do this, because getting the
     120             :       // expando object already preserved our wrapper.
     121           0 :       PreserveWrapper(self);
     122             :     }
     123             :   }
     124             :   // And now make sure args.rval() is in the caller compartment
     125           0 :   return MaybeWrapNonDOMObjectValue(cx, args.rval());
     126             : }
     127             : 
     128             : static const JSJitInfo addressLine_getterinfo = {
     129             :   { (JSJitGetterOp)get_addressLine },
     130             :   { prototypes::id::PaymentAddress },
     131             :   { PrototypeTraits<prototypes::id::PaymentAddress>::Depth },
     132             :   JSJitInfo::Getter,
     133             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     134             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     135             :   false,  /* isInfallible. False in setters. */
     136             :   true,  /* isMovable.  Not relevant for setters. */
     137             :   true, /* isEliminatable.  Not relevant for setters. */
     138             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     139             :   true, /* isLazilyCachedInSlot.  Only relevant for getters. */
     140             :   false,  /* isTypedMethod.  Only relevant for methods. */
     141             :   (DOM_INSTANCE_RESERVED_SLOTS + 0)   /* Reserved slot index, if we're stored in a slot, else 0. */
     142             : };
     143             : static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) <= JSJitInfo::maxSlotIndex, "We won't fit");
     144             : static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) < 2, "There is no slot for us");
     145             : 
     146             : static bool
     147           0 : get_region(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PaymentAddress* self, JSJitGetterCallArgs args)
     148             : {
     149           0 :   DOMString result;
     150           0 :   self->GetRegion(result);
     151           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     152           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     153           0 :     return false;
     154             :   }
     155           0 :   return true;
     156             : }
     157             : 
     158             : static const JSJitInfo region_getterinfo = {
     159             :   { (JSJitGetterOp)get_region },
     160             :   { prototypes::id::PaymentAddress },
     161             :   { PrototypeTraits<prototypes::id::PaymentAddress>::Depth },
     162             :   JSJitInfo::Getter,
     163             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     164             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     165             :   false,  /* isInfallible. False in setters. */
     166             :   false,  /* isMovable.  Not relevant for setters. */
     167             :   false, /* isEliminatable.  Not relevant for setters. */
     168             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     169             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     170             :   false,  /* isTypedMethod.  Only relevant for methods. */
     171             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     172             : };
     173             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     174             : static_assert(0 < 2, "There is no slot for us");
     175             : 
     176             : static bool
     177           0 : get_city(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PaymentAddress* self, JSJitGetterCallArgs args)
     178             : {
     179           0 :   DOMString result;
     180           0 :   self->GetCity(result);
     181           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     182           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     183           0 :     return false;
     184             :   }
     185           0 :   return true;
     186             : }
     187             : 
     188             : static const JSJitInfo city_getterinfo = {
     189             :   { (JSJitGetterOp)get_city },
     190             :   { prototypes::id::PaymentAddress },
     191             :   { PrototypeTraits<prototypes::id::PaymentAddress>::Depth },
     192             :   JSJitInfo::Getter,
     193             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     194             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     195             :   false,  /* isInfallible. False in setters. */
     196             :   false,  /* isMovable.  Not relevant for setters. */
     197             :   false, /* isEliminatable.  Not relevant for setters. */
     198             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     199             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     200             :   false,  /* isTypedMethod.  Only relevant for methods. */
     201             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     202             : };
     203             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     204             : static_assert(0 < 2, "There is no slot for us");
     205             : 
     206             : static bool
     207           0 : get_dependentLocality(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PaymentAddress* self, JSJitGetterCallArgs args)
     208             : {
     209           0 :   DOMString result;
     210           0 :   self->GetDependentLocality(result);
     211           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     212           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     213           0 :     return false;
     214             :   }
     215           0 :   return true;
     216             : }
     217             : 
     218             : static const JSJitInfo dependentLocality_getterinfo = {
     219             :   { (JSJitGetterOp)get_dependentLocality },
     220             :   { prototypes::id::PaymentAddress },
     221             :   { PrototypeTraits<prototypes::id::PaymentAddress>::Depth },
     222             :   JSJitInfo::Getter,
     223             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     224             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     225             :   false,  /* isInfallible. False in setters. */
     226             :   false,  /* isMovable.  Not relevant for setters. */
     227             :   false, /* isEliminatable.  Not relevant for setters. */
     228             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     229             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     230             :   false,  /* isTypedMethod.  Only relevant for methods. */
     231             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     232             : };
     233             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     234             : static_assert(0 < 2, "There is no slot for us");
     235             : 
     236             : static bool
     237           0 : get_postalCode(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PaymentAddress* self, JSJitGetterCallArgs args)
     238             : {
     239           0 :   DOMString result;
     240           0 :   self->GetPostalCode(result);
     241           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     242           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     243           0 :     return false;
     244             :   }
     245           0 :   return true;
     246             : }
     247             : 
     248             : static const JSJitInfo postalCode_getterinfo = {
     249             :   { (JSJitGetterOp)get_postalCode },
     250             :   { prototypes::id::PaymentAddress },
     251             :   { PrototypeTraits<prototypes::id::PaymentAddress>::Depth },
     252             :   JSJitInfo::Getter,
     253             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     254             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     255             :   false,  /* isInfallible. False in setters. */
     256             :   false,  /* isMovable.  Not relevant for setters. */
     257             :   false, /* isEliminatable.  Not relevant for setters. */
     258             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     259             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     260             :   false,  /* isTypedMethod.  Only relevant for methods. */
     261             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     262             : };
     263             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     264             : static_assert(0 < 2, "There is no slot for us");
     265             : 
     266             : static bool
     267           0 : get_sortingCode(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PaymentAddress* self, JSJitGetterCallArgs args)
     268             : {
     269           0 :   DOMString result;
     270           0 :   self->GetSortingCode(result);
     271           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     272           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     273           0 :     return false;
     274             :   }
     275           0 :   return true;
     276             : }
     277             : 
     278             : static const JSJitInfo sortingCode_getterinfo = {
     279             :   { (JSJitGetterOp)get_sortingCode },
     280             :   { prototypes::id::PaymentAddress },
     281             :   { PrototypeTraits<prototypes::id::PaymentAddress>::Depth },
     282             :   JSJitInfo::Getter,
     283             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     284             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     285             :   false,  /* isInfallible. False in setters. */
     286             :   false,  /* isMovable.  Not relevant for setters. */
     287             :   false, /* isEliminatable.  Not relevant for setters. */
     288             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     289             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     290             :   false,  /* isTypedMethod.  Only relevant for methods. */
     291             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     292             : };
     293             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     294             : static_assert(0 < 2, "There is no slot for us");
     295             : 
     296             : static bool
     297           0 : get_languageCode(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PaymentAddress* self, JSJitGetterCallArgs args)
     298             : {
     299           0 :   DOMString result;
     300           0 :   self->GetLanguageCode(result);
     301           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     302           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     303           0 :     return false;
     304             :   }
     305           0 :   return true;
     306             : }
     307             : 
     308             : static const JSJitInfo languageCode_getterinfo = {
     309             :   { (JSJitGetterOp)get_languageCode },
     310             :   { prototypes::id::PaymentAddress },
     311             :   { PrototypeTraits<prototypes::id::PaymentAddress>::Depth },
     312             :   JSJitInfo::Getter,
     313             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     314             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     315             :   false,  /* isInfallible. False in setters. */
     316             :   false,  /* isMovable.  Not relevant for setters. */
     317             :   false, /* isEliminatable.  Not relevant for setters. */
     318             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     319             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     320             :   false,  /* isTypedMethod.  Only relevant for methods. */
     321             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     322             : };
     323             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     324             : static_assert(0 < 2, "There is no slot for us");
     325             : 
     326             : static bool
     327           0 : get_organization(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PaymentAddress* self, JSJitGetterCallArgs args)
     328             : {
     329           0 :   DOMString result;
     330           0 :   self->GetOrganization(result);
     331           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     332           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     333           0 :     return false;
     334             :   }
     335           0 :   return true;
     336             : }
     337             : 
     338             : static const JSJitInfo organization_getterinfo = {
     339             :   { (JSJitGetterOp)get_organization },
     340             :   { prototypes::id::PaymentAddress },
     341             :   { PrototypeTraits<prototypes::id::PaymentAddress>::Depth },
     342             :   JSJitInfo::Getter,
     343             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     344             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     345             :   false,  /* isInfallible. False in setters. */
     346             :   false,  /* isMovable.  Not relevant for setters. */
     347             :   false, /* isEliminatable.  Not relevant for setters. */
     348             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     349             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     350             :   false,  /* isTypedMethod.  Only relevant for methods. */
     351             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     352             : };
     353             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     354             : static_assert(0 < 2, "There is no slot for us");
     355             : 
     356             : static bool
     357           0 : get_recipient(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PaymentAddress* self, JSJitGetterCallArgs args)
     358             : {
     359           0 :   DOMString result;
     360           0 :   self->GetRecipient(result);
     361           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     362           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     363           0 :     return false;
     364             :   }
     365           0 :   return true;
     366             : }
     367             : 
     368             : static const JSJitInfo recipient_getterinfo = {
     369             :   { (JSJitGetterOp)get_recipient },
     370             :   { prototypes::id::PaymentAddress },
     371             :   { PrototypeTraits<prototypes::id::PaymentAddress>::Depth },
     372             :   JSJitInfo::Getter,
     373             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     374             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     375             :   false,  /* isInfallible. False in setters. */
     376             :   false,  /* isMovable.  Not relevant for setters. */
     377             :   false, /* isEliminatable.  Not relevant for setters. */
     378             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     379             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     380             :   false,  /* isTypedMethod.  Only relevant for methods. */
     381             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     382             : };
     383             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     384             : static_assert(0 < 2, "There is no slot for us");
     385             : 
     386             : static bool
     387           0 : get_phone(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PaymentAddress* self, JSJitGetterCallArgs args)
     388             : {
     389           0 :   DOMString result;
     390           0 :   self->GetPhone(result);
     391           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     392           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     393           0 :     return false;
     394             :   }
     395           0 :   return true;
     396             : }
     397             : 
     398             : static const JSJitInfo phone_getterinfo = {
     399             :   { (JSJitGetterOp)get_phone },
     400             :   { prototypes::id::PaymentAddress },
     401             :   { PrototypeTraits<prototypes::id::PaymentAddress>::Depth },
     402             :   JSJitInfo::Getter,
     403             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     404             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     405             :   false,  /* isInfallible. False in setters. */
     406             :   false,  /* isMovable.  Not relevant for setters. */
     407             :   false, /* isEliminatable.  Not relevant for setters. */
     408             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     409             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     410             :   false,  /* isTypedMethod.  Only relevant for methods. */
     411             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     412             : };
     413             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     414             : static_assert(0 < 2, "There is no slot for us");
     415             : 
     416             : bool
     417           0 : JsonifyAttributes(JSContext* aCx, JS::Handle<JSObject*> obj, mozilla::dom::PaymentAddress* self, JS::Rooted<JSObject*>& aResult)
     418             : {
     419             :   { // scope for "temp"
     420           0 :     JS::Rooted<JS::Value> temp(aCx);
     421           0 :     if (!get_country(aCx, obj, self, JSJitGetterCallArgs(&temp))) {
     422           0 :       return false;
     423             :     }
     424           0 :     if (!JS_DefineProperty(aCx, aResult, "country", temp, JSPROP_ENUMERATE)) {
     425           0 :       return false;
     426             :     }
     427             :   }
     428             :   { // scope for "temp"
     429           0 :     JS::Rooted<JS::Value> temp(aCx);
     430           0 :     if (!get_addressLine(aCx, obj, self, JSJitGetterCallArgs(&temp))) {
     431           0 :       return false;
     432             :     }
     433           0 :     if (!JS_DefineProperty(aCx, aResult, "addressLine", temp, JSPROP_ENUMERATE)) {
     434           0 :       return false;
     435             :     }
     436             :   }
     437             :   { // scope for "temp"
     438           0 :     JS::Rooted<JS::Value> temp(aCx);
     439           0 :     if (!get_region(aCx, obj, self, JSJitGetterCallArgs(&temp))) {
     440           0 :       return false;
     441             :     }
     442           0 :     if (!JS_DefineProperty(aCx, aResult, "region", temp, JSPROP_ENUMERATE)) {
     443           0 :       return false;
     444             :     }
     445             :   }
     446             :   { // scope for "temp"
     447           0 :     JS::Rooted<JS::Value> temp(aCx);
     448           0 :     if (!get_city(aCx, obj, self, JSJitGetterCallArgs(&temp))) {
     449           0 :       return false;
     450             :     }
     451           0 :     if (!JS_DefineProperty(aCx, aResult, "city", temp, JSPROP_ENUMERATE)) {
     452           0 :       return false;
     453             :     }
     454             :   }
     455             :   { // scope for "temp"
     456           0 :     JS::Rooted<JS::Value> temp(aCx);
     457           0 :     if (!get_dependentLocality(aCx, obj, self, JSJitGetterCallArgs(&temp))) {
     458           0 :       return false;
     459             :     }
     460           0 :     if (!JS_DefineProperty(aCx, aResult, "dependentLocality", temp, JSPROP_ENUMERATE)) {
     461           0 :       return false;
     462             :     }
     463             :   }
     464             :   { // scope for "temp"
     465           0 :     JS::Rooted<JS::Value> temp(aCx);
     466           0 :     if (!get_postalCode(aCx, obj, self, JSJitGetterCallArgs(&temp))) {
     467           0 :       return false;
     468             :     }
     469           0 :     if (!JS_DefineProperty(aCx, aResult, "postalCode", temp, JSPROP_ENUMERATE)) {
     470           0 :       return false;
     471             :     }
     472             :   }
     473             :   { // scope for "temp"
     474           0 :     JS::Rooted<JS::Value> temp(aCx);
     475           0 :     if (!get_sortingCode(aCx, obj, self, JSJitGetterCallArgs(&temp))) {
     476           0 :       return false;
     477             :     }
     478           0 :     if (!JS_DefineProperty(aCx, aResult, "sortingCode", temp, JSPROP_ENUMERATE)) {
     479           0 :       return false;
     480             :     }
     481             :   }
     482             :   { // scope for "temp"
     483           0 :     JS::Rooted<JS::Value> temp(aCx);
     484           0 :     if (!get_languageCode(aCx, obj, self, JSJitGetterCallArgs(&temp))) {
     485           0 :       return false;
     486             :     }
     487           0 :     if (!JS_DefineProperty(aCx, aResult, "languageCode", temp, JSPROP_ENUMERATE)) {
     488           0 :       return false;
     489             :     }
     490             :   }
     491             :   { // scope for "temp"
     492           0 :     JS::Rooted<JS::Value> temp(aCx);
     493           0 :     if (!get_organization(aCx, obj, self, JSJitGetterCallArgs(&temp))) {
     494           0 :       return false;
     495             :     }
     496           0 :     if (!JS_DefineProperty(aCx, aResult, "organization", temp, JSPROP_ENUMERATE)) {
     497           0 :       return false;
     498             :     }
     499             :   }
     500             :   { // scope for "temp"
     501           0 :     JS::Rooted<JS::Value> temp(aCx);
     502           0 :     if (!get_recipient(aCx, obj, self, JSJitGetterCallArgs(&temp))) {
     503           0 :       return false;
     504             :     }
     505           0 :     if (!JS_DefineProperty(aCx, aResult, "recipient", temp, JSPROP_ENUMERATE)) {
     506           0 :       return false;
     507             :     }
     508             :   }
     509             :   { // scope for "temp"
     510           0 :     JS::Rooted<JS::Value> temp(aCx);
     511           0 :     if (!get_phone(aCx, obj, self, JSJitGetterCallArgs(&temp))) {
     512           0 :       return false;
     513             :     }
     514           0 :     if (!JS_DefineProperty(aCx, aResult, "phone", temp, JSPROP_ENUMERATE)) {
     515           0 :       return false;
     516             :     }
     517             :   }
     518           0 :   return true;
     519             : }
     520             : 
     521             : static bool
     522           0 : __jsonifier(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PaymentAddress* self, const JSJitMethodCallArgs& args)
     523             : {
     524           0 :   JS::Rooted<JSObject*> result(cx, JS_NewPlainObject(cx));
     525           0 :   if (!result) {
     526           0 :     return false;
     527             :   }
     528           0 :   if (!PaymentAddressBinding::JsonifyAttributes(cx, obj, self, result)) {
     529           0 :     return false;
     530             :   }
     531           0 :   args.rval().setObject(*result);
     532           0 :   return true;
     533             : }
     534             : 
     535             : static const JSJitInfo __jsonifier_methodinfo = {
     536             :   { (JSJitGetterOp)__jsonifier },
     537             :   { prototypes::id::PaymentAddress },
     538             :   { PrototypeTraits<prototypes::id::PaymentAddress>::Depth },
     539             :   JSJitInfo::Method,
     540             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     541             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     542             :   false,  /* isInfallible. False in setters. */
     543             :   false,  /* isMovable.  Not relevant for setters. */
     544             :   false, /* isEliminatable.  Not relevant for setters. */
     545             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     546             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     547             :   false,  /* isTypedMethod.  Only relevant for methods. */
     548             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     549             : };
     550             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     551             : static_assert(0 < 2, "There is no slot for us");
     552             : 
     553             : static bool
     554           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
     555             : {
     556           0 :   mozilla::dom::PaymentAddress* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::PaymentAddress>(obj);
     557             :   // We don't want to preserve if we don't have a wrapper, and we
     558             :   // obviously can't preserve if we're not initialized.
     559           0 :   if (self && self->GetWrapperPreserveColor()) {
     560           0 :     PreserveWrapper(self);
     561             :   }
     562           0 :   return true;
     563             : }
     564             : 
     565             : static void
     566           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     567             : {
     568           0 :   mozilla::dom::PaymentAddress* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::PaymentAddress>(obj);
     569           0 :   if (self) {
     570           0 :     ClearWrapper(self, self, obj);
     571           0 :     AddForDeferredFinalization<mozilla::dom::PaymentAddress>(self);
     572             :   }
     573           0 : }
     574             : 
     575             : static void
     576           0 : _objectMoved(JSObject* obj, const JSObject* old)
     577             : {
     578           0 :   mozilla::dom::PaymentAddress* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::PaymentAddress>(obj);
     579           0 :   if (self) {
     580           0 :     UpdateWrapper(self, self, obj, old);
     581             :   }
     582           0 : }
     583             : 
     584             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     585             : #if defined(__clang__)
     586             : #pragma clang diagnostic push
     587             : #pragma clang diagnostic ignored "-Wmissing-braces"
     588             : #endif
     589             : static const JSFunctionSpec sMethods_specs[] = {
     590             :   JS_FNSPEC("toJSON", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&__jsonifier_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
     591             :   JS_FS_END
     592             : };
     593             : #if defined(__clang__)
     594             : #pragma clang diagnostic pop
     595             : #endif
     596             : 
     597             : static PrefableDisablers sMethods_disablers0 = {
     598             :   true, true, 0, nullptr
     599             : };
     600             : 
     601             : // Can't be const because the pref-enabled boolean needs to be writable
     602             : static Prefable<const JSFunctionSpec> sMethods[] = {
     603             :   { &sMethods_disablers0, &sMethods_specs[0] },
     604             :   { nullptr, nullptr }
     605             : };
     606             : 
     607             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     608             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     609             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     610             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     611             : 
     612             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     613             : #if defined(__clang__)
     614             : #pragma clang diagnostic push
     615             : #pragma clang diagnostic ignored "-Wmissing-braces"
     616             : #endif
     617             : static const JSPropertySpec sAttributes_specs[] = {
     618             :   { "country", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &country_getterinfo, nullptr, nullptr },
     619             :   { "addressLine", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &addressLine_getterinfo, nullptr, nullptr },
     620             :   { "region", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &region_getterinfo, nullptr, nullptr },
     621             :   { "city", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &city_getterinfo, nullptr, nullptr },
     622             :   { "dependentLocality", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &dependentLocality_getterinfo, nullptr, nullptr },
     623             :   { "postalCode", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &postalCode_getterinfo, nullptr, nullptr },
     624             :   { "sortingCode", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &sortingCode_getterinfo, nullptr, nullptr },
     625             :   { "languageCode", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &languageCode_getterinfo, nullptr, nullptr },
     626             :   { "organization", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &organization_getterinfo, nullptr, nullptr },
     627             :   { "recipient", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &recipient_getterinfo, nullptr, nullptr },
     628             :   { "phone", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &phone_getterinfo, nullptr, nullptr },
     629             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     630             : };
     631             : #if defined(__clang__)
     632             : #pragma clang diagnostic pop
     633             : #endif
     634             : 
     635             : static PrefableDisablers sAttributes_disablers0 = {
     636             :   true, true, 0, nullptr
     637             : };
     638             : 
     639             : // Can't be const because the pref-enabled boolean needs to be writable
     640             : static Prefable<const JSPropertySpec> sAttributes[] = {
     641             :   { &sAttributes_disablers0, &sAttributes_specs[0] },
     642             :   { nullptr, nullptr }
     643             : };
     644             : 
     645             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     646             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     647             : static_assert(11 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     648             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     649             : 
     650             : 
     651             : static uint16_t sNativeProperties_sortedPropertyIndices[12];
     652             : static PropertyInfo sNativeProperties_propertyInfos[12];
     653             : 
     654             : static const NativePropertiesN<2> sNativeProperties = {
     655             :   false, 0,
     656             :   false, 0,
     657             :   true,  0 /* sMethods */,
     658             :   true,  1 /* sAttributes */,
     659             :   false, 0,
     660             :   false, 0,
     661             :   false, 0,
     662             :   -1,
     663             :   12,
     664             :   sNativeProperties_sortedPropertyIndices,
     665             :   {
     666             :     { sMethods, &sNativeProperties_propertyInfos[0] },
     667             :     { sAttributes, &sNativeProperties_propertyInfos[1] }
     668             :   }
     669             : };
     670             : static_assert(12 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     671             :     "We have a property info count that is oversized");
     672             : 
     673             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     674             :   {
     675             :     "Function",
     676             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     677             :     &sBoringInterfaceObjectClassClassOps,
     678             :     JS_NULL_CLASS_SPEC,
     679             :     JS_NULL_CLASS_EXT,
     680             :     &sInterfaceObjectClassObjectOps
     681             :   },
     682             :   eInterface,
     683             :   true,
     684             :   prototypes::id::PaymentAddress,
     685             :   PrototypeTraits<prototypes::id::PaymentAddress>::Depth,
     686             :   sNativePropertyHooks,
     687             :   "function PaymentAddress() {\n    [native code]\n}",
     688             :   JS::GetRealmFunctionPrototype
     689             : };
     690             : 
     691             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     692             :   {
     693             :     "PaymentAddressPrototype",
     694             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     695             :     JS_NULL_CLASS_OPS,
     696             :     JS_NULL_CLASS_SPEC,
     697             :     JS_NULL_CLASS_EXT,
     698             :     JS_NULL_OBJECT_OPS
     699             :   },
     700             :   eInterfacePrototype,
     701             :   false,
     702             :   prototypes::id::PaymentAddress,
     703             :   PrototypeTraits<prototypes::id::PaymentAddress>::Depth,
     704             :   sNativePropertyHooks,
     705             :   "[object PaymentAddressPrototype]",
     706             :   JS::GetRealmObjectPrototype
     707             : };
     708             : 
     709             : bool
     710           0 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
     711             : {
     712           0 :   return mozilla::dom::PaymentRequest::PrefEnabled(aCx, aObj) &&
     713           0 :          mozilla::dom::IsSecureContextOrObjectIsFromSecureContext(aCx, aObj);
     714             : }
     715             : 
     716             : JSObject*
     717           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     718             : {
     719           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     720             : }
     721             : 
     722             : static const js::ClassOps sClassOps = {
     723             :   _addProperty, /* addProperty */
     724             :   nullptr,               /* delProperty */
     725             :   nullptr,               /* getProperty */
     726             :   nullptr,               /* setProperty */
     727             :   nullptr,               /* enumerate */
     728             :   nullptr, /* newEnumerate */
     729             :   nullptr, /* resolve */
     730             :   nullptr, /* mayResolve */
     731             :   _finalize, /* finalize */
     732             :   nullptr, /* call */
     733             :   nullptr,               /* hasInstance */
     734             :   nullptr,               /* construct */
     735             :   nullptr, /* trace */
     736             : };
     737             : 
     738             : static const js::ClassExtension sClassExtension = {
     739             :   nullptr, /* weakmapKeyDelegateOp */
     740             :   _objectMoved /* objectMovedOp */
     741             : };
     742             : 
     743             : static const DOMJSClass sClass = {
     744             :   { "PaymentAddress",
     745             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(2),
     746             :     &sClassOps,
     747             :     JS_NULL_CLASS_SPEC,
     748             :     &sClassExtension,
     749             :     JS_NULL_OBJECT_OPS
     750             :   },
     751             :   { prototypes::id::PaymentAddress, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
     752             :   IsBaseOf<nsISupports, mozilla::dom::PaymentAddress >::value,
     753             :   sNativePropertyHooks,
     754             :   FindAssociatedGlobalForNative<mozilla::dom::PaymentAddress>::Get,
     755             :   GetProtoObjectHandle,
     756             :   GetCCParticipant<mozilla::dom::PaymentAddress>::Get()
     757             : };
     758             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
     759             :               "Must have the right minimal number of reserved slots.");
     760             : static_assert(2 >= 2,
     761             :               "Must have enough reserved slots.");
     762             : 
     763             : const JSClass*
     764           0 : GetJSClass()
     765             : {
     766           0 :   return sClass.ToJSClass();
     767             : }
     768             : 
     769             : bool
     770           0 : Wrap(JSContext* aCx, mozilla::dom::PaymentAddress* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     771             : {
     772             :   MOZ_ASSERT(static_cast<mozilla::dom::PaymentAddress*>(aObject) ==
     773             :              reinterpret_cast<mozilla::dom::PaymentAddress*>(aObject),
     774             :              "Multiple inheritance for mozilla::dom::PaymentAddress is broken.");
     775           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     776           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     777           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
     778             :              "You should probably not be using Wrap() directly; use "
     779             :              "GetOrCreateDOMReflector instead");
     780             : 
     781           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
     782             :              "nsISupports must be on our primary inheritance chain");
     783             : 
     784           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
     785           0 :   if (!global) {
     786           0 :     return false;
     787             :   }
     788           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
     789           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
     790             : 
     791             :   // That might have ended up wrapping us already, due to the wonders
     792             :   // of XBL.  Check for that, and bail out as needed.
     793           0 :   aReflector.set(aCache->GetWrapper());
     794           0 :   if (aReflector) {
     795             : #ifdef DEBUG
     796           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
     797             : #endif // DEBUG
     798           0 :     return true;
     799             :   }
     800             : 
     801           0 :   JSAutoCompartment ac(aCx, global);
     802           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     803           0 :   if (!canonicalProto) {
     804           0 :     return false;
     805             :   }
     806           0 :   JS::Rooted<JSObject*> proto(aCx);
     807           0 :   if (aGivenProto) {
     808           0 :     proto = aGivenProto;
     809             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     810             :     // coming in, we changed compartments to that of "parent" so may need
     811             :     // to wrap the proto here.
     812           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     813           0 :       if (!JS_WrapObject(aCx, &proto)) {
     814           0 :         return false;
     815             :       }
     816             :     }
     817             :   } else {
     818           0 :     proto = canonicalProto;
     819             :   }
     820             : 
     821           0 :   BindingJSObjectCreator<mozilla::dom::PaymentAddress> creator(aCx);
     822           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
     823           0 :   if (!aReflector) {
     824           0 :     return false;
     825             :   }
     826             : 
     827           0 :   aCache->SetWrapper(aReflector);
     828           0 :   creator.InitializationSucceeded();
     829             : 
     830           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
     831             :              aCache->GetWrapperPreserveColor() == aReflector);
     832             :   // If proto != canonicalProto, we have to preserve our wrapper;
     833             :   // otherwise we won't be able to properly recreate it later, since
     834             :   // we won't know what proto to use.  Note that we don't check
     835             :   // aGivenProto here, since it's entirely possible (and even
     836             :   // somewhat common) to have a non-null aGivenProto which is the
     837             :   // same as canonicalProto.
     838           0 :   if (proto != canonicalProto) {
     839           0 :     PreserveWrapper(aObject);
     840             :   }
     841             : 
     842           0 :   return true;
     843             : }
     844             : 
     845             : // This may allocate too many slots, because we only really need
     846             : // slots for our non-interface-typed members that we cache.  But
     847             : // allocating slots only for those would make the slot index
     848             : // computations much more complicated, so let's do this the simple
     849             : // way for now.
     850             : DEFINE_XRAY_EXPANDO_CLASS(static, sXrayExpandoObjectClass, 1);
     851             : 
     852             : const NativePropertyHooks sNativePropertyHooks[] = { {
     853             :   nullptr,
     854             :   nullptr,
     855             :   nullptr,
     856             :   { sNativeProperties.Upcast(), nullptr },
     857             :   prototypes::id::PaymentAddress,
     858             :   constructors::id::PaymentAddress,
     859             :   nullptr,
     860             :   &sXrayExpandoObjectClass
     861             : } };
     862             : 
     863             : void
     864           0 : ClearCachedAddressLineValue(mozilla::dom::PaymentAddress* aObject)
     865             : {
     866             :   JSObject* obj;
     867           0 :   obj = aObject->GetWrapper();
     868           0 :   if (!obj) {
     869           0 :     return;
     870             :   }
     871           0 :   js::SetReservedSlot(obj, (DOM_INSTANCE_RESERVED_SLOTS + 0), JS::UndefinedValue());
     872           0 :   xpc::ClearXrayExpandoSlots(obj, (xpc::JSSLOT_EXPANDO_COUNT + 0));
     873             : }
     874             : 
     875             : void
     876           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     877             : {
     878           0 :   JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
     879           0 :   if (!parentProto) {
     880           0 :     return;
     881             :   }
     882             : 
     883           0 :   JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
     884           0 :   if (!constructorProto) {
     885           0 :     return;
     886             :   }
     887             : 
     888             :   static bool sIdsInited = false;
     889           0 :   if (!sIdsInited && NS_IsMainThread()) {
     890           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     891           0 :       return;
     892             :     }
     893           0 :     sIdsInited = true;
     894             :   }
     895             : 
     896           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::PaymentAddress);
     897           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::PaymentAddress);
     898           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     899             :                               &sPrototypeClass.mBase, protoCache,
     900             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     901             :                               interfaceCache,
     902             :                               sNativeProperties.Upcast(),
     903             :                               nullptr,
     904             :                               "PaymentAddress", aDefineOnGlobal,
     905             :                               nullptr,
     906           0 :                               false);
     907             : }
     908             : 
     909             : JS::Handle<JSObject*>
     910           0 : GetProtoObjectHandle(JSContext* aCx)
     911             : {
     912             :   /* Get the interface prototype object for this class.  This will create the
     913             :      object as needed. */
     914           0 :   bool aDefineOnGlobal = true;
     915             : 
     916             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     917           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     918           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     919           0 :     return nullptr;
     920             :   }
     921             : 
     922             :   /* Check to see whether the interface objects are already installed */
     923           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     924           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::PaymentAddress)) {
     925           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     926           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     927             :   }
     928             : 
     929             :   /*
     930             :    * The object might _still_ be null, but that's OK.
     931             :    *
     932             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     933             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     934             :    * changed after they have been set.
     935             :    *
     936             :    * Calling address() avoids the read read barrier that does gray
     937             :    * unmarking, but it's not possible for the object to be gray here.
     938             :    */
     939             : 
     940           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::PaymentAddress);
     941           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     942           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     943             : }
     944             : 
     945             : JS::Handle<JSObject*>
     946           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     947             : {
     948             :   /* Get the interface object for this class.  This will create the object as
     949             :      needed. */
     950             : 
     951             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     952           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     953           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     954           0 :     return nullptr;
     955             :   }
     956             : 
     957             :   /* Check to see whether the interface objects are already installed */
     958           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     959           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::PaymentAddress)) {
     960           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     961           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     962             :   }
     963             : 
     964             :   /*
     965             :    * The object might _still_ be null, but that's OK.
     966             :    *
     967             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     968             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     969             :    * changed after they have been set.
     970             :    *
     971             :    * Calling address() avoids the read read barrier that does gray
     972             :    * unmarking, but it's not possible for the object to be gray here.
     973             :    */
     974             : 
     975           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::PaymentAddress);
     976           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     977           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     978             : }
     979             : 
     980             : JSObject*
     981           0 : GetConstructorObject(JSContext* aCx)
     982             : {
     983           0 :   return GetConstructorObjectHandle(aCx);
     984             : }
     985             : 
     986             : } // namespace PaymentAddressBinding
     987             : 
     988             : 
     989             : 
     990             : } // namespace dom
     991             : } // namespace mozilla

Generated by: LCOV version 1.13