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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM AnimationEffectReadOnly.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "AnimationEffectReadOnlyBinding.h"
       4             : #include "AtomList.h"
       5             : #include "WrapperFactory.h"
       6             : #include "XrayWrapper.h"
       7             : #include "jsapi.h"
       8             : #include "mozilla/FloatingPoint.h"
       9             : #include "mozilla/OwningNonNull.h"
      10             : #include "mozilla/dom/AnimationEffectReadOnly.h"
      11             : #include "mozilla/dom/AnimationEffectTimingReadOnly.h"
      12             : #include "mozilla/dom/BindingUtils.h"
      13             : #include "mozilla/dom/DOMJSClass.h"
      14             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      15             : #include "mozilla/dom/PrimitiveConversions.h"
      16             : #include "mozilla/dom/ScriptSettings.h"
      17             : #include "mozilla/dom/UnionConversions.h"
      18             : #include "mozilla/dom/XrayExpandoClass.h"
      19             : #include "nsDocument.h"
      20             : 
      21             : namespace mozilla {
      22             : namespace dom {
      23             : 
      24             : namespace FillModeValues {
      25             : extern const EnumEntry strings[6] = {
      26             :   {"none", 4},
      27             :   {"forwards", 8},
      28             :   {"backwards", 9},
      29             :   {"both", 4},
      30             :   {"auto", 4},
      31             :   { nullptr, 0 }
      32             : };
      33             : } // namespace FillModeValues
      34             : 
      35             : bool
      36           0 : ToJSValue(JSContext* aCx, FillMode aArgument, JS::MutableHandle<JS::Value> aValue)
      37             : {
      38           0 :   MOZ_ASSERT(uint32_t(aArgument) < ArrayLength(FillModeValues::strings));
      39             :   JSString* resultStr =
      40           0 :     JS_NewStringCopyN(aCx, FillModeValues::strings[uint32_t(aArgument)].value,
      41           0 :                       FillModeValues::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             : namespace PlaybackDirectionValues {
      51             : extern const EnumEntry strings[5] = {
      52             :   {"normal", 6},
      53             :   {"reverse", 7},
      54             :   {"alternate", 9},
      55             :   {"alternate-reverse", 17},
      56             :   { nullptr, 0 }
      57             : };
      58             : } // namespace PlaybackDirectionValues
      59             : 
      60             : bool
      61           0 : ToJSValue(JSContext* aCx, PlaybackDirection aArgument, JS::MutableHandle<JS::Value> aValue)
      62             : {
      63           0 :   MOZ_ASSERT(uint32_t(aArgument) < ArrayLength(PlaybackDirectionValues::strings));
      64             :   JSString* resultStr =
      65           0 :     JS_NewStringCopyN(aCx, PlaybackDirectionValues::strings[uint32_t(aArgument)].value,
      66           0 :                       PlaybackDirectionValues::strings[uint32_t(aArgument)].length);
      67           0 :   if (!resultStr) {
      68           0 :     return false;
      69             :   }
      70           0 :   aValue.setString(resultStr);
      71           0 :   return true;
      72             : }
      73             : 
      74             : 
      75             : 
      76           0 : AnimationEffectTimingProperties::AnimationEffectTimingProperties()
      77             : {
      78             :   // Safe to pass a null context if we pass a null value
      79           0 :   Init(nullptr, JS::NullHandleValue);
      80           0 : }
      81             : 
      82             : 
      83             : 
      84             : bool
      85           0 : AnimationEffectTimingProperties::InitIds(JSContext* cx, AnimationEffectTimingPropertiesAtoms* atomsCache)
      86             : {
      87           0 :   MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache));
      88             : 
      89             :   // Initialize these in reverse order so that any failure leaves the first one
      90             :   // uninitialized.
      91           0 :   if (!atomsCache->iterations_id.init(cx, "iterations") ||
      92           0 :       !atomsCache->iterationStart_id.init(cx, "iterationStart") ||
      93           0 :       !atomsCache->fill_id.init(cx, "fill") ||
      94           0 :       !atomsCache->endDelay_id.init(cx, "endDelay") ||
      95           0 :       !atomsCache->easing_id.init(cx, "easing") ||
      96           0 :       !atomsCache->duration_id.init(cx, "duration") ||
      97           0 :       !atomsCache->direction_id.init(cx, "direction") ||
      98           0 :       !atomsCache->delay_id.init(cx, "delay")) {
      99           0 :     return false;
     100             :   }
     101           0 :   return true;
     102             : }
     103             : 
     104             : bool
     105           0 : AnimationEffectTimingProperties::Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
     106             : {
     107             :   // Passing a null JSContext is OK only if we're initing from null,
     108             :   // Since in that case we will not have to do any property gets
     109             :   // Also evaluate isNullOrUndefined in order to avoid false-positive
     110             :   // checkers by static analysis tools
     111           0 :   MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined());
     112           0 :   AnimationEffectTimingPropertiesAtoms* atomsCache = nullptr;
     113           0 :   if (cx) {
     114           0 :     atomsCache = GetAtomCache<AnimationEffectTimingPropertiesAtoms>(cx);
     115           0 :     if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
     116           0 :       return false;
     117             :     }
     118             :   }
     119             : 
     120           0 :   if (!IsConvertibleToDictionary(val)) {
     121           0 :     return ThrowErrorMessage(cx, MSG_NOT_DICTIONARY, sourceDescription);
     122             :   }
     123             : 
     124           0 :   bool isNull = val.isNullOrUndefined();
     125             :   // We only need these if !isNull, in which case we have |cx|.
     126           0 :   Maybe<JS::Rooted<JSObject *> > object;
     127           0 :   Maybe<JS::Rooted<JS::Value> > temp;
     128           0 :   if (!isNull) {
     129           0 :     MOZ_ASSERT(cx);
     130           0 :     object.emplace(cx, &val.toObject());
     131           0 :     temp.emplace(cx);
     132             :   }
     133           0 :   if (!isNull) {
     134           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->delay_id, temp.ptr())) {
     135           0 :       return false;
     136             :     }
     137             :   }
     138           0 :   if (!isNull && !temp->isUndefined()) {
     139           0 :     if (!ValueToPrimitive<double, eDefault>(cx, temp.ref(), &mDelay)) {
     140           0 :       return false;
     141           0 :     } else if (!mozilla::IsFinite(mDelay)) {
     142           0 :       ThrowErrorMessage(cx, MSG_NOT_FINITE, "'delay' member of AnimationEffectTimingProperties");
     143           0 :       return false;
     144             :     }
     145             :   } else {
     146           0 :     mDelay = 0.0;
     147             :   }
     148           0 :   mIsAnyMemberPresent = true;
     149             : 
     150           0 :   if (!isNull) {
     151           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->direction_id, temp.ptr())) {
     152           0 :       return false;
     153             :     }
     154             :   }
     155           0 :   if (!isNull && !temp->isUndefined()) {
     156             :     {
     157             :       int index;
     158           0 :       if (!FindEnumStringIndex<true>(cx, temp.ref(), PlaybackDirectionValues::strings, "PlaybackDirection", "'direction' member of AnimationEffectTimingProperties", &index)) {
     159           0 :         return false;
     160             :       }
     161           0 :       MOZ_ASSERT(index >= 0);
     162           0 :       mDirection = static_cast<PlaybackDirection>(index);
     163             :     }
     164             :   } else {
     165           0 :     mDirection = PlaybackDirection::Normal;
     166             :   }
     167           0 :   mIsAnyMemberPresent = true;
     168             : 
     169           0 :   if (!isNull) {
     170           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->duration_id, temp.ptr())) {
     171           0 :       return false;
     172             :     }
     173             :   }
     174           0 :   mDuration.Uninit();
     175           0 :   if (!(!isNull && !temp->isUndefined())) {
     176             :     static const char16_t data[] = { 'a', 'u', 't', 'o', 0 };
     177           0 :     mDuration.SetStringData(data, ArrayLength(data) - 1);
     178             :   } else {
     179             :     {
     180           0 :       bool done = false, failed = false, tryNext;
     181             :       do {
     182           0 :         if (temp.ref().isNumber()) {
     183           0 :           done = (failed = !mDuration.TrySetToUnrestrictedDouble(cx, temp.ref(), tryNext)) || !tryNext;
     184           0 :           break;
     185             :         }
     186           0 :         done = (failed = !mDuration.TrySetToString(cx, temp.ref(), tryNext)) || !tryNext;
     187           0 :         break;
     188             :       } while (0);
     189           0 :       if (failed) {
     190           0 :         return false;
     191             :       }
     192           0 :       if (!done) {
     193           0 :         ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "'duration' member of AnimationEffectTimingProperties", "");
     194           0 :         return false;
     195             :       }
     196             :     }
     197             :   }
     198           0 :   mIsAnyMemberPresent = true;
     199             : 
     200           0 :   if (!isNull) {
     201           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->easing_id, temp.ptr())) {
     202           0 :       return false;
     203             :     }
     204             :   }
     205           0 :   if (!isNull && !temp->isUndefined()) {
     206           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mEasing)) {
     207           0 :       return false;
     208             :     }
     209             :   } else {
     210             :     static const char16_t data[] = { 'l', 'i', 'n', 'e', 'a', 'r', 0 };
     211           0 :     mEasing.Rebind(data, ArrayLength(data) - 1);
     212             :   }
     213           0 :   mIsAnyMemberPresent = true;
     214             : 
     215           0 :   if (!isNull) {
     216           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->endDelay_id, temp.ptr())) {
     217           0 :       return false;
     218             :     }
     219             :   }
     220           0 :   if (!isNull && !temp->isUndefined()) {
     221           0 :     if (!ValueToPrimitive<double, eDefault>(cx, temp.ref(), &mEndDelay)) {
     222           0 :       return false;
     223           0 :     } else if (!mozilla::IsFinite(mEndDelay)) {
     224           0 :       ThrowErrorMessage(cx, MSG_NOT_FINITE, "'endDelay' member of AnimationEffectTimingProperties");
     225           0 :       return false;
     226             :     }
     227             :   } else {
     228           0 :     mEndDelay = 0.0;
     229             :   }
     230           0 :   mIsAnyMemberPresent = true;
     231             : 
     232           0 :   if (!isNull) {
     233           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->fill_id, temp.ptr())) {
     234           0 :       return false;
     235             :     }
     236             :   }
     237           0 :   if (!isNull && !temp->isUndefined()) {
     238             :     {
     239             :       int index;
     240           0 :       if (!FindEnumStringIndex<true>(cx, temp.ref(), FillModeValues::strings, "FillMode", "'fill' member of AnimationEffectTimingProperties", &index)) {
     241           0 :         return false;
     242             :       }
     243           0 :       MOZ_ASSERT(index >= 0);
     244           0 :       mFill = static_cast<FillMode>(index);
     245             :     }
     246             :   } else {
     247           0 :     mFill = FillMode::Auto;
     248             :   }
     249           0 :   mIsAnyMemberPresent = true;
     250             : 
     251           0 :   if (!isNull) {
     252           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->iterationStart_id, temp.ptr())) {
     253           0 :       return false;
     254             :     }
     255             :   }
     256           0 :   if (!isNull && !temp->isUndefined()) {
     257           0 :     if (!ValueToPrimitive<double, eDefault>(cx, temp.ref(), &mIterationStart)) {
     258           0 :       return false;
     259           0 :     } else if (!mozilla::IsFinite(mIterationStart)) {
     260           0 :       ThrowErrorMessage(cx, MSG_NOT_FINITE, "'iterationStart' member of AnimationEffectTimingProperties");
     261           0 :       return false;
     262             :     }
     263             :   } else {
     264           0 :     mIterationStart = 0.0;
     265             :   }
     266           0 :   mIsAnyMemberPresent = true;
     267             : 
     268           0 :   if (!isNull) {
     269           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->iterations_id, temp.ptr())) {
     270           0 :       return false;
     271             :     }
     272             :   }
     273           0 :   if (!isNull && !temp->isUndefined()) {
     274           0 :     if (!ValueToPrimitive<double, eDefault>(cx, temp.ref(), &mIterations)) {
     275           0 :       return false;
     276             :     }
     277             :   } else {
     278           0 :     mIterations = 1.0;
     279             :   }
     280           0 :   mIsAnyMemberPresent = true;
     281           0 :   return true;
     282             : }
     283             : 
     284             : bool
     285           0 : AnimationEffectTimingProperties::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
     286             : {
     287           0 :   AnimationEffectTimingPropertiesAtoms* atomsCache = GetAtomCache<AnimationEffectTimingPropertiesAtoms>(cx);
     288           0 :   if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
     289           0 :     return false;
     290             :   }
     291             : 
     292           0 :   JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
     293           0 :   if (!obj) {
     294           0 :     return false;
     295             :   }
     296           0 :   rval.set(JS::ObjectValue(*obj));
     297             : 
     298             :   do {
     299             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     300           0 :     JS::Rooted<JS::Value> temp(cx);
     301           0 :     double const & currentValue = mDelay;
     302           0 :     temp.set(JS_NumberValue(double(currentValue)));
     303           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->delay_id, temp, JSPROP_ENUMERATE)) {
     304           0 :       return false;
     305             :     }
     306           0 :     break;
     307             :   } while(0);
     308             : 
     309             :   do {
     310             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     311           0 :     JS::Rooted<JS::Value> temp(cx);
     312           0 :     PlaybackDirection const & currentValue = mDirection;
     313           0 :     if (!ToJSValue(cx, currentValue, &temp)) {
     314           0 :       return false;
     315             :     }
     316           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->direction_id, temp, JSPROP_ENUMERATE)) {
     317           0 :       return false;
     318             :     }
     319           0 :     break;
     320             :   } while(0);
     321             : 
     322             :   do {
     323             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     324           0 :     JS::Rooted<JS::Value> temp(cx);
     325           0 :     OwningUnrestrictedDoubleOrString const & currentValue = mDuration;
     326           0 :     if (!currentValue.ToJSVal(cx, obj, &temp)) {
     327           0 :       return false;
     328             :     }
     329           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->duration_id, temp, JSPROP_ENUMERATE)) {
     330           0 :       return false;
     331             :     }
     332           0 :     break;
     333             :   } while(0);
     334             : 
     335             :   do {
     336             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     337           0 :     JS::Rooted<JS::Value> temp(cx);
     338           0 :     nsString const & currentValue = mEasing;
     339           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
     340           0 :       return false;
     341             :     }
     342           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->easing_id, temp, JSPROP_ENUMERATE)) {
     343           0 :       return false;
     344             :     }
     345           0 :     break;
     346             :   } while(0);
     347             : 
     348             :   do {
     349             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     350           0 :     JS::Rooted<JS::Value> temp(cx);
     351           0 :     double const & currentValue = mEndDelay;
     352           0 :     temp.set(JS_NumberValue(double(currentValue)));
     353           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->endDelay_id, temp, JSPROP_ENUMERATE)) {
     354           0 :       return false;
     355             :     }
     356           0 :     break;
     357             :   } while(0);
     358             : 
     359             :   do {
     360             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     361           0 :     JS::Rooted<JS::Value> temp(cx);
     362           0 :     FillMode const & currentValue = mFill;
     363           0 :     if (!ToJSValue(cx, currentValue, &temp)) {
     364           0 :       return false;
     365             :     }
     366           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->fill_id, temp, JSPROP_ENUMERATE)) {
     367           0 :       return false;
     368             :     }
     369           0 :     break;
     370             :   } while(0);
     371             : 
     372             :   do {
     373             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     374           0 :     JS::Rooted<JS::Value> temp(cx);
     375           0 :     double const & currentValue = mIterationStart;
     376           0 :     temp.set(JS_NumberValue(double(currentValue)));
     377           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->iterationStart_id, temp, JSPROP_ENUMERATE)) {
     378           0 :       return false;
     379             :     }
     380           0 :     break;
     381             :   } while(0);
     382             : 
     383             :   do {
     384             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     385           0 :     JS::Rooted<JS::Value> temp(cx);
     386           0 :     double const & currentValue = mIterations;
     387           0 :     temp.set(JS_NumberValue(double(currentValue)));
     388           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->iterations_id, temp, JSPROP_ENUMERATE)) {
     389           0 :       return false;
     390             :     }
     391           0 :     break;
     392             :   } while(0);
     393             : 
     394           0 :   return true;
     395             : }
     396             : 
     397             : void
     398           0 : AnimationEffectTimingProperties::TraceDictionary(JSTracer* trc)
     399             : {
     400           0 : }
     401             : 
     402             : AnimationEffectTimingProperties&
     403           0 : AnimationEffectTimingProperties::operator=(const AnimationEffectTimingProperties& aOther)
     404             : {
     405           0 :   mDelay = aOther.mDelay;
     406           0 :   mDirection = aOther.mDirection;
     407           0 :   mDuration = aOther.mDuration;
     408           0 :   mEasing = aOther.mEasing;
     409           0 :   mEndDelay = aOther.mEndDelay;
     410           0 :   mFill = aOther.mFill;
     411           0 :   mIterationStart = aOther.mIterationStart;
     412           0 :   mIterations = aOther.mIterations;
     413           0 :   return *this;
     414             : }
     415             : 
     416             : namespace binding_detail {
     417             : } // namespace binding_detail
     418             : 
     419             : 
     420             : 
     421           0 : ComputedTimingProperties::ComputedTimingProperties()
     422           0 :   : AnimationEffectTimingProperties(FastDictionaryInitializer())
     423             : {
     424             :   // Safe to pass a null context if we pass a null value
     425           0 :   Init(nullptr, JS::NullHandleValue);
     426           0 : }
     427             : 
     428             : 
     429             : 
     430             : bool
     431           0 : ComputedTimingProperties::InitIds(JSContext* cx, ComputedTimingPropertiesAtoms* atomsCache)
     432             : {
     433           0 :   MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache));
     434             : 
     435             :   // Initialize these in reverse order so that any failure leaves the first one
     436             :   // uninitialized.
     437           0 :   if (!atomsCache->progress_id.init(cx, "progress") ||
     438           0 :       !atomsCache->localTime_id.init(cx, "localTime") ||
     439           0 :       !atomsCache->endTime_id.init(cx, "endTime") ||
     440           0 :       !atomsCache->currentIteration_id.init(cx, "currentIteration") ||
     441           0 :       !atomsCache->activeDuration_id.init(cx, "activeDuration")) {
     442           0 :     return false;
     443             :   }
     444           0 :   return true;
     445             : }
     446             : 
     447             : bool
     448           0 : ComputedTimingProperties::Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
     449             : {
     450             :   // Passing a null JSContext is OK only if we're initing from null,
     451             :   // Since in that case we will not have to do any property gets
     452             :   // Also evaluate isNullOrUndefined in order to avoid false-positive
     453             :   // checkers by static analysis tools
     454           0 :   MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined());
     455           0 :   ComputedTimingPropertiesAtoms* atomsCache = nullptr;
     456           0 :   if (cx) {
     457           0 :     atomsCache = GetAtomCache<ComputedTimingPropertiesAtoms>(cx);
     458           0 :     if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
     459           0 :       return false;
     460             :     }
     461             :   }
     462             : 
     463             :   // Per spec, we init the parent's members first
     464           0 :   if (!AnimationEffectTimingProperties::Init(cx, val)) {
     465           0 :     return false;
     466             :   }
     467             : 
     468           0 :   bool isNull = val.isNullOrUndefined();
     469             :   // We only need these if !isNull, in which case we have |cx|.
     470           0 :   Maybe<JS::Rooted<JSObject *> > object;
     471           0 :   Maybe<JS::Rooted<JS::Value> > temp;
     472           0 :   if (!isNull) {
     473           0 :     MOZ_ASSERT(cx);
     474           0 :     object.emplace(cx, &val.toObject());
     475           0 :     temp.emplace(cx);
     476             :   }
     477           0 :   if (!isNull) {
     478           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->activeDuration_id, temp.ptr())) {
     479           0 :       return false;
     480             :     }
     481             :   }
     482           0 :   if (!isNull && !temp->isUndefined()) {
     483           0 :     if (!ValueToPrimitive<double, eDefault>(cx, temp.ref(), &mActiveDuration)) {
     484           0 :       return false;
     485             :     }
     486             :   } else {
     487           0 :     mActiveDuration = 0.0;
     488             :   }
     489           0 :   mIsAnyMemberPresent = true;
     490             : 
     491           0 :   if (!isNull) {
     492           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->currentIteration_id, temp.ptr())) {
     493           0 :       return false;
     494             :     }
     495             :   }
     496           0 :   if (!(!isNull && !temp->isUndefined()) || temp.ref().isNullOrUndefined()) {
     497           0 :     mCurrentIteration.SetNull();
     498           0 :   } else if (!ValueToPrimitive<double, eDefault>(cx, temp.ref(), &mCurrentIteration.SetValue())) {
     499           0 :     return false;
     500             :   }
     501           0 :   mIsAnyMemberPresent = true;
     502             : 
     503           0 :   if (!isNull) {
     504           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->endTime_id, temp.ptr())) {
     505           0 :       return false;
     506             :     }
     507             :   }
     508           0 :   if (!isNull && !temp->isUndefined()) {
     509           0 :     if (!ValueToPrimitive<double, eDefault>(cx, temp.ref(), &mEndTime)) {
     510           0 :       return false;
     511             :     }
     512             :   } else {
     513           0 :     mEndTime = 0.0;
     514             :   }
     515           0 :   mIsAnyMemberPresent = true;
     516             : 
     517           0 :   if (!isNull) {
     518           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->localTime_id, temp.ptr())) {
     519           0 :       return false;
     520             :     }
     521             :   }
     522           0 :   if (!(!isNull && !temp->isUndefined()) || temp.ref().isNullOrUndefined()) {
     523           0 :     mLocalTime.SetNull();
     524           0 :   } else if (!ValueToPrimitive<double, eDefault>(cx, temp.ref(), &mLocalTime.SetValue())) {
     525           0 :     return false;
     526           0 :   } else if (!mozilla::IsFinite(mLocalTime.Value())) {
     527           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "'localTime' member of ComputedTimingProperties");
     528           0 :     return false;
     529             :   }
     530           0 :   mIsAnyMemberPresent = true;
     531             : 
     532           0 :   if (!isNull) {
     533           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->progress_id, temp.ptr())) {
     534           0 :       return false;
     535             :     }
     536             :   }
     537           0 :   if (!(!isNull && !temp->isUndefined()) || temp.ref().isNullOrUndefined()) {
     538           0 :     mProgress.SetNull();
     539           0 :   } else if (!ValueToPrimitive<double, eDefault>(cx, temp.ref(), &mProgress.SetValue())) {
     540           0 :     return false;
     541           0 :   } else if (!mozilla::IsFinite(mProgress.Value())) {
     542           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "'progress' member of ComputedTimingProperties");
     543           0 :     return false;
     544             :   }
     545           0 :   mIsAnyMemberPresent = true;
     546           0 :   return true;
     547             : }
     548             : 
     549             : bool
     550           0 : ComputedTimingProperties::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
     551             : {
     552           0 :   ComputedTimingPropertiesAtoms* atomsCache = GetAtomCache<ComputedTimingPropertiesAtoms>(cx);
     553           0 :   if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
     554           0 :     return false;
     555             :   }
     556             : 
     557             :   // Per spec, we define the parent's members first
     558           0 :   if (!AnimationEffectTimingProperties::ToObjectInternal(cx, rval)) {
     559           0 :     return false;
     560             :   }
     561           0 :   JS::Rooted<JSObject*> obj(cx, &rval.toObject());
     562             : 
     563             :   do {
     564             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     565           0 :     JS::Rooted<JS::Value> temp(cx);
     566           0 :     double const & currentValue = mActiveDuration;
     567           0 :     temp.set(JS_NumberValue(double(currentValue)));
     568           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->activeDuration_id, temp, JSPROP_ENUMERATE)) {
     569           0 :       return false;
     570             :     }
     571           0 :     break;
     572             :   } while(0);
     573             : 
     574             :   do {
     575             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     576           0 :     JS::Rooted<JS::Value> temp(cx);
     577           0 :     Nullable<double> const & currentValue = mCurrentIteration;
     578           0 :     if (currentValue.IsNull()) {
     579           0 :       temp.setNull();
     580           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->currentIteration_id, temp, JSPROP_ENUMERATE)) {
     581           0 :         return false;
     582             :       }
     583           0 :       break;
     584             :     }
     585           0 :     temp.set(JS_NumberValue(double(currentValue.Value())));
     586           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->currentIteration_id, temp, JSPROP_ENUMERATE)) {
     587           0 :       return false;
     588             :     }
     589           0 :     break;
     590             :   } while(0);
     591             : 
     592             :   do {
     593             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     594           0 :     JS::Rooted<JS::Value> temp(cx);
     595           0 :     double const & currentValue = mEndTime;
     596           0 :     temp.set(JS_NumberValue(double(currentValue)));
     597           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->endTime_id, temp, JSPROP_ENUMERATE)) {
     598           0 :       return false;
     599             :     }
     600           0 :     break;
     601             :   } while(0);
     602             : 
     603             :   do {
     604             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     605           0 :     JS::Rooted<JS::Value> temp(cx);
     606           0 :     Nullable<double> const & currentValue = mLocalTime;
     607           0 :     if (currentValue.IsNull()) {
     608           0 :       temp.setNull();
     609           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->localTime_id, temp, JSPROP_ENUMERATE)) {
     610           0 :         return false;
     611             :       }
     612           0 :       break;
     613             :     }
     614           0 :     temp.set(JS_NumberValue(double(currentValue.Value())));
     615           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->localTime_id, temp, JSPROP_ENUMERATE)) {
     616           0 :       return false;
     617             :     }
     618           0 :     break;
     619             :   } while(0);
     620             : 
     621             :   do {
     622             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     623           0 :     JS::Rooted<JS::Value> temp(cx);
     624           0 :     Nullable<double> const & currentValue = mProgress;
     625           0 :     if (currentValue.IsNull()) {
     626           0 :       temp.setNull();
     627           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->progress_id, temp, JSPROP_ENUMERATE)) {
     628           0 :         return false;
     629             :       }
     630           0 :       break;
     631             :     }
     632           0 :     temp.set(JS_NumberValue(double(currentValue.Value())));
     633           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->progress_id, temp, JSPROP_ENUMERATE)) {
     634           0 :       return false;
     635             :     }
     636           0 :     break;
     637             :   } while(0);
     638             : 
     639           0 :   return true;
     640             : }
     641             : 
     642             : void
     643           0 : ComputedTimingProperties::TraceDictionary(JSTracer* trc)
     644             : {
     645           0 :   AnimationEffectTimingProperties::TraceDictionary(trc);
     646           0 : }
     647             : 
     648             : ComputedTimingProperties&
     649           0 : ComputedTimingProperties::operator=(const ComputedTimingProperties& aOther)
     650             : {
     651           0 :   AnimationEffectTimingProperties::operator=(aOther);
     652           0 :   mActiveDuration = aOther.mActiveDuration;
     653           0 :   mCurrentIteration = aOther.mCurrentIteration;
     654           0 :   mEndTime = aOther.mEndTime;
     655           0 :   mLocalTime = aOther.mLocalTime;
     656           0 :   mProgress = aOther.mProgress;
     657           0 :   return *this;
     658             : }
     659             : 
     660             : namespace binding_detail {
     661             : } // namespace binding_detail
     662             : 
     663             : 
     664             : namespace AnimationEffectReadOnlyBinding {
     665             : 
     666             : static bool
     667           0 : get_timing(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AnimationEffectReadOnly* self, JSJitGetterCallArgs args)
     668             : {
     669             :   // Have to either root across the getter call or reget after.
     670           0 :   JS::Rooted<JSObject*> slotStorage(cx, js::UncheckedUnwrap(obj, /* stopAtWindowProxy = */ false));
     671           0 :   MOZ_ASSERT(IsDOMObject(slotStorage));
     672           0 :   const size_t slotIndex = (DOM_INSTANCE_RESERVED_SLOTS + 0);
     673           0 :   MOZ_ASSERT(JSCLASS_RESERVED_SLOTS(js::GetObjectClass(slotStorage)) > slotIndex);
     674             :   {
     675             :     // Scope for cachedVal
     676           0 :     JS::Value cachedVal = js::GetReservedSlot(slotStorage, slotIndex);
     677           0 :     if (!cachedVal.isUndefined()) {
     678           0 :       args.rval().set(cachedVal);
     679             :       // The cached value is in the compartment of slotStorage,
     680             :       // so wrap into the caller compartment as needed.
     681           0 :       return MaybeWrapValue(cx, args.rval());
     682             :     }
     683             :   }
     684             : 
     685           0 :   auto result(StrongOrRawPtr<mozilla::dom::AnimationEffectTimingReadOnly>(self->Timing()));
     686           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     687             :   {
     688           0 :     JS::Rooted<JSObject*> conversionScope(cx, slotStorage);
     689           0 :     JSAutoCompartment ac(cx, conversionScope);
     690             :     do { // block we break out of when done wrapping
     691           0 :       if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     692           0 :         MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     693           0 :         return false;
     694             :       }
     695           0 :       break;
     696             :     } while (0);
     697             :   }
     698             :   { // And now store things in the compartment of our slotStorage.
     699           0 :     JSAutoCompartment ac(cx, slotStorage);
     700             :     // Make a copy so that we don't do unnecessary wrapping on args.rval().
     701           0 :     JS::Rooted<JS::Value> storedVal(cx, args.rval());
     702           0 :     if (!MaybeWrapValue(cx, &storedVal)) {
     703           0 :       return false;
     704             :     }
     705           0 :     js::SetReservedSlot(slotStorage, slotIndex, storedVal);
     706           0 :     PreserveWrapper(self);
     707             :   }
     708             :   // And now make sure args.rval() is in the caller compartment
     709           0 :   return MaybeWrapValue(cx, args.rval());
     710             : }
     711             : 
     712             : static const JSJitInfo timing_getterinfo = {
     713             :   { (JSJitGetterOp)get_timing },
     714             :   { prototypes::id::AnimationEffectReadOnly },
     715             :   { PrototypeTraits<prototypes::id::AnimationEffectReadOnly>::Depth },
     716             :   JSJitInfo::Getter,
     717             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     718             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     719             :   false,  /* isInfallible. False in setters. */
     720             :   true,  /* isMovable.  Not relevant for setters. */
     721             :   true, /* isEliminatable.  Not relevant for setters. */
     722             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     723             :   true, /* isLazilyCachedInSlot.  Only relevant for getters. */
     724             :   false,  /* isTypedMethod.  Only relevant for methods. */
     725             :   (DOM_INSTANCE_RESERVED_SLOTS + 0)   /* Reserved slot index, if we're stored in a slot, else 0. */
     726             : };
     727             : static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) <= JSJitInfo::maxSlotIndex, "We won't fit");
     728             : static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) < 2, "There is no slot for us");
     729             : 
     730             : static bool
     731           0 : getComputedTiming(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AnimationEffectReadOnly* self, const JSJitMethodCallArgs& args)
     732             : {
     733           0 :   ComputedTimingProperties result;
     734           0 :   self->GetComputedTimingAsDict(result);
     735           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     736           0 :   if (!result.ToObjectInternal(cx, args.rval())) {
     737           0 :     return false;
     738             :   }
     739           0 :   return true;
     740             : }
     741             : 
     742             : static const JSJitInfo getComputedTiming_methodinfo = {
     743             :   { (JSJitGetterOp)getComputedTiming },
     744             :   { prototypes::id::AnimationEffectReadOnly },
     745             :   { PrototypeTraits<prototypes::id::AnimationEffectReadOnly>::Depth },
     746             :   JSJitInfo::Method,
     747             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     748             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     749             :   false,  /* isInfallible. False in setters. */
     750             :   false,  /* isMovable.  Not relevant for setters. */
     751             :   false, /* isEliminatable.  Not relevant for setters. */
     752             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     753             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     754             :   false,  /* isTypedMethod.  Only relevant for methods. */
     755             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     756             : };
     757             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     758             : static_assert(0 < 2, "There is no slot for us");
     759             : 
     760             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     761             : #if defined(__clang__)
     762             : #pragma clang diagnostic push
     763             : #pragma clang diagnostic ignored "-Wmissing-braces"
     764             : #endif
     765             : static const JSFunctionSpec sMethods_specs[] = {
     766             :   JS_FNSPEC("getComputedTiming", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getComputedTiming_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
     767             :   JS_FS_END
     768             : };
     769             : #if defined(__clang__)
     770             : #pragma clang diagnostic pop
     771             : #endif
     772             : 
     773             : 
     774             : // Can't be const because the pref-enabled boolean needs to be writable
     775             : static Prefable<const JSFunctionSpec> sMethods[] = {
     776             :   { nullptr, &sMethods_specs[0] },
     777             :   { nullptr, nullptr }
     778             : };
     779             : 
     780             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     781             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     782             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     783             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     784             : 
     785             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     786             : #if defined(__clang__)
     787             : #pragma clang diagnostic push
     788             : #pragma clang diagnostic ignored "-Wmissing-braces"
     789             : #endif
     790             : static const JSPropertySpec sAttributes_specs[] = {
     791             :   { "timing", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &timing_getterinfo, nullptr, nullptr },
     792             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     793             : };
     794             : #if defined(__clang__)
     795             : #pragma clang diagnostic pop
     796             : #endif
     797             : 
     798             : 
     799             : // Can't be const because the pref-enabled boolean needs to be writable
     800             : static Prefable<const JSPropertySpec> sAttributes[] = {
     801             :   { nullptr, &sAttributes_specs[0] },
     802             :   { nullptr, nullptr }
     803             : };
     804             : 
     805             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     806             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     807             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     808             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     809             : 
     810             : 
     811             : static uint16_t sNativeProperties_sortedPropertyIndices[2];
     812             : static PropertyInfo sNativeProperties_propertyInfos[2];
     813             : 
     814             : static const NativePropertiesN<2> sNativeProperties = {
     815             :   false, 0,
     816             :   false, 0,
     817             :   true,  0 /* sMethods */,
     818             :   true,  1 /* sAttributes */,
     819             :   false, 0,
     820             :   false, 0,
     821             :   false, 0,
     822             :   -1,
     823             :   2,
     824             :   sNativeProperties_sortedPropertyIndices,
     825             :   {
     826             :     { sMethods, &sNativeProperties_propertyInfos[0] },
     827             :     { sAttributes, &sNativeProperties_propertyInfos[1] }
     828             :   }
     829             : };
     830             : static_assert(2 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     831             :     "We have a property info count that is oversized");
     832             : 
     833             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     834             :   {
     835             :     "Function",
     836             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     837             :     &sBoringInterfaceObjectClassClassOps,
     838             :     JS_NULL_CLASS_SPEC,
     839             :     JS_NULL_CLASS_EXT,
     840             :     &sInterfaceObjectClassObjectOps
     841             :   },
     842             :   eInterface,
     843             :   true,
     844             :   prototypes::id::AnimationEffectReadOnly,
     845             :   PrototypeTraits<prototypes::id::AnimationEffectReadOnly>::Depth,
     846             :   sNativePropertyHooks,
     847             :   "function AnimationEffectReadOnly() {\n    [native code]\n}",
     848             :   JS::GetRealmFunctionPrototype
     849             : };
     850             : 
     851             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     852             :   {
     853             :     "AnimationEffectReadOnlyPrototype",
     854             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     855             :     JS_NULL_CLASS_OPS,
     856             :     JS_NULL_CLASS_SPEC,
     857             :     JS_NULL_CLASS_EXT,
     858             :     JS_NULL_OBJECT_OPS
     859             :   },
     860             :   eInterfacePrototype,
     861             :   false,
     862             :   prototypes::id::AnimationEffectReadOnly,
     863             :   PrototypeTraits<prototypes::id::AnimationEffectReadOnly>::Depth,
     864             :   sNativePropertyHooks,
     865             :   "[object AnimationEffectReadOnlyPrototype]",
     866             :   JS::GetRealmObjectPrototype
     867             : };
     868             : 
     869             : bool
     870           0 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
     871             : {
     872           0 :   return nsDocument::IsWebAnimationsEnabled(aCx, aObj);
     873             : }
     874             : 
     875             : JSObject*
     876           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     877             : {
     878           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     879             : }
     880             : 
     881             : // This may allocate too many slots, because we only really need
     882             : // slots for our non-interface-typed members that we cache.  But
     883             : // allocating slots only for those would make the slot index
     884             : // computations much more complicated, so let's do this the simple
     885             : // way for now.
     886             : DEFINE_XRAY_EXPANDO_CLASS(static, sXrayExpandoObjectClass, 1);
     887             : 
     888             : const NativePropertyHooks sNativePropertyHooks[] = { {
     889             :   nullptr,
     890             :   nullptr,
     891             :   nullptr,
     892             :   { sNativeProperties.Upcast(), nullptr },
     893             :   prototypes::id::AnimationEffectReadOnly,
     894             :   constructors::id::AnimationEffectReadOnly,
     895             :   nullptr,
     896             :   &sXrayExpandoObjectClass
     897             : } };
     898             : 
     899             : void
     900           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     901             : {
     902           0 :   JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
     903           0 :   if (!parentProto) {
     904           0 :     return;
     905             :   }
     906             : 
     907           0 :   JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
     908           0 :   if (!constructorProto) {
     909           0 :     return;
     910             :   }
     911             : 
     912             :   static bool sIdsInited = false;
     913           0 :   if (!sIdsInited && NS_IsMainThread()) {
     914           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     915           0 :       return;
     916             :     }
     917           0 :     sIdsInited = true;
     918             :   }
     919             : 
     920           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::AnimationEffectReadOnly);
     921           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::AnimationEffectReadOnly);
     922           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     923             :                               &sPrototypeClass.mBase, protoCache,
     924             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     925             :                               interfaceCache,
     926             :                               sNativeProperties.Upcast(),
     927             :                               nullptr,
     928             :                               "AnimationEffectReadOnly", aDefineOnGlobal,
     929             :                               nullptr,
     930           0 :                               false);
     931             : }
     932             : 
     933             : JS::Handle<JSObject*>
     934           0 : GetProtoObjectHandle(JSContext* aCx)
     935             : {
     936             :   /* Get the interface prototype object for this class.  This will create the
     937             :      object as needed. */
     938           0 :   bool aDefineOnGlobal = true;
     939             : 
     940             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     941           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     942           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     943           0 :     return nullptr;
     944             :   }
     945             : 
     946             :   /* Check to see whether the interface objects are already installed */
     947           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     948           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::AnimationEffectReadOnly)) {
     949           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     950           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     951             :   }
     952             : 
     953             :   /*
     954             :    * The object might _still_ be null, but that's OK.
     955             :    *
     956             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     957             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     958             :    * changed after they have been set.
     959             :    *
     960             :    * Calling address() avoids the read read barrier that does gray
     961             :    * unmarking, but it's not possible for the object to be gray here.
     962             :    */
     963             : 
     964           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::AnimationEffectReadOnly);
     965           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     966           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     967             : }
     968             : 
     969             : JSObject*
     970           0 : GetProtoObject(JSContext* aCx)
     971             : {
     972           0 :   return GetProtoObjectHandle(aCx);
     973             : }
     974             : 
     975             : JS::Handle<JSObject*>
     976           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     977             : {
     978             :   /* Get the interface object for this class.  This will create the object as
     979             :      needed. */
     980             : 
     981             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     982           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     983           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     984           0 :     return nullptr;
     985             :   }
     986             : 
     987             :   /* Check to see whether the interface objects are already installed */
     988           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     989           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::AnimationEffectReadOnly)) {
     990           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     991           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     992             :   }
     993             : 
     994             :   /*
     995             :    * The object might _still_ be null, but that's OK.
     996             :    *
     997             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     998             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     999             :    * changed after they have been set.
    1000             :    *
    1001             :    * Calling address() avoids the read read barrier that does gray
    1002             :    * unmarking, but it's not possible for the object to be gray here.
    1003             :    */
    1004             : 
    1005           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::AnimationEffectReadOnly);
    1006           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    1007           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    1008             : }
    1009             : 
    1010             : JSObject*
    1011           0 : GetConstructorObject(JSContext* aCx)
    1012             : {
    1013           0 :   return GetConstructorObjectHandle(aCx);
    1014             : }
    1015             : 
    1016             : } // namespace AnimationEffectReadOnlyBinding
    1017             : 
    1018             : 
    1019             : 
    1020             : } // namespace dom
    1021             : } // namespace mozilla

Generated by: LCOV version 1.13