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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM FontFaceSet.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "AtomList.h"
       4             : #include "EventHandlerBinding.h"
       5             : #include "EventTargetBinding.h"
       6             : #include "FontFaceSetBinding.h"
       7             : #include "WrapperFactory.h"
       8             : #include "jsapi.h"
       9             : #include "mozilla/OwningNonNull.h"
      10             : #include "mozilla/Preferences.h"
      11             : #include "mozilla/dom/BindingUtils.h"
      12             : #include "mozilla/dom/DOMJSClass.h"
      13             : #include "mozilla/dom/FontFace.h"
      14             : #include "mozilla/dom/FontFaceSet.h"
      15             : #include "mozilla/dom/FontFaceSetIterator.h"
      16             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      17             : #include "mozilla/dom/Nullable.h"
      18             : #include "mozilla/dom/PrimitiveConversions.h"
      19             : #include "mozilla/dom/Promise.h"
      20             : #include "mozilla/dom/ScriptSettings.h"
      21             : #include "mozilla/dom/ToJSValue.h"
      22             : #include "mozilla/dom/XrayExpandoClass.h"
      23             : 
      24             : namespace mozilla {
      25             : namespace dom {
      26             : 
      27             : namespace FontFaceSetLoadStatusValues {
      28             : extern const EnumEntry strings[3] = {
      29             :   {"loading", 7},
      30             :   {"loaded", 6},
      31             :   { nullptr, 0 }
      32             : };
      33             : } // namespace FontFaceSetLoadStatusValues
      34             : 
      35             : bool
      36           0 : ToJSValue(JSContext* aCx, FontFaceSetLoadStatus aArgument, JS::MutableHandle<JS::Value> aValue)
      37             : {
      38           0 :   MOZ_ASSERT(uint32_t(aArgument) < ArrayLength(FontFaceSetLoadStatusValues::strings));
      39             :   JSString* resultStr =
      40           0 :     JS_NewStringCopyN(aCx, FontFaceSetLoadStatusValues::strings[uint32_t(aArgument)].value,
      41           0 :                       FontFaceSetLoadStatusValues::strings[uint32_t(aArgument)].length);
      42           0 :   if (!resultStr) {
      43           0 :     return false;
      44             :   }
      45           0 :   aValue.setString(resultStr);
      46           0 :   return true;
      47             : }
      48             : 
      49             : 
      50             : 
      51           0 : FontFaceSetIteratorResult::FontFaceSetIteratorResult()
      52           0 :   : mValue(JS::UndefinedValue())
      53             : {
      54             :   // Safe to pass a null context if we pass a null value
      55           0 :   Init(nullptr, JS::NullHandleValue);
      56           0 : }
      57             : 
      58             : 
      59             : bool
      60           0 : FontFaceSetIteratorResult::InitIds(JSContext* cx, FontFaceSetIteratorResultAtoms* atomsCache)
      61             : {
      62           0 :   MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache));
      63             : 
      64             :   // Initialize these in reverse order so that any failure leaves the first one
      65             :   // uninitialized.
      66           0 :   if (!atomsCache->value_id.init(cx, "value") ||
      67           0 :       !atomsCache->done_id.init(cx, "done")) {
      68           0 :     return false;
      69             :   }
      70           0 :   return true;
      71             : }
      72             : 
      73             : bool
      74           0 : FontFaceSetIteratorResult::Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
      75             : {
      76             :   // Passing a null JSContext is OK only if we're initing from null,
      77             :   // Since in that case we will not have to do any property gets
      78             :   // Also evaluate isNullOrUndefined in order to avoid false-positive
      79             :   // checkers by static analysis tools
      80           0 :   MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined());
      81           0 :   FontFaceSetIteratorResultAtoms* atomsCache = nullptr;
      82           0 :   if (cx) {
      83           0 :     atomsCache = GetAtomCache<FontFaceSetIteratorResultAtoms>(cx);
      84           0 :     if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
      85           0 :       return false;
      86             :     }
      87             :   }
      88             : 
      89           0 :   if (!IsConvertibleToDictionary(val)) {
      90           0 :     return ThrowErrorMessage(cx, MSG_NOT_DICTIONARY, sourceDescription);
      91             :   }
      92             : 
      93           0 :   bool isNull = val.isNullOrUndefined();
      94             :   // We only need these if !isNull, in which case we have |cx|.
      95           0 :   Maybe<JS::Rooted<JSObject *> > object;
      96           0 :   Maybe<JS::Rooted<JS::Value> > temp;
      97           0 :   if (!isNull) {
      98           0 :     MOZ_ASSERT(cx);
      99           0 :     object.emplace(cx, &val.toObject());
     100           0 :     temp.emplace(cx);
     101             :   }
     102           0 :   if (!isNull) {
     103           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->done_id, temp.ptr())) {
     104           0 :       return false;
     105             :     }
     106             :   }
     107           0 :   if (!isNull && !temp->isUndefined()) {
     108           0 :     if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &mDone)) {
     109           0 :       return false;
     110             :     }
     111           0 :     mIsAnyMemberPresent = true;
     112           0 :   } else if (cx) {
     113             :     // Don't error out if we have no cx.  In that
     114             :     // situation the caller is default-constructing us and we'll
     115             :     // just assume they know what they're doing.
     116           0 :     return ThrowErrorMessage(cx, MSG_MISSING_REQUIRED_DICTIONARY_MEMBER,
     117           0 :                              "'done' member of FontFaceSetIteratorResult");
     118             :   }
     119             : 
     120           0 :   if (!isNull) {
     121           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->value_id, temp.ptr())) {
     122           0 :       return false;
     123             :     }
     124             :   }
     125           0 :   if (!isNull && !temp->isUndefined()) {
     126             : #ifdef __clang__
     127             : #pragma clang diagnostic push
     128             : #pragma clang diagnostic ignored "-Wunreachable-code"
     129             : #pragma clang diagnostic ignored "-Wunreachable-code-return"
     130             : #endif // __clang__
     131           0 :     if ((passedToJSImpl) && !CallerSubsumes(temp.ref())) {
     132           0 :       ThrowErrorMessage(cx, MSG_PERMISSION_DENIED_TO_PASS_ARG, "'value' member of FontFaceSetIteratorResult");
     133           0 :       return false;
     134             :     }
     135             : #ifdef __clang__
     136             : #pragma clang diagnostic pop
     137             : #endif // __clang__
     138           0 :     mValue = temp.ref();
     139           0 :     mIsAnyMemberPresent = true;
     140           0 :   } else if (cx) {
     141             :     // Don't error out if we have no cx.  In that
     142             :     // situation the caller is default-constructing us and we'll
     143             :     // just assume they know what they're doing.
     144           0 :     return ThrowErrorMessage(cx, MSG_MISSING_REQUIRED_DICTIONARY_MEMBER,
     145           0 :                              "'value' member of FontFaceSetIteratorResult");
     146             :   }
     147           0 :   return true;
     148             : }
     149             : 
     150             : bool
     151           0 : FontFaceSetIteratorResult::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
     152             : {
     153           0 :   FontFaceSetIteratorResultAtoms* atomsCache = GetAtomCache<FontFaceSetIteratorResultAtoms>(cx);
     154           0 :   if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
     155           0 :     return false;
     156             :   }
     157             : 
     158           0 :   JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
     159           0 :   if (!obj) {
     160           0 :     return false;
     161             :   }
     162           0 :   rval.set(JS::ObjectValue(*obj));
     163             : 
     164             :   do {
     165             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     166           0 :     JS::Rooted<JS::Value> temp(cx);
     167           0 :     bool const & currentValue = mDone;
     168           0 :     temp.setBoolean(currentValue);
     169           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->done_id, temp, JSPROP_ENUMERATE)) {
     170           0 :       return false;
     171             :     }
     172           0 :     break;
     173             :   } while(0);
     174             : 
     175             :   do {
     176             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     177           0 :     JS::Rooted<JS::Value> temp(cx);
     178           0 :     JS::Value const & currentValue = mValue;
     179           0 :     JS::ExposeValueToActiveJS(currentValue);
     180           0 :     temp.set(currentValue);
     181           0 :     if (!MaybeWrapValue(cx, &temp)) {
     182           0 :       return false;
     183             :     }
     184           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->value_id, temp, JSPROP_ENUMERATE)) {
     185           0 :       return false;
     186             :     }
     187           0 :     break;
     188             :   } while(0);
     189             : 
     190           0 :   return true;
     191             : }
     192             : 
     193             : void
     194           0 : FontFaceSetIteratorResult::TraceDictionary(JSTracer* trc)
     195             : {
     196           0 :   JS::UnsafeTraceRoot(trc, &mValue, "FontFaceSetIteratorResult.mValue");
     197           0 : }
     198             : 
     199             : namespace binding_detail {
     200             : } // namespace binding_detail
     201             : 
     202             : 
     203             : void
     204           0 : FontFaceSetForEachCallback::Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, FontFace& value, FontFace& key, FontFaceSet& set, ErrorResult& aRv)
     205             : {
     206           0 :   JS::Rooted<JS::Value> rval(cx, JS::UndefinedValue());
     207           0 :   JS::AutoValueVector argv(cx);
     208           0 :   if (!argv.resize(3)) {
     209           0 :     aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
     210           0 :     return;
     211             :   }
     212           0 :   unsigned argc = 3;
     213             : 
     214             :   do {
     215           0 :     if (!GetOrCreateDOMReflector(cx, set, argv[2])) {
     216           0 :       MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     217           0 :       aRv.Throw(NS_ERROR_UNEXPECTED);
     218           0 :       return;
     219             :     }
     220           0 :     break;
     221             :   } while (0);
     222             : 
     223             :   do {
     224           0 :     if (!GetOrCreateDOMReflector(cx, key, argv[1])) {
     225           0 :       MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     226           0 :       aRv.Throw(NS_ERROR_UNEXPECTED);
     227           0 :       return;
     228             :     }
     229           0 :     break;
     230             :   } while (0);
     231             : 
     232             :   do {
     233           0 :     if (!GetOrCreateDOMReflector(cx, value, argv[0])) {
     234           0 :       MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     235           0 :       aRv.Throw(NS_ERROR_UNEXPECTED);
     236           0 :       return;
     237             :     }
     238           0 :     break;
     239             :   } while (0);
     240             : 
     241           0 :   JS::Rooted<JS::Value> callable(cx, JS::ObjectValue(*mCallback));
     242           0 :   if (!JS::Call(cx, aThisVal, callable,
     243           0 :                 JS::HandleValueArray::subarray(argv, 0, argc), &rval)) {
     244           0 :     aRv.NoteJSContextException(cx);
     245           0 :     return;
     246             :   }
     247             : }
     248             : 
     249             : 
     250             : 
     251             : namespace binding_detail {
     252             : } // namespace binding_detail
     253             : 
     254             : 
     255             : namespace FontFaceSetBinding {
     256             : 
     257             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<EventTargetBinding::NativeType>::value,
     258             :               "Can't inherit from an interface with a different ownership model.");
     259             : 
     260             : static bool
     261           0 : get_size(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, JSJitGetterCallArgs args)
     262             : {
     263           0 :   uint32_t result(self->Size());
     264           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     265           0 :   args.rval().setNumber(result);
     266           0 :   return true;
     267             : }
     268             : 
     269             : static const JSJitInfo size_getterinfo = {
     270             :   { (JSJitGetterOp)get_size },
     271             :   { prototypes::id::FontFaceSet },
     272             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     273             :   JSJitInfo::Getter,
     274             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     275             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
     276             :   true,  /* isInfallible. False in setters. */
     277             :   false,  /* isMovable.  Not relevant for setters. */
     278             :   false, /* isEliminatable.  Not relevant for setters. */
     279             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     280             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     281             :   false,  /* isTypedMethod.  Only relevant for methods. */
     282             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     283             : };
     284             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     285             : static_assert(0 < 1, "There is no slot for us");
     286             : 
     287             : static bool
     288           0 : add(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, const JSJitMethodCallArgs& args)
     289             : {
     290           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     291           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "FontFaceSet.add");
     292             :   }
     293           0 :   NonNull<mozilla::dom::FontFace> arg0;
     294           0 :   if (args[0].isObject()) {
     295             :     {
     296           0 :       nsresult rv = UnwrapObject<prototypes::id::FontFace, mozilla::dom::FontFace>(args[0], arg0);
     297           0 :       if (NS_FAILED(rv)) {
     298           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of FontFaceSet.add", "FontFace");
     299           0 :         return false;
     300             :       }
     301             :     }
     302             :   } else {
     303           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of FontFaceSet.add");
     304           0 :     return false;
     305             :   }
     306           0 :   binding_detail::FastErrorResult rv;
     307           0 :   self->Add(NonNullHelper(arg0), rv);
     308           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     309           0 :     return false;
     310             :   }
     311           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     312           0 :   args.rval().setUndefined();
     313           0 :   return true;
     314             : }
     315             : 
     316             : static const JSJitInfo add_methodinfo = {
     317             :   { (JSJitGetterOp)add },
     318             :   { prototypes::id::FontFaceSet },
     319             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     320             :   JSJitInfo::Method,
     321             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     322             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     323             :   false,  /* isInfallible. False in setters. */
     324             :   false,  /* isMovable.  Not relevant for setters. */
     325             :   false, /* isEliminatable.  Not relevant for setters. */
     326             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     327             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     328             :   false,  /* isTypedMethod.  Only relevant for methods. */
     329             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     330             : };
     331             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     332             : static_assert(0 < 1, "There is no slot for us");
     333             : 
     334             : static bool
     335           0 : has(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, const JSJitMethodCallArgs& args)
     336             : {
     337           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     338           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "FontFaceSet.has");
     339             :   }
     340           0 :   NonNull<mozilla::dom::FontFace> arg0;
     341           0 :   if (args[0].isObject()) {
     342             :     {
     343           0 :       nsresult rv = UnwrapObject<prototypes::id::FontFace, mozilla::dom::FontFace>(args[0], arg0);
     344           0 :       if (NS_FAILED(rv)) {
     345           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of FontFaceSet.has", "FontFace");
     346           0 :         return false;
     347             :       }
     348             :     }
     349             :   } else {
     350           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of FontFaceSet.has");
     351           0 :     return false;
     352             :   }
     353           0 :   bool result(self->Has(NonNullHelper(arg0)));
     354           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     355           0 :   args.rval().setBoolean(result);
     356           0 :   return true;
     357             : }
     358             : 
     359             : static const JSJitInfo has_methodinfo = {
     360             :   { (JSJitGetterOp)has },
     361             :   { prototypes::id::FontFaceSet },
     362             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     363             :   JSJitInfo::Method,
     364             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     365             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
     366             :   false,  /* isInfallible. False in setters. */
     367             :   false,  /* isMovable.  Not relevant for setters. */
     368             :   false, /* isEliminatable.  Not relevant for setters. */
     369             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     370             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     371             :   false,  /* isTypedMethod.  Only relevant for methods. */
     372             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     373             : };
     374             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     375             : static_assert(0 < 1, "There is no slot for us");
     376             : 
     377             : static bool
     378           0 : _delete_(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, const JSJitMethodCallArgs& args)
     379             : {
     380           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     381           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "FontFaceSet.delete");
     382             :   }
     383           0 :   NonNull<mozilla::dom::FontFace> arg0;
     384           0 :   if (args[0].isObject()) {
     385             :     {
     386           0 :       nsresult rv = UnwrapObject<prototypes::id::FontFace, mozilla::dom::FontFace>(args[0], arg0);
     387           0 :       if (NS_FAILED(rv)) {
     388           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of FontFaceSet.delete", "FontFace");
     389           0 :         return false;
     390             :       }
     391             :     }
     392             :   } else {
     393           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of FontFaceSet.delete");
     394           0 :     return false;
     395             :   }
     396           0 :   bool result(self->Delete(NonNullHelper(arg0)));
     397           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     398           0 :   args.rval().setBoolean(result);
     399           0 :   return true;
     400             : }
     401             : 
     402             : static const JSJitInfo delete_methodinfo = {
     403             :   { (JSJitGetterOp)_delete_ },
     404             :   { prototypes::id::FontFaceSet },
     405             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     406             :   JSJitInfo::Method,
     407             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     408             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
     409             :   false,  /* isInfallible. False in setters. */
     410             :   false,  /* isMovable.  Not relevant for setters. */
     411             :   false, /* isEliminatable.  Not relevant for setters. */
     412             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     413             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     414             :   false,  /* isTypedMethod.  Only relevant for methods. */
     415             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     416             : };
     417             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     418             : static_assert(0 < 1, "There is no slot for us");
     419             : 
     420             : static bool
     421           0 : clear(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, const JSJitMethodCallArgs& args)
     422             : {
     423           0 :   self->Clear();
     424           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     425           0 :   args.rval().setUndefined();
     426           0 :   return true;
     427             : }
     428             : 
     429             : static const JSJitInfo clear_methodinfo = {
     430             :   { (JSJitGetterOp)clear },
     431             :   { prototypes::id::FontFaceSet },
     432             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     433             :   JSJitInfo::Method,
     434             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     435             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     436             :   true,  /* isInfallible. False in setters. */
     437             :   false,  /* isMovable.  Not relevant for setters. */
     438             :   false, /* isEliminatable.  Not relevant for setters. */
     439             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     440             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     441             :   false,  /* isTypedMethod.  Only relevant for methods. */
     442             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     443             : };
     444             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     445             : static_assert(0 < 1, "There is no slot for us");
     446             : 
     447             : static bool
     448           0 : entries(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, const JSJitMethodCallArgs& args)
     449             : {
     450           0 :   auto result(StrongOrRawPtr<mozilla::dom::FontFaceSetIterator>(self->Entries()));
     451           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     452             :   static_assert(!IsPointer<decltype(result)>::value,
     453             :                 "NewObject implies that we need to keep the object alive with a strong reference.");
     454           0 :   if (!WrapNewBindingNonWrapperCachedObject(cx, obj, result, args.rval())) {
     455           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     456           0 :     return false;
     457             :   }
     458           0 :   return true;
     459             : }
     460             : 
     461             : static const JSJitInfo entries_methodinfo = {
     462             :   { (JSJitGetterOp)entries },
     463             :   { prototypes::id::FontFaceSet },
     464             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     465             :   JSJitInfo::Method,
     466             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     467             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     468             :   false,  /* isInfallible. False in setters. */
     469             :   false,  /* isMovable.  Not relevant for setters. */
     470             :   false, /* isEliminatable.  Not relevant for setters. */
     471             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     472             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     473             :   false,  /* isTypedMethod.  Only relevant for methods. */
     474             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     475             : };
     476             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     477             : static_assert(0 < 1, "There is no slot for us");
     478             : 
     479             : static bool
     480           0 : values(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, const JSJitMethodCallArgs& args)
     481             : {
     482           0 :   auto result(StrongOrRawPtr<mozilla::dom::FontFaceSetIterator>(self->Values()));
     483           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     484             :   static_assert(!IsPointer<decltype(result)>::value,
     485             :                 "NewObject implies that we need to keep the object alive with a strong reference.");
     486           0 :   if (!WrapNewBindingNonWrapperCachedObject(cx, obj, result, args.rval())) {
     487           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     488           0 :     return false;
     489             :   }
     490           0 :   return true;
     491             : }
     492             : 
     493             : static const JSJitInfo values_methodinfo = {
     494             :   { (JSJitGetterOp)values },
     495             :   { prototypes::id::FontFaceSet },
     496             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     497             :   JSJitInfo::Method,
     498             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     499             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     500             :   false,  /* isInfallible. False in setters. */
     501             :   false,  /* isMovable.  Not relevant for setters. */
     502             :   false, /* isEliminatable.  Not relevant for setters. */
     503             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     504             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     505             :   false,  /* isTypedMethod.  Only relevant for methods. */
     506             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     507             : };
     508             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     509             : static_assert(0 < 1, "There is no slot for us");
     510             : 
     511             : static bool
     512           0 : forEach(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, const JSJitMethodCallArgs& args)
     513             : {
     514           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     515           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "FontFaceSet.forEach");
     516             :   }
     517           0 :   RootedCallback<OwningNonNull<binding_detail::FastFontFaceSetForEachCallback>> arg0(cx);
     518           0 :   if (args[0].isObject()) {
     519           0 :     if (JS::IsCallable(&args[0].toObject())) {
     520             :     { // scope for tempRoot
     521           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
     522           0 :       arg0 = new binding_detail::FastFontFaceSetForEachCallback(tempRoot);
     523             :     }
     524             :     } else {
     525           0 :       ThrowErrorMessage(cx, MSG_NOT_CALLABLE, "Argument 1 of FontFaceSet.forEach");
     526           0 :       return false;
     527             :     }
     528             :   } else {
     529           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of FontFaceSet.forEach");
     530           0 :     return false;
     531             :   }
     532           0 :   JS::Rooted<JS::Value> arg1(cx);
     533           0 :   if (args.hasDefined(1)) {
     534           0 :     arg1 = args[1];
     535             :   } else {
     536           0 :     arg1 = JS::UndefinedValue();
     537             :   }
     538           0 :   binding_detail::FastErrorResult rv;
     539           0 :   self->ForEach(cx, NonNullHelper(arg0), arg1, rv);
     540           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     541           0 :     return false;
     542             :   }
     543           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     544           0 :   args.rval().setUndefined();
     545           0 :   return true;
     546             : }
     547             : 
     548             : static const JSJitInfo forEach_methodinfo = {
     549             :   { (JSJitGetterOp)forEach },
     550             :   { prototypes::id::FontFaceSet },
     551             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     552             :   JSJitInfo::Method,
     553             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     554             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     555             :   false,  /* isInfallible. False in setters. */
     556             :   false,  /* isMovable.  Not relevant for setters. */
     557             :   false, /* isEliminatable.  Not relevant for setters. */
     558             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     559             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     560             :   false,  /* isTypedMethod.  Only relevant for methods. */
     561             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     562             : };
     563             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     564             : static_assert(0 < 1, "There is no slot for us");
     565             : 
     566             : static bool
     567           0 : get_onloading(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, JSJitGetterCallArgs args)
     568             : {
     569           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnloading());
     570           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     571           0 :   if (result) {
     572           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
     573           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
     574           0 :       return false;
     575             :     }
     576           0 :     return true;
     577             :   } else {
     578           0 :     args.rval().setNull();
     579           0 :     return true;
     580             :   }
     581             : }
     582             : 
     583             : static bool
     584           0 : set_onloading(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, JSJitSetterCallArgs args)
     585             : {
     586           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
     587           0 :   if (args[0].isObject()) {
     588             :     { // scope for tempRoot
     589           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
     590           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
     591             :     }
     592             :   } else {
     593           0 :     arg0 = nullptr;
     594             :   }
     595           0 :   self->SetOnloading(Constify(arg0));
     596           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     597             : 
     598           0 :   return true;
     599             : }
     600             : 
     601             : static const JSJitInfo onloading_getterinfo = {
     602             :   { (JSJitGetterOp)get_onloading },
     603             :   { prototypes::id::FontFaceSet },
     604             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     605             :   JSJitInfo::Getter,
     606             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     607             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     608             :   false,  /* isInfallible. False in setters. */
     609             :   false,  /* isMovable.  Not relevant for setters. */
     610             :   false, /* isEliminatable.  Not relevant for setters. */
     611             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     612             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     613             :   false,  /* isTypedMethod.  Only relevant for methods. */
     614             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     615             : };
     616             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     617             : static_assert(0 < 1, "There is no slot for us");
     618             : static const JSJitInfo onloading_setterinfo = {
     619             :   { (JSJitGetterOp)set_onloading },
     620             :   { prototypes::id::FontFaceSet },
     621             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     622             :   JSJitInfo::Setter,
     623             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     624             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     625             :   false,  /* isInfallible. False in setters. */
     626             :   false,  /* isMovable.  Not relevant for setters. */
     627             :   false, /* isEliminatable.  Not relevant for setters. */
     628             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     629             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     630             :   false,  /* isTypedMethod.  Only relevant for methods. */
     631             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     632             : };
     633             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     634             : static_assert(0 < 1, "There is no slot for us");
     635             : 
     636             : static bool
     637           0 : get_onloadingdone(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, JSJitGetterCallArgs args)
     638             : {
     639           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnloadingdone());
     640           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     641           0 :   if (result) {
     642           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
     643           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
     644           0 :       return false;
     645             :     }
     646           0 :     return true;
     647             :   } else {
     648           0 :     args.rval().setNull();
     649           0 :     return true;
     650             :   }
     651             : }
     652             : 
     653             : static bool
     654           0 : set_onloadingdone(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, JSJitSetterCallArgs args)
     655             : {
     656           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
     657           0 :   if (args[0].isObject()) {
     658             :     { // scope for tempRoot
     659           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
     660           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
     661             :     }
     662             :   } else {
     663           0 :     arg0 = nullptr;
     664             :   }
     665           0 :   self->SetOnloadingdone(Constify(arg0));
     666           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     667             : 
     668           0 :   return true;
     669             : }
     670             : 
     671             : static const JSJitInfo onloadingdone_getterinfo = {
     672             :   { (JSJitGetterOp)get_onloadingdone },
     673             :   { prototypes::id::FontFaceSet },
     674             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     675             :   JSJitInfo::Getter,
     676             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     677             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     678             :   false,  /* isInfallible. False in setters. */
     679             :   false,  /* isMovable.  Not relevant for setters. */
     680             :   false, /* isEliminatable.  Not relevant for setters. */
     681             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     682             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     683             :   false,  /* isTypedMethod.  Only relevant for methods. */
     684             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     685             : };
     686             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     687             : static_assert(0 < 1, "There is no slot for us");
     688             : static const JSJitInfo onloadingdone_setterinfo = {
     689             :   { (JSJitGetterOp)set_onloadingdone },
     690             :   { prototypes::id::FontFaceSet },
     691             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     692             :   JSJitInfo::Setter,
     693             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     694             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     695             :   false,  /* isInfallible. False in setters. */
     696             :   false,  /* isMovable.  Not relevant for setters. */
     697             :   false, /* isEliminatable.  Not relevant for setters. */
     698             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     699             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     700             :   false,  /* isTypedMethod.  Only relevant for methods. */
     701             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     702             : };
     703             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     704             : static_assert(0 < 1, "There is no slot for us");
     705             : 
     706             : static bool
     707           0 : get_onloadingerror(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, JSJitGetterCallArgs args)
     708             : {
     709           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnloadingerror());
     710           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     711           0 :   if (result) {
     712           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
     713           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
     714           0 :       return false;
     715             :     }
     716           0 :     return true;
     717             :   } else {
     718           0 :     args.rval().setNull();
     719           0 :     return true;
     720             :   }
     721             : }
     722             : 
     723             : static bool
     724           0 : set_onloadingerror(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, JSJitSetterCallArgs args)
     725             : {
     726           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
     727           0 :   if (args[0].isObject()) {
     728             :     { // scope for tempRoot
     729           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
     730           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
     731             :     }
     732             :   } else {
     733           0 :     arg0 = nullptr;
     734             :   }
     735           0 :   self->SetOnloadingerror(Constify(arg0));
     736           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     737             : 
     738           0 :   return true;
     739             : }
     740             : 
     741             : static const JSJitInfo onloadingerror_getterinfo = {
     742             :   { (JSJitGetterOp)get_onloadingerror },
     743             :   { prototypes::id::FontFaceSet },
     744             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     745             :   JSJitInfo::Getter,
     746             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     747             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     748             :   false,  /* isInfallible. False in setters. */
     749             :   false,  /* isMovable.  Not relevant for setters. */
     750             :   false, /* isEliminatable.  Not relevant for setters. */
     751             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     752             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     753             :   false,  /* isTypedMethod.  Only relevant for methods. */
     754             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     755             : };
     756             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     757             : static_assert(0 < 1, "There is no slot for us");
     758             : static const JSJitInfo onloadingerror_setterinfo = {
     759             :   { (JSJitGetterOp)set_onloadingerror },
     760             :   { prototypes::id::FontFaceSet },
     761             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     762             :   JSJitInfo::Setter,
     763             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     764             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     765             :   false,  /* isInfallible. False in setters. */
     766             :   false,  /* isMovable.  Not relevant for setters. */
     767             :   false, /* isEliminatable.  Not relevant for setters. */
     768             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     769             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     770             :   false,  /* isTypedMethod.  Only relevant for methods. */
     771             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     772             : };
     773             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     774             : static_assert(0 < 1, "There is no slot for us");
     775             : 
     776             : static bool
     777           0 : load(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, const JSJitMethodCallArgs& args)
     778             : {
     779           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     780           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "FontFaceSet.load");
     781             :   }
     782           0 :   binding_detail::FakeString arg0;
     783           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     784           0 :     return false;
     785             :   }
     786           0 :   binding_detail::FakeString arg1;
     787           0 :   if (args.hasDefined(1)) {
     788           0 :     if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
     789           0 :       return false;
     790             :     }
     791             :   } else {
     792             :     static const char16_t data[] = { ' ', 0 };
     793           0 :     arg1.Rebind(data, ArrayLength(data) - 1);
     794             :   }
     795           0 :   binding_detail::FastErrorResult rv;
     796           0 :   auto result(StrongOrRawPtr<Promise>(self->Load(cx, NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), rv)));
     797           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     798           0 :     return false;
     799             :   }
     800           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     801             :   static_assert(!IsPointer<decltype(result)>::value,
     802             :                 "NewObject implies that we need to keep the object alive with a strong reference.");
     803           0 :   if (!ToJSValue(cx, result, args.rval())) {
     804           0 :     return false;
     805             :   }
     806           0 :   return true;
     807             : }
     808             : 
     809             : static bool
     810           0 : load_promiseWrapper(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, const JSJitMethodCallArgs& args)
     811             : {
     812             :   // Make sure to save the callee before someone maybe messes
     813             :   // with rval().
     814           0 :   JS::Rooted<JSObject*> callee(cx, &args.callee());
     815           0 :   bool ok = load(cx, obj, self, args);
     816           0 :   if (ok) {
     817           0 :     return true;
     818             :   }
     819           0 :   return ConvertExceptionToPromise(cx, xpc::XrayAwareCalleeGlobal(callee),
     820           0 :                                    args.rval());
     821             : }
     822             : 
     823             : static const JSJitInfo load_methodinfo = {
     824             :   { (JSJitGetterOp)load_promiseWrapper },
     825             :   { prototypes::id::FontFaceSet },
     826             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     827             :   JSJitInfo::Method,
     828             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     829             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     830             :   false,  /* isInfallible. False in setters. */
     831             :   false,  /* isMovable.  Not relevant for setters. */
     832             :   false, /* isEliminatable.  Not relevant for setters. */
     833             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     834             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     835             :   false,  /* isTypedMethod.  Only relevant for methods. */
     836             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     837             : };
     838             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     839             : static_assert(0 < 1, "There is no slot for us");
     840             : 
     841             : static bool
     842           0 : check(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, const JSJitMethodCallArgs& args)
     843             : {
     844           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     845           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "FontFaceSet.check");
     846             :   }
     847           0 :   binding_detail::FakeString arg0;
     848           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     849           0 :     return false;
     850             :   }
     851           0 :   binding_detail::FakeString arg1;
     852           0 :   if (args.hasDefined(1)) {
     853           0 :     if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
     854           0 :       return false;
     855             :     }
     856             :   } else {
     857             :     static const char16_t data[] = { ' ', 0 };
     858           0 :     arg1.Rebind(data, ArrayLength(data) - 1);
     859             :   }
     860           0 :   binding_detail::FastErrorResult rv;
     861           0 :   bool result(self->Check(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), rv));
     862           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     863           0 :     return false;
     864             :   }
     865           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     866           0 :   args.rval().setBoolean(result);
     867           0 :   return true;
     868             : }
     869             : 
     870             : static const JSJitInfo check_methodinfo = {
     871             :   { (JSJitGetterOp)check },
     872             :   { prototypes::id::FontFaceSet },
     873             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     874             :   JSJitInfo::Method,
     875             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     876             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
     877             :   false,  /* isInfallible. False in setters. */
     878             :   false,  /* isMovable.  Not relevant for setters. */
     879             :   false, /* isEliminatable.  Not relevant for setters. */
     880             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     881             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     882             :   false,  /* isTypedMethod.  Only relevant for methods. */
     883             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     884             : };
     885             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     886             : static_assert(0 < 1, "There is no slot for us");
     887             : 
     888             : static bool
     889           0 : get_ready(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, JSJitGetterCallArgs args)
     890             : {
     891           0 :   binding_detail::FastErrorResult rv;
     892           0 :   auto result(StrongOrRawPtr<Promise>(self->GetReady(rv)));
     893           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     894           0 :     return false;
     895             :   }
     896           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     897           0 :   if (!ToJSValue(cx, result, args.rval())) {
     898           0 :     return false;
     899             :   }
     900           0 :   return true;
     901             : }
     902             : 
     903             : static bool
     904           0 : get_ready_promiseWrapper(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, JSJitGetterCallArgs args)
     905             : {
     906           0 :   bool ok = get_ready(cx, obj, self, args);
     907           0 :   if (ok) {
     908           0 :     return true;
     909             :   }
     910           0 :   JS::Rooted<JSObject*> globalForPromise(cx);
     911             :   // We can't use xpc::XrayAwareCalleeGlobal here because we have no
     912             :   // callee.  Use our hacky version instead.
     913           0 :   if (!xpc::XrayAwareCalleeGlobalForSpecializedGetters(cx, obj,
     914             :                                                        &globalForPromise)) {
     915           0 :     return false;
     916             :   }
     917           0 :   return ConvertExceptionToPromise(cx, globalForPromise, args.rval());
     918             : }
     919             : 
     920             : static const JSJitInfo ready_getterinfo = {
     921             :   { (JSJitGetterOp)get_ready_promiseWrapper },
     922             :   { prototypes::id::FontFaceSet },
     923             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     924             :   JSJitInfo::Getter,
     925             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     926             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     927             :   false,  /* isInfallible. False in setters. */
     928             :   false,  /* isMovable.  Not relevant for setters. */
     929             :   false, /* isEliminatable.  Not relevant for setters. */
     930             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     931             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     932             :   false,  /* isTypedMethod.  Only relevant for methods. */
     933             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     934             : };
     935             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     936             : static_assert(0 < 1, "There is no slot for us");
     937             : 
     938             : static bool
     939           0 : get_status(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSet* self, JSJitGetterCallArgs args)
     940             : {
     941           0 :   FontFaceSetLoadStatus result(self->Status());
     942           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     943           0 :   if (!ToJSValue(cx, result, args.rval())) {
     944           0 :     return false;
     945             :   }
     946           0 :   return true;
     947             : }
     948             : 
     949             : static const JSJitInfo status_getterinfo = {
     950             :   { (JSJitGetterOp)get_status },
     951             :   { prototypes::id::FontFaceSet },
     952             :   { PrototypeTraits<prototypes::id::FontFaceSet>::Depth },
     953             :   JSJitInfo::Getter,
     954             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     955             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     956             :   false,  /* isInfallible. False in setters. */
     957             :   false,  /* isMovable.  Not relevant for setters. */
     958             :   false, /* isEliminatable.  Not relevant for setters. */
     959             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     960             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     961             :   false,  /* isTypedMethod.  Only relevant for methods. */
     962             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     963             : };
     964             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     965             : static_assert(0 < 1, "There is no slot for us");
     966             : 
     967             : static bool
     968           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
     969             : {
     970           0 :   mozilla::dom::FontFaceSet* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::FontFaceSet>(obj);
     971             :   // We don't want to preserve if we don't have a wrapper, and we
     972             :   // obviously can't preserve if we're not initialized.
     973           0 :   if (self && self->GetWrapperPreserveColor()) {
     974           0 :     PreserveWrapper(self);
     975             :   }
     976           0 :   return true;
     977             : }
     978             : 
     979             : static void
     980           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     981             : {
     982           0 :   mozilla::dom::FontFaceSet* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::FontFaceSet>(obj);
     983           0 :   if (self) {
     984           0 :     ClearWrapper(self, self, obj);
     985           0 :     AddForDeferredFinalization<mozilla::dom::FontFaceSet>(self);
     986             :   }
     987           0 : }
     988             : 
     989             : static void
     990           0 : _objectMoved(JSObject* obj, const JSObject* old)
     991             : {
     992           0 :   mozilla::dom::FontFaceSet* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::FontFaceSet>(obj);
     993           0 :   if (self) {
     994           0 :     UpdateWrapper(self, self, obj, old);
     995             :   }
     996           0 : }
     997             : 
     998             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     999             : #if defined(__clang__)
    1000             : #pragma clang diagnostic push
    1001             : #pragma clang diagnostic ignored "-Wmissing-braces"
    1002             : #endif
    1003             : static const JSFunctionSpec sMethods_specs[] = {
    1004             :   JS_FNSPEC("add", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&add_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    1005             :   JS_FNSPEC("has", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&has_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    1006             :   JS_FNSPEC("delete", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&delete_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    1007             :   JS_FNSPEC("clear", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&clear_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    1008             :   JS_FNSPEC("entries", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&entries_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    1009             :   JS_FNSPEC("values", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&values_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    1010             :   JS_FNSPEC("forEach", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&forEach_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    1011             :   JS_FNSPEC("load", GenericPromiseReturningBindingMethod, reinterpret_cast<const JSJitInfo*>(&load_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    1012             :   JS_FNSPEC("check", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&check_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    1013             :   JS_FS_END
    1014             : };
    1015             : #if defined(__clang__)
    1016             : #pragma clang diagnostic pop
    1017             : #endif
    1018             : 
    1019             : 
    1020             : // Can't be const because the pref-enabled boolean needs to be writable
    1021             : static Prefable<const JSFunctionSpec> sMethods[] = {
    1022             :   { nullptr, &sMethods_specs[0] },
    1023             :   { nullptr, nullptr }
    1024             : };
    1025             : 
    1026             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
    1027             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
    1028             : static_assert(9 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
    1029             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
    1030             : 
    1031             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
    1032             : #if defined(__clang__)
    1033             : #pragma clang diagnostic push
    1034             : #pragma clang diagnostic ignored "-Wmissing-braces"
    1035             : #endif
    1036             : static const JSPropertySpec sAttributes_specs[] = {
    1037             :   { "size", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &size_getterinfo, nullptr, nullptr },
    1038             :   { "onloading", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onloading_getterinfo, GenericBindingSetter, &onloading_setterinfo },
    1039             :   { "onloadingdone", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onloadingdone_getterinfo, GenericBindingSetter, &onloadingdone_setterinfo },
    1040             :   { "onloadingerror", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onloadingerror_getterinfo, GenericBindingSetter, &onloadingerror_setterinfo },
    1041             :   { "ready", JSPROP_SHARED | JSPROP_ENUMERATE, GenericPromiseReturningBindingGetter, &ready_getterinfo, nullptr, nullptr },
    1042             :   { "status", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &status_getterinfo, nullptr, nullptr },
    1043             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
    1044             : };
    1045             : #if defined(__clang__)
    1046             : #pragma clang diagnostic pop
    1047             : #endif
    1048             : 
    1049             : 
    1050             : // Can't be const because the pref-enabled boolean needs to be writable
    1051             : static Prefable<const JSPropertySpec> sAttributes[] = {
    1052             :   { nullptr, &sAttributes_specs[0] },
    1053             :   { nullptr, nullptr }
    1054             : };
    1055             : 
    1056             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
    1057             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
    1058             : static_assert(6 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
    1059             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
    1060             : 
    1061             : 
    1062             : static uint16_t sNativeProperties_sortedPropertyIndices[15];
    1063             : static PropertyInfo sNativeProperties_propertyInfos[15];
    1064             : 
    1065             : static const NativePropertiesN<2> sNativeProperties = {
    1066             :   false, 0,
    1067             :   false, 0,
    1068             :   true,  0 /* sMethods */,
    1069             :   true,  1 /* sAttributes */,
    1070             :   false, 0,
    1071             :   false, 0,
    1072             :   false, 0,
    1073             :   5,
    1074             :   15,
    1075             :   sNativeProperties_sortedPropertyIndices,
    1076             :   {
    1077             :     { sMethods, &sNativeProperties_propertyInfos[0] },
    1078             :     { sAttributes, &sNativeProperties_propertyInfos[9] }
    1079             :   }
    1080             : };
    1081             : static_assert(5 < 1ull << (CHAR_BIT * sizeof(sNativeProperties.iteratorAliasMethodIndex) - 1),
    1082             :     "We have an iterator alias index that is oversized");
    1083             : static_assert(15 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
    1084             :     "We have a property info count that is oversized");
    1085             : 
    1086             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
    1087             :   {
    1088             :     "Function",
    1089             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
    1090             :     &sBoringInterfaceObjectClassClassOps,
    1091             :     JS_NULL_CLASS_SPEC,
    1092             :     JS_NULL_CLASS_EXT,
    1093             :     &sInterfaceObjectClassObjectOps
    1094             :   },
    1095             :   eInterface,
    1096             :   true,
    1097             :   prototypes::id::FontFaceSet,
    1098             :   PrototypeTraits<prototypes::id::FontFaceSet>::Depth,
    1099             :   sNativePropertyHooks,
    1100             :   "function FontFaceSet() {\n    [native code]\n}",
    1101             :   EventTargetBinding::GetConstructorObject
    1102             : };
    1103             : 
    1104             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
    1105             :   {
    1106             :     "FontFaceSetPrototype",
    1107             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
    1108             :     JS_NULL_CLASS_OPS,
    1109             :     JS_NULL_CLASS_SPEC,
    1110             :     JS_NULL_CLASS_EXT,
    1111             :     JS_NULL_OBJECT_OPS
    1112             :   },
    1113             :   eInterfacePrototype,
    1114             :   false,
    1115             :   prototypes::id::FontFaceSet,
    1116             :   PrototypeTraits<prototypes::id::FontFaceSet>::Depth,
    1117             :   sNativePropertyHooks,
    1118             :   "[object FontFaceSetPrototype]",
    1119             :   EventTargetBinding::GetProtoObject
    1120             : };
    1121             : 
    1122             : bool
    1123           0 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
    1124             : {
    1125             :   static bool sPrefValue;
    1126             :   static bool sPrefCacheSetUp = false;
    1127           0 :   if (!sPrefCacheSetUp) {
    1128           0 :     sPrefCacheSetUp = true;
    1129           0 :     Preferences::AddBoolVarCache(&sPrefValue, "layout.css.font-loading-api.enabled");
    1130             :   }
    1131             : 
    1132           0 :   return sPrefValue;
    1133             : }
    1134             : 
    1135             : JSObject*
    1136           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
    1137             : {
    1138           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
    1139             : }
    1140             : 
    1141             : static const js::ClassOps sClassOps = {
    1142             :   _addProperty, /* addProperty */
    1143             :   nullptr,               /* delProperty */
    1144             :   nullptr,               /* getProperty */
    1145             :   nullptr,               /* setProperty */
    1146             :   nullptr,               /* enumerate */
    1147             :   nullptr, /* newEnumerate */
    1148             :   nullptr, /* resolve */
    1149             :   nullptr, /* mayResolve */
    1150             :   _finalize, /* finalize */
    1151             :   nullptr, /* call */
    1152             :   nullptr,               /* hasInstance */
    1153             :   nullptr,               /* construct */
    1154             :   nullptr, /* trace */
    1155             : };
    1156             : 
    1157             : static const js::ClassExtension sClassExtension = {
    1158             :   nullptr, /* weakmapKeyDelegateOp */
    1159             :   _objectMoved /* objectMovedOp */
    1160             : };
    1161             : 
    1162             : static const DOMJSClass sClass = {
    1163             :   { "FontFaceSet",
    1164             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
    1165             :     &sClassOps,
    1166             :     JS_NULL_CLASS_SPEC,
    1167             :     &sClassExtension,
    1168             :     JS_NULL_OBJECT_OPS
    1169             :   },
    1170             :   { prototypes::id::EventTarget, prototypes::id::FontFaceSet, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
    1171             :   IsBaseOf<nsISupports, mozilla::dom::FontFaceSet >::value,
    1172             :   sNativePropertyHooks,
    1173             :   FindAssociatedGlobalForNative<mozilla::dom::FontFaceSet>::Get,
    1174             :   GetProtoObjectHandle,
    1175             :   GetCCParticipant<mozilla::dom::FontFaceSet>::Get()
    1176             : };
    1177             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
    1178             :               "Must have the right minimal number of reserved slots.");
    1179             : static_assert(1 >= 1,
    1180             :               "Must have enough reserved slots.");
    1181             : 
    1182             : const JSClass*
    1183           0 : GetJSClass()
    1184             : {
    1185           0 :   return sClass.ToJSClass();
    1186             : }
    1187             : 
    1188             : bool
    1189           0 : Wrap(JSContext* aCx, mozilla::dom::FontFaceSet* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
    1190             : {
    1191             :   MOZ_ASSERT(static_cast<mozilla::dom::FontFaceSet*>(aObject) ==
    1192             :              reinterpret_cast<mozilla::dom::FontFaceSet*>(aObject),
    1193             :              "Multiple inheritance for mozilla::dom::FontFaceSet is broken.");
    1194             :   MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
    1195             :              reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
    1196             :              "Multiple inheritance for mozilla::dom::EventTarget is broken.");
    1197           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
    1198           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
    1199           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
    1200             :              "You should probably not be using Wrap() directly; use "
    1201             :              "GetOrCreateDOMReflector instead");
    1202             : 
    1203           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
    1204             :              "nsISupports must be on our primary inheritance chain");
    1205             : 
    1206           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
    1207           0 :   if (!global) {
    1208           0 :     return false;
    1209             :   }
    1210           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
    1211           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
    1212             : 
    1213             :   // That might have ended up wrapping us already, due to the wonders
    1214             :   // of XBL.  Check for that, and bail out as needed.
    1215           0 :   aReflector.set(aCache->GetWrapper());
    1216           0 :   if (aReflector) {
    1217             : #ifdef DEBUG
    1218           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
    1219             : #endif // DEBUG
    1220           0 :     return true;
    1221             :   }
    1222             : 
    1223           0 :   JSAutoCompartment ac(aCx, global);
    1224           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
    1225           0 :   if (!canonicalProto) {
    1226           0 :     return false;
    1227             :   }
    1228           0 :   JS::Rooted<JSObject*> proto(aCx);
    1229           0 :   if (aGivenProto) {
    1230           0 :     proto = aGivenProto;
    1231             :     // Unfortunately, while aGivenProto was in the compartment of aCx
    1232             :     // coming in, we changed compartments to that of "parent" so may need
    1233             :     // to wrap the proto here.
    1234           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
    1235           0 :       if (!JS_WrapObject(aCx, &proto)) {
    1236           0 :         return false;
    1237             :       }
    1238             :     }
    1239             :   } else {
    1240           0 :     proto = canonicalProto;
    1241             :   }
    1242             : 
    1243           0 :   BindingJSObjectCreator<mozilla::dom::FontFaceSet> creator(aCx);
    1244           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
    1245           0 :   if (!aReflector) {
    1246           0 :     return false;
    1247             :   }
    1248             : 
    1249           0 :   aCache->SetWrapper(aReflector);
    1250           0 :   creator.InitializationSucceeded();
    1251             : 
    1252           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
    1253             :              aCache->GetWrapperPreserveColor() == aReflector);
    1254             :   // If proto != canonicalProto, we have to preserve our wrapper;
    1255             :   // otherwise we won't be able to properly recreate it later, since
    1256             :   // we won't know what proto to use.  Note that we don't check
    1257             :   // aGivenProto here, since it's entirely possible (and even
    1258             :   // somewhat common) to have a non-null aGivenProto which is the
    1259             :   // same as canonicalProto.
    1260           0 :   if (proto != canonicalProto) {
    1261           0 :     PreserveWrapper(aObject);
    1262             :   }
    1263             : 
    1264           0 :   return true;
    1265             : }
    1266             : 
    1267             : const NativePropertyHooks sNativePropertyHooks[] = { {
    1268             :   nullptr,
    1269             :   nullptr,
    1270             :   nullptr,
    1271             :   { sNativeProperties.Upcast(), nullptr },
    1272             :   prototypes::id::FontFaceSet,
    1273             :   constructors::id::FontFaceSet,
    1274             :   EventTargetBinding::sNativePropertyHooks,
    1275             :   &DefaultXrayExpandoObjectClass
    1276             : } };
    1277             : 
    1278             : void
    1279           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
    1280             : {
    1281           0 :   JS::Handle<JSObject*> parentProto(EventTargetBinding::GetProtoObjectHandle(aCx));
    1282           0 :   if (!parentProto) {
    1283           0 :     return;
    1284             :   }
    1285             : 
    1286           0 :   JS::Handle<JSObject*> constructorProto(EventTargetBinding::GetConstructorObjectHandle(aCx));
    1287           0 :   if (!constructorProto) {
    1288           0 :     return;
    1289             :   }
    1290             : 
    1291             :   static bool sIdsInited = false;
    1292           0 :   if (!sIdsInited && NS_IsMainThread()) {
    1293           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
    1294           0 :       return;
    1295             :     }
    1296           0 :     sIdsInited = true;
    1297             :   }
    1298             : 
    1299           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::FontFaceSet);
    1300           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::FontFaceSet);
    1301           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
    1302             :                               &sPrototypeClass.mBase, protoCache,
    1303             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
    1304             :                               interfaceCache,
    1305             :                               sNativeProperties.Upcast(),
    1306             :                               nullptr,
    1307             :                               "FontFaceSet", aDefineOnGlobal,
    1308             :                               nullptr,
    1309           0 :                               false);
    1310             : 
    1311             :   // Set up aliases on the interface prototype object we just created.
    1312           0 :   JS::Handle<JSObject*> proto = GetProtoObjectHandle(aCx);
    1313           0 :   if (!proto) {
    1314           0 :     *protoCache = nullptr;
    1315           0 :     if (interfaceCache) {
    1316           0 :       *interfaceCache = nullptr;
    1317             :     }
    1318           0 :     return;
    1319             :   }
    1320             : 
    1321           0 :   JS::Rooted<JS::Value> aliasedVal(aCx);
    1322             : 
    1323           0 :   if (!JS_GetProperty(aCx, proto, "values", &aliasedVal)) {
    1324           0 :     *protoCache = nullptr;
    1325           0 :     if (interfaceCache) {
    1326           0 :       *interfaceCache = nullptr;
    1327             :     }
    1328           0 :     return;
    1329             :   }
    1330           0 :   JS::Rooted<jsid> iteratorId(aCx, SYMBOL_TO_JSID(JS::GetWellKnownSymbol(aCx, JS::SymbolCode::iterator)));
    1331           0 :   if (!JS_DefinePropertyById(aCx, proto, iteratorId, aliasedVal, 0)) {
    1332           0 :     *protoCache = nullptr;
    1333           0 :     if (interfaceCache) {
    1334           0 :       *interfaceCache = nullptr;
    1335             :     }
    1336           0 :     return;
    1337             :   }
    1338           0 :   if (!JS_DefineProperty(aCx, proto, "keys", aliasedVal, JSPROP_ENUMERATE)) {
    1339           0 :     *protoCache = nullptr;
    1340           0 :     if (interfaceCache) {
    1341           0 :       *interfaceCache = nullptr;
    1342             :     }
    1343           0 :     return;
    1344             :   }
    1345             : }
    1346             : 
    1347             : JS::Handle<JSObject*>
    1348           0 : GetProtoObjectHandle(JSContext* aCx)
    1349             : {
    1350             :   /* Get the interface prototype object for this class.  This will create the
    1351             :      object as needed. */
    1352           0 :   bool aDefineOnGlobal = true;
    1353             : 
    1354             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
    1355           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
    1356           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
    1357           0 :     return nullptr;
    1358             :   }
    1359             : 
    1360             :   /* Check to see whether the interface objects are already installed */
    1361           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
    1362           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::FontFaceSet)) {
    1363           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
    1364           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
    1365             :   }
    1366             : 
    1367             :   /*
    1368             :    * The object might _still_ be null, but that's OK.
    1369             :    *
    1370             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
    1371             :    * traced by TraceProtoAndIfaceCache() and its contents are never
    1372             :    * changed after they have been set.
    1373             :    *
    1374             :    * Calling address() avoids the read read barrier that does gray
    1375             :    * unmarking, but it's not possible for the object to be gray here.
    1376             :    */
    1377             : 
    1378           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::FontFaceSet);
    1379           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    1380           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    1381             : }
    1382             : 
    1383             : JS::Handle<JSObject*>
    1384           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
    1385             : {
    1386             :   /* Get the interface object for this class.  This will create the object as
    1387             :      needed. */
    1388             : 
    1389             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
    1390           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
    1391           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
    1392           0 :     return nullptr;
    1393             :   }
    1394             : 
    1395             :   /* Check to see whether the interface objects are already installed */
    1396           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
    1397           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::FontFaceSet)) {
    1398           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
    1399           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
    1400             :   }
    1401             : 
    1402             :   /*
    1403             :    * The object might _still_ be null, but that's OK.
    1404             :    *
    1405             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
    1406             :    * traced by TraceProtoAndIfaceCache() and its contents are never
    1407             :    * changed after they have been set.
    1408             :    *
    1409             :    * Calling address() avoids the read read barrier that does gray
    1410             :    * unmarking, but it's not possible for the object to be gray here.
    1411             :    */
    1412             : 
    1413           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::FontFaceSet);
    1414           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    1415           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    1416             : }
    1417             : 
    1418             : JSObject*
    1419           0 : GetConstructorObject(JSContext* aCx)
    1420             : {
    1421           0 :   return GetConstructorObjectHandle(aCx);
    1422             : }
    1423             : 
    1424             : } // namespace FontFaceSetBinding
    1425             : 
    1426             : 
    1427             : 
    1428             : namespace FontFaceSetIteratorBinding {
    1429             : 
    1430             : static bool
    1431           0 : next(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FontFaceSetIterator* self, const JSJitMethodCallArgs& args)
    1432             : {
    1433           0 :   binding_detail::FastErrorResult rv;
    1434           0 :   RootedDictionary<FontFaceSetIteratorResult> result(cx);
    1435           0 :   self->Next(cx, result, rv);
    1436           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    1437           0 :     return false;
    1438             :   }
    1439           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1440           0 :   if (!result.ToObjectInternal(cx, args.rval())) {
    1441           0 :     return false;
    1442             :   }
    1443           0 :   return true;
    1444             : }
    1445             : 
    1446             : static const JSJitInfo next_methodinfo = {
    1447             :   { (JSJitGetterOp)next },
    1448             :   { prototypes::id::FontFaceSetIterator },
    1449             :   { PrototypeTraits<prototypes::id::FontFaceSetIterator>::Depth },
    1450             :   JSJitInfo::Method,
    1451             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1452             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    1453             :   false,  /* isInfallible. False in setters. */
    1454             :   false,  /* isMovable.  Not relevant for setters. */
    1455             :   false, /* isEliminatable.  Not relevant for setters. */
    1456             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1457             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1458             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1459             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1460             : };
    1461             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1462             : static_assert(0 < 1, "There is no slot for us");
    1463             : 
    1464             : static void
    1465           0 : _finalize(js::FreeOp* fop, JSObject* obj)
    1466             : {
    1467           0 :   mozilla::dom::FontFaceSetIterator* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::FontFaceSetIterator>(obj);
    1468           0 :   if (self) {
    1469           0 :     AddForDeferredFinalization<mozilla::dom::FontFaceSetIterator>(self);
    1470             :   }
    1471           0 : }
    1472             : 
    1473             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
    1474             : #if defined(__clang__)
    1475             : #pragma clang diagnostic push
    1476             : #pragma clang diagnostic ignored "-Wmissing-braces"
    1477             : #endif
    1478             : static const JSFunctionSpec sMethods_specs[] = {
    1479             :   JS_FNSPEC("next", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&next_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    1480             :   JS_FS_END
    1481             : };
    1482             : #if defined(__clang__)
    1483             : #pragma clang diagnostic pop
    1484             : #endif
    1485             : 
    1486             : 
    1487             : // Can't be const because the pref-enabled boolean needs to be writable
    1488             : static Prefable<const JSFunctionSpec> sMethods[] = {
    1489             :   { nullptr, &sMethods_specs[0] },
    1490             :   { nullptr, nullptr }
    1491             : };
    1492             : 
    1493             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
    1494             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
    1495             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
    1496             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
    1497             : 
    1498             : 
    1499             : static uint16_t sNativeProperties_sortedPropertyIndices[1];
    1500             : static PropertyInfo sNativeProperties_propertyInfos[1];
    1501             : 
    1502             : static const NativePropertiesN<1> sNativeProperties = {
    1503             :   false, 0,
    1504             :   false, 0,
    1505             :   true,  0 /* sMethods */,
    1506             :   false, 0,
    1507             :   false, 0,
    1508             :   false, 0,
    1509             :   false, 0,
    1510             :   -1,
    1511             :   1,
    1512             :   sNativeProperties_sortedPropertyIndices,
    1513             :   {
    1514             :     { sMethods, &sNativeProperties_propertyInfos[0] }
    1515             :   }
    1516             : };
    1517             : static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
    1518             :     "We have a property info count that is oversized");
    1519             : 
    1520             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
    1521             :   {
    1522             :     "FontFaceSetIteratorPrototype",
    1523             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
    1524             :     JS_NULL_CLASS_OPS,
    1525             :     JS_NULL_CLASS_SPEC,
    1526             :     JS_NULL_CLASS_EXT,
    1527             :     JS_NULL_OBJECT_OPS
    1528             :   },
    1529             :   eInterfacePrototype,
    1530             :   false,
    1531             :   prototypes::id::FontFaceSetIterator,
    1532             :   PrototypeTraits<prototypes::id::FontFaceSetIterator>::Depth,
    1533             :   sNativePropertyHooks,
    1534             :   "[object FontFaceSetIteratorPrototype]",
    1535             :   JS::GetRealmObjectPrototype
    1536             : };
    1537             : 
    1538             : static const js::ClassOps sClassOps = {
    1539             :   nullptr, /* addProperty */
    1540             :   nullptr,               /* delProperty */
    1541             :   nullptr,               /* getProperty */
    1542             :   nullptr,               /* setProperty */
    1543             :   nullptr,               /* enumerate */
    1544             :   nullptr, /* newEnumerate */
    1545             :   nullptr, /* resolve */
    1546             :   nullptr, /* mayResolve */
    1547             :   _finalize, /* finalize */
    1548             :   nullptr, /* call */
    1549             :   nullptr,               /* hasInstance */
    1550             :   nullptr,               /* construct */
    1551             :   nullptr, /* trace */
    1552             : };
    1553             : 
    1554             : static const js::ClassExtension sClassExtension = {
    1555             :   nullptr, /* weakmapKeyDelegateOp */
    1556             :   nullptr /* objectMovedOp */
    1557             : };
    1558             : 
    1559             : static const DOMJSClass sClass = {
    1560             :   { "FontFaceSetIterator",
    1561             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
    1562             :     &sClassOps,
    1563             :     JS_NULL_CLASS_SPEC,
    1564             :     &sClassExtension,
    1565             :     JS_NULL_OBJECT_OPS
    1566             :   },
    1567             :   { prototypes::id::FontFaceSetIterator, 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 },
    1568             :   IsBaseOf<nsISupports, mozilla::dom::FontFaceSetIterator >::value,
    1569             :   sNativePropertyHooks,
    1570             :   FindAssociatedGlobalForNative<mozilla::dom::FontFaceSetIterator>::Get,
    1571             :   GetProtoObjectHandle,
    1572             :   GetCCParticipant<mozilla::dom::FontFaceSetIterator>::Get()
    1573             : };
    1574             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
    1575             :               "Must have the right minimal number of reserved slots.");
    1576             : static_assert(1 >= 1,
    1577             :               "Must have enough reserved slots.");
    1578             : 
    1579             : const JSClass*
    1580           0 : GetJSClass()
    1581             : {
    1582           0 :   return sClass.ToJSClass();
    1583             : }
    1584             : 
    1585             : bool
    1586           0 : Wrap(JSContext* aCx, mozilla::dom::FontFaceSetIterator* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
    1587             : {
    1588             :   MOZ_ASSERT(static_cast<mozilla::dom::FontFaceSetIterator*>(aObject) ==
    1589             :              reinterpret_cast<mozilla::dom::FontFaceSetIterator*>(aObject),
    1590             :              "Multiple inheritance for mozilla::dom::FontFaceSetIterator is broken.");
    1591           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
    1592           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
    1593             : 
    1594           0 :   JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(aCx));
    1595           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
    1596           0 :   if (!canonicalProto) {
    1597           0 :     return false;
    1598             :   }
    1599           0 :   JS::Rooted<JSObject*> proto(aCx);
    1600           0 :   if (aGivenProto) {
    1601           0 :     proto = aGivenProto;
    1602             :     // Unfortunately, while aGivenProto was in the compartment of aCx
    1603             :     // coming in, we changed compartments to that of "parent" so may need
    1604             :     // to wrap the proto here.
    1605           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
    1606           0 :       if (!JS_WrapObject(aCx, &proto)) {
    1607           0 :         return false;
    1608             :       }
    1609             :     }
    1610             :   } else {
    1611           0 :     proto = canonicalProto;
    1612             :   }
    1613             : 
    1614           0 :   BindingJSObjectCreator<mozilla::dom::FontFaceSetIterator> creator(aCx);
    1615           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
    1616           0 :   if (!aReflector) {
    1617           0 :     return false;
    1618             :   }
    1619             : 
    1620             : 
    1621             : 
    1622           0 :   creator.InitializationSucceeded();
    1623           0 :   return true;
    1624             : }
    1625             : 
    1626             : const NativePropertyHooks sNativePropertyHooks[] = { {
    1627             :   nullptr,
    1628             :   nullptr,
    1629             :   nullptr,
    1630             :   { sNativeProperties.Upcast(), nullptr },
    1631             :   prototypes::id::FontFaceSetIterator,
    1632             :   constructors::id::_ID_Count,
    1633             :   nullptr,
    1634             :   &DefaultXrayExpandoObjectClass
    1635             : } };
    1636             : 
    1637             : void
    1638           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
    1639             : {
    1640           0 :   JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
    1641           0 :   if (!parentProto) {
    1642           0 :     return;
    1643             :   }
    1644             : 
    1645             :   static bool sIdsInited = false;
    1646           0 :   if (!sIdsInited && NS_IsMainThread()) {
    1647           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
    1648           0 :       return;
    1649             :     }
    1650           0 :     sIdsInited = true;
    1651             :   }
    1652             : 
    1653           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::FontFaceSetIterator);
    1654           0 :   JS::Heap<JSObject*>* interfaceCache = nullptr;
    1655           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
    1656             :                               &sPrototypeClass.mBase, protoCache,
    1657             :                               nullptr, nullptr, 0, nullptr,
    1658             :                               interfaceCache,
    1659             :                               sNativeProperties.Upcast(),
    1660             :                               nullptr,
    1661             :                               nullptr, aDefineOnGlobal,
    1662             :                               nullptr,
    1663           0 :                               false);
    1664             : }
    1665             : 
    1666             : JS::Handle<JSObject*>
    1667           0 : GetProtoObjectHandle(JSContext* aCx)
    1668             : {
    1669             :   /* Get the interface prototype object for this class.  This will create the
    1670             :      object as needed. */
    1671           0 :   bool aDefineOnGlobal = true;
    1672             : 
    1673             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
    1674           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
    1675           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
    1676           0 :     return nullptr;
    1677             :   }
    1678             : 
    1679             :   /* Check to see whether the interface objects are already installed */
    1680           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
    1681           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::FontFaceSetIterator)) {
    1682           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
    1683           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
    1684             :   }
    1685             : 
    1686             :   /*
    1687             :    * The object might _still_ be null, but that's OK.
    1688             :    *
    1689             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
    1690             :    * traced by TraceProtoAndIfaceCache() and its contents are never
    1691             :    * changed after they have been set.
    1692             :    *
    1693             :    * Calling address() avoids the read read barrier that does gray
    1694             :    * unmarking, but it's not possible for the object to be gray here.
    1695             :    */
    1696             : 
    1697           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::FontFaceSetIterator);
    1698           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    1699           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    1700             : }
    1701             : 
    1702             : } // namespace FontFaceSetIteratorBinding
    1703             : 
    1704             : 
    1705             : 
    1706             : } // namespace dom
    1707             : } // namespace mozilla

Generated by: LCOV version 1.13