LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dom/bindings - IIRFilterNodeBinding.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 349 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 IIRFilterNode.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "AtomList.h"
       4             : #include "AudioNodeBinding.h"
       5             : #include "IIRFilterNodeBinding.h"
       6             : #include "WrapperFactory.h"
       7             : #include "jsfriendapi.h"
       8             : #include "mozilla/FloatingPoint.h"
       9             : #include "mozilla/OwningNonNull.h"
      10             : #include "mozilla/Preferences.h"
      11             : #include "mozilla/dom/AudioContext.h"
      12             : #include "mozilla/dom/BindingUtils.h"
      13             : #include "mozilla/dom/DOMJSClass.h"
      14             : #include "mozilla/dom/IIRFilterNode.h"
      15             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      16             : #include "mozilla/dom/PrimitiveConversions.h"
      17             : #include "mozilla/dom/ScriptSettings.h"
      18             : #include "mozilla/dom/SimpleGlobalObject.h"
      19             : #include "mozilla/dom/TypedArray.h"
      20             : #include "mozilla/dom/XrayExpandoClass.h"
      21             : #include "nsContentUtils.h"
      22             : 
      23             : namespace mozilla {
      24             : namespace dom {
      25             : 
      26             : 
      27           0 : IIRFilterOptions::IIRFilterOptions()
      28           0 :   : AudioNodeOptions(FastDictionaryInitializer())
      29             : {
      30             :   // Safe to pass a null context if we pass a null value
      31           0 :   Init(nullptr, JS::NullHandleValue);
      32           0 : }
      33             : 
      34             : 
      35             : 
      36             : bool
      37           0 : IIRFilterOptions::InitIds(JSContext* cx, IIRFilterOptionsAtoms* atomsCache)
      38             : {
      39           0 :   MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache));
      40             : 
      41             :   // Initialize these in reverse order so that any failure leaves the first one
      42             :   // uninitialized.
      43           0 :   if (!atomsCache->feedforward_id.init(cx, "feedforward") ||
      44           0 :       !atomsCache->feedback_id.init(cx, "feedback")) {
      45           0 :     return false;
      46             :   }
      47           0 :   return true;
      48             : }
      49             : 
      50             : bool
      51           0 : IIRFilterOptions::Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
      52             : {
      53             :   // Passing a null JSContext is OK only if we're initing from null,
      54             :   // Since in that case we will not have to do any property gets
      55             :   // Also evaluate isNullOrUndefined in order to avoid false-positive
      56             :   // checkers by static analysis tools
      57           0 :   MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined());
      58           0 :   IIRFilterOptionsAtoms* atomsCache = nullptr;
      59           0 :   if (cx) {
      60           0 :     atomsCache = GetAtomCache<IIRFilterOptionsAtoms>(cx);
      61           0 :     if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
      62           0 :       return false;
      63             :     }
      64             :   }
      65             : 
      66             :   // Per spec, we init the parent's members first
      67           0 :   if (!AudioNodeOptions::Init(cx, val)) {
      68           0 :     return false;
      69             :   }
      70             : 
      71           0 :   bool isNull = val.isNullOrUndefined();
      72             :   // We only need these if !isNull, in which case we have |cx|.
      73           0 :   Maybe<JS::Rooted<JSObject *> > object;
      74           0 :   Maybe<JS::Rooted<JS::Value> > temp;
      75           0 :   if (!isNull) {
      76           0 :     MOZ_ASSERT(cx);
      77           0 :     object.emplace(cx, &val.toObject());
      78           0 :     temp.emplace(cx);
      79             :   }
      80           0 :   if (!isNull) {
      81           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->feedback_id, temp.ptr())) {
      82           0 :       return false;
      83             :     }
      84             :   }
      85           0 :   if (!isNull && !temp->isUndefined()) {
      86           0 :     if (temp.ref().isObject()) {
      87           0 :       JS::ForOfIterator iter(cx);
      88           0 :       if (!iter.init(temp.ref(), JS::ForOfIterator::AllowNonIterable)) {
      89           0 :         return false;
      90             :       }
      91           0 :       if (!iter.valueIsIterable()) {
      92           0 :         ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "'feedback' member of IIRFilterOptions");
      93           0 :         return false;
      94             :       }
      95           0 :       Sequence<double> &arr = mFeedback;
      96           0 :       JS::Rooted<JS::Value> temp(cx);
      97             :       while (true) {
      98             :         bool done;
      99           0 :         if (!iter.next(&temp, &done)) {
     100           0 :           return false;
     101             :         }
     102           0 :         if (done) {
     103           0 :           break;
     104             :         }
     105           0 :         double* slotPtr = arr.AppendElement(mozilla::fallible);
     106           0 :         if (!slotPtr) {
     107           0 :           JS_ReportOutOfMemory(cx);
     108           0 :           return false;
     109             :         }
     110           0 :         double& slot = *slotPtr;
     111           0 :         if (!ValueToPrimitive<double, eDefault>(cx, temp, &slot)) {
     112           0 :           return false;
     113           0 :         } else if (!mozilla::IsFinite(slot)) {
     114           0 :           ThrowErrorMessage(cx, MSG_NOT_FINITE, "Element of 'feedback' member of IIRFilterOptions");
     115           0 :           return false;
     116             :         }
     117           0 :       }
     118             :     } else {
     119           0 :       ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "'feedback' member of IIRFilterOptions");
     120           0 :       return false;
     121             :     }
     122           0 :     mIsAnyMemberPresent = true;
     123           0 :   } else if (cx) {
     124             :     // Don't error out if we have no cx.  In that
     125             :     // situation the caller is default-constructing us and we'll
     126             :     // just assume they know what they're doing.
     127           0 :     return ThrowErrorMessage(cx, MSG_MISSING_REQUIRED_DICTIONARY_MEMBER,
     128           0 :                              "'feedback' member of IIRFilterOptions");
     129             :   }
     130             : 
     131           0 :   if (!isNull) {
     132           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->feedforward_id, temp.ptr())) {
     133           0 :       return false;
     134             :     }
     135             :   }
     136           0 :   if (!isNull && !temp->isUndefined()) {
     137           0 :     if (temp.ref().isObject()) {
     138           0 :       JS::ForOfIterator iter(cx);
     139           0 :       if (!iter.init(temp.ref(), JS::ForOfIterator::AllowNonIterable)) {
     140           0 :         return false;
     141             :       }
     142           0 :       if (!iter.valueIsIterable()) {
     143           0 :         ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "'feedforward' member of IIRFilterOptions");
     144           0 :         return false;
     145             :       }
     146           0 :       Sequence<double> &arr = mFeedforward;
     147           0 :       JS::Rooted<JS::Value> temp(cx);
     148             :       while (true) {
     149             :         bool done;
     150           0 :         if (!iter.next(&temp, &done)) {
     151           0 :           return false;
     152             :         }
     153           0 :         if (done) {
     154           0 :           break;
     155             :         }
     156           0 :         double* slotPtr = arr.AppendElement(mozilla::fallible);
     157           0 :         if (!slotPtr) {
     158           0 :           JS_ReportOutOfMemory(cx);
     159           0 :           return false;
     160             :         }
     161           0 :         double& slot = *slotPtr;
     162           0 :         if (!ValueToPrimitive<double, eDefault>(cx, temp, &slot)) {
     163           0 :           return false;
     164           0 :         } else if (!mozilla::IsFinite(slot)) {
     165           0 :           ThrowErrorMessage(cx, MSG_NOT_FINITE, "Element of 'feedforward' member of IIRFilterOptions");
     166           0 :           return false;
     167             :         }
     168           0 :       }
     169             :     } else {
     170           0 :       ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "'feedforward' member of IIRFilterOptions");
     171           0 :       return false;
     172             :     }
     173           0 :     mIsAnyMemberPresent = true;
     174           0 :   } else if (cx) {
     175             :     // Don't error out if we have no cx.  In that
     176             :     // situation the caller is default-constructing us and we'll
     177             :     // just assume they know what they're doing.
     178           0 :     return ThrowErrorMessage(cx, MSG_MISSING_REQUIRED_DICTIONARY_MEMBER,
     179           0 :                              "'feedforward' member of IIRFilterOptions");
     180             :   }
     181           0 :   return true;
     182             : }
     183             : 
     184             : bool
     185           0 : IIRFilterOptions::Init(const nsAString& aJSON)
     186             : {
     187           0 :   AutoJSAPI jsapi;
     188           0 :   JSObject* cleanGlobal = SimpleGlobalObject::Create(SimpleGlobalObject::GlobalType::BindingDetail);
     189           0 :   if (!cleanGlobal) {
     190           0 :     return false;
     191             :   }
     192           0 :   if (!jsapi.Init(cleanGlobal)) {
     193           0 :     return false;
     194             :   }
     195           0 :   JSContext* cx = jsapi.cx();
     196           0 :   JS::Rooted<JS::Value> json(cx);
     197           0 :   bool ok = ParseJSON(cx, aJSON, &json);
     198           0 :   NS_ENSURE_TRUE(ok, false);
     199           0 :   return Init(cx, json);
     200             : }
     201             : 
     202             : bool
     203           0 : IIRFilterOptions::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
     204             : {
     205           0 :   IIRFilterOptionsAtoms* atomsCache = GetAtomCache<IIRFilterOptionsAtoms>(cx);
     206           0 :   if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
     207           0 :     return false;
     208             :   }
     209             : 
     210             :   // Per spec, we define the parent's members first
     211           0 :   if (!AudioNodeOptions::ToObjectInternal(cx, rval)) {
     212           0 :     return false;
     213             :   }
     214           0 :   JS::Rooted<JSObject*> obj(cx, &rval.toObject());
     215             : 
     216             :   do {
     217             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     218           0 :     JS::Rooted<JS::Value> temp(cx);
     219           0 :     Sequence<double> const & currentValue = mFeedback;
     220             : 
     221           0 :     uint32_t length = currentValue.Length();
     222           0 :     JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
     223           0 :     if (!returnArray) {
     224           0 :       return false;
     225             :     }
     226             :     // Scope for 'tmp'
     227             :     {
     228           0 :       JS::Rooted<JS::Value> tmp(cx);
     229           0 :       for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
     230             :         // Control block to let us common up the JS_DefineElement calls when there
     231             :         // are different ways to succeed at wrapping the object.
     232             :         do {
     233           0 :           tmp.set(JS_NumberValue(double(currentValue[sequenceIdx0])));
     234           0 :           break;
     235             :         } while (0);
     236           0 :         if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
     237             :                               JSPROP_ENUMERATE)) {
     238           0 :           return false;
     239             :         }
     240             :       }
     241             :     }
     242           0 :     temp.setObject(*returnArray);
     243           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->feedback_id, temp, JSPROP_ENUMERATE)) {
     244           0 :       return false;
     245             :     }
     246           0 :     break;
     247             :   } while(0);
     248             : 
     249             :   do {
     250             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     251           0 :     JS::Rooted<JS::Value> temp(cx);
     252           0 :     Sequence<double> const & currentValue = mFeedforward;
     253             : 
     254           0 :     uint32_t length = currentValue.Length();
     255           0 :     JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
     256           0 :     if (!returnArray) {
     257           0 :       return false;
     258             :     }
     259             :     // Scope for 'tmp'
     260             :     {
     261           0 :       JS::Rooted<JS::Value> tmp(cx);
     262           0 :       for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
     263             :         // Control block to let us common up the JS_DefineElement calls when there
     264             :         // are different ways to succeed at wrapping the object.
     265             :         do {
     266           0 :           tmp.set(JS_NumberValue(double(currentValue[sequenceIdx0])));
     267           0 :           break;
     268             :         } while (0);
     269           0 :         if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
     270             :                               JSPROP_ENUMERATE)) {
     271           0 :           return false;
     272             :         }
     273             :       }
     274             :     }
     275           0 :     temp.setObject(*returnArray);
     276           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->feedforward_id, temp, JSPROP_ENUMERATE)) {
     277           0 :       return false;
     278             :     }
     279           0 :     break;
     280             :   } while(0);
     281             : 
     282           0 :   return true;
     283             : }
     284             : 
     285             : bool
     286           0 : IIRFilterOptions::ToJSON(nsAString& aJSON) const
     287             : {
     288           0 :   AutoJSAPI jsapi;
     289           0 :   jsapi.Init();
     290           0 :   JSContext *cx = jsapi.cx();
     291             :   // It's safe to use UnprivilegedJunkScopeOrWorkerGlobal here
     292             :   // because we'll only be creating objects, in ways that have no
     293             :   // side-effects, followed by a call to JS::ToJSONMaybeSafely,
     294             :   // which likewise guarantees no side-effects for the sorts of
     295             :   // things we will pass it.
     296           0 :   JSAutoCompartment ac(cx, binding_detail::UnprivilegedJunkScopeOrWorkerGlobal());
     297           0 :   JS::Rooted<JS::Value> val(cx);
     298           0 :   if (!ToObjectInternal(cx, &val)) {
     299           0 :     return false;
     300             :   }
     301           0 :   JS::Rooted<JSObject*> obj(cx, &val.toObject());
     302           0 :   return StringifyToJSON(cx, obj, aJSON);
     303             : }
     304             : 
     305             : void
     306           0 : IIRFilterOptions::TraceDictionary(JSTracer* trc)
     307             : {
     308           0 :   AudioNodeOptions::TraceDictionary(trc);
     309           0 : }
     310             : 
     311             : IIRFilterOptions&
     312           0 : IIRFilterOptions::operator=(const IIRFilterOptions& aOther)
     313             : {
     314           0 :   AudioNodeOptions::operator=(aOther);
     315           0 :   mFeedback = aOther.mFeedback;
     316           0 :   mFeedforward = aOther.mFeedforward;
     317           0 :   return *this;
     318             : }
     319             : 
     320             : namespace binding_detail {
     321             : } // namespace binding_detail
     322             : 
     323             : 
     324             : namespace IIRFilterNodeBinding {
     325             : 
     326             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<AudioNodeBinding::NativeType>::value,
     327             :               "Can't inherit from an interface with a different ownership model.");
     328             : 
     329             : static bool
     330           0 : getFrequencyResponse(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::IIRFilterNode* self, const JSJitMethodCallArgs& args)
     331             : {
     332           0 :   if (MOZ_UNLIKELY(args.length() < 3)) {
     333           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "IIRFilterNode.getFrequencyResponse");
     334             :   }
     335           0 :   RootedTypedArray<Float32Array> arg0(cx);
     336           0 :   if (args[0].isObject()) {
     337           0 :     if (!arg0.Init(&args[0].toObject())) {
     338           0 :       ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of IIRFilterNode.getFrequencyResponse", "Float32Array");
     339           0 :       return false;
     340             :     }
     341             :   } else {
     342           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of IIRFilterNode.getFrequencyResponse");
     343           0 :     return false;
     344             :   }
     345           0 :   RootedTypedArray<Float32Array> arg1(cx);
     346           0 :   if (args[1].isObject()) {
     347           0 :     if (!arg1.Init(&args[1].toObject())) {
     348           0 :       ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of IIRFilterNode.getFrequencyResponse", "Float32Array");
     349           0 :       return false;
     350             :     }
     351             :   } else {
     352           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of IIRFilterNode.getFrequencyResponse");
     353           0 :     return false;
     354             :   }
     355           0 :   RootedTypedArray<Float32Array> arg2(cx);
     356           0 :   if (args[2].isObject()) {
     357           0 :     if (!arg2.Init(&args[2].toObject())) {
     358           0 :       ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 3 of IIRFilterNode.getFrequencyResponse", "Float32Array");
     359           0 :       return false;
     360             :     }
     361             :   } else {
     362           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 3 of IIRFilterNode.getFrequencyResponse");
     363           0 :     return false;
     364             :   }
     365           0 :   self->GetFrequencyResponse(Constify(arg0), Constify(arg1), Constify(arg2));
     366           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     367           0 :   args.rval().setUndefined();
     368           0 :   return true;
     369             : }
     370             : 
     371             : static const JSJitInfo getFrequencyResponse_methodinfo = {
     372             :   { (JSJitGetterOp)getFrequencyResponse },
     373             :   { prototypes::id::IIRFilterNode },
     374             :   { PrototypeTraits<prototypes::id::IIRFilterNode>::Depth },
     375             :   JSJitInfo::Method,
     376             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     377             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     378             :   false,  /* isInfallible. False in setters. */
     379             :   false,  /* isMovable.  Not relevant for setters. */
     380             :   false, /* isEliminatable.  Not relevant for setters. */
     381             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     382             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     383             :   false,  /* isTypedMethod.  Only relevant for methods. */
     384             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     385             : };
     386             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     387             : static_assert(0 < 1, "There is no slot for us");
     388             : 
     389             : static bool
     390           0 : get_passThrough(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::IIRFilterNode* self, JSJitGetterCallArgs args)
     391             : {
     392           0 :   bool result(self->PassThrough());
     393           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     394           0 :   args.rval().setBoolean(result);
     395           0 :   return true;
     396             : }
     397             : 
     398             : static bool
     399           0 : set_passThrough(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::IIRFilterNode* self, JSJitSetterCallArgs args)
     400             : {
     401             :   bool arg0;
     402           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
     403           0 :     return false;
     404             :   }
     405           0 :   self->SetPassThrough(arg0);
     406           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     407             : 
     408           0 :   return true;
     409             : }
     410             : 
     411             : static const JSJitInfo passThrough_getterinfo = {
     412             :   { (JSJitGetterOp)get_passThrough },
     413             :   { prototypes::id::IIRFilterNode },
     414             :   { PrototypeTraits<prototypes::id::IIRFilterNode>::Depth },
     415             :   JSJitInfo::Getter,
     416             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     417             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
     418             :   true,  /* isInfallible. False in setters. */
     419             :   false,  /* isMovable.  Not relevant for setters. */
     420             :   false, /* isEliminatable.  Not relevant for setters. */
     421             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     422             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     423             :   false,  /* isTypedMethod.  Only relevant for methods. */
     424             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     425             : };
     426             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     427             : static_assert(0 < 1, "There is no slot for us");
     428             : static const JSJitInfo passThrough_setterinfo = {
     429             :   { (JSJitGetterOp)set_passThrough },
     430             :   { prototypes::id::IIRFilterNode },
     431             :   { PrototypeTraits<prototypes::id::IIRFilterNode>::Depth },
     432             :   JSJitInfo::Setter,
     433             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     434             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     435             :   false,  /* isInfallible. False in setters. */
     436             :   false,  /* isMovable.  Not relevant for setters. */
     437             :   false, /* isEliminatable.  Not relevant for setters. */
     438             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     439             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     440             :   false,  /* isTypedMethod.  Only relevant for methods. */
     441             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     442             : };
     443             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     444             : static_assert(0 < 1, "There is no slot for us");
     445             : 
     446             : static bool
     447           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
     448             : {
     449           0 :   mozilla::dom::IIRFilterNode* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::IIRFilterNode>(obj);
     450             :   // We don't want to preserve if we don't have a wrapper, and we
     451             :   // obviously can't preserve if we're not initialized.
     452           0 :   if (self && self->GetWrapperPreserveColor()) {
     453           0 :     PreserveWrapper(self);
     454             :   }
     455           0 :   return true;
     456             : }
     457             : 
     458             : static void
     459           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     460             : {
     461           0 :   mozilla::dom::IIRFilterNode* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::IIRFilterNode>(obj);
     462           0 :   if (self) {
     463           0 :     ClearWrapper(self, self, obj);
     464           0 :     AddForDeferredFinalization<mozilla::dom::IIRFilterNode>(self);
     465             :   }
     466           0 : }
     467             : 
     468             : static void
     469           0 : _objectMoved(JSObject* obj, const JSObject* old)
     470             : {
     471           0 :   mozilla::dom::IIRFilterNode* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::IIRFilterNode>(obj);
     472           0 :   if (self) {
     473           0 :     UpdateWrapper(self, self, obj, old);
     474             :   }
     475           0 : }
     476             : 
     477             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     478             : #if defined(__clang__)
     479             : #pragma clang diagnostic push
     480             : #pragma clang diagnostic ignored "-Wmissing-braces"
     481             : #endif
     482             : static const JSFunctionSpec sMethods_specs[] = {
     483             :   JS_FNSPEC("getFrequencyResponse", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getFrequencyResponse_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
     484             :   JS_FS_END
     485             : };
     486             : #if defined(__clang__)
     487             : #pragma clang diagnostic pop
     488             : #endif
     489             : 
     490             : 
     491             : // Can't be const because the pref-enabled boolean needs to be writable
     492             : static Prefable<const JSFunctionSpec> sMethods[] = {
     493             :   { nullptr, &sMethods_specs[0] },
     494             :   { nullptr, nullptr }
     495             : };
     496             : 
     497             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     498             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     499             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     500             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     501             : 
     502             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     503             : #if defined(__clang__)
     504             : #pragma clang diagnostic push
     505             : #pragma clang diagnostic ignored "-Wmissing-braces"
     506             : #endif
     507             : static const JSPropertySpec sChromeAttributes_specs[] = {
     508             :   { "passThrough", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &passThrough_getterinfo, GenericBindingSetter, &passThrough_setterinfo },
     509             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     510             : };
     511             : #if defined(__clang__)
     512             : #pragma clang diagnostic pop
     513             : #endif
     514             : 
     515             : 
     516             : // Can't be const because the pref-enabled boolean needs to be writable
     517             : static Prefable<const JSPropertySpec> sChromeAttributes[] = {
     518             :   { nullptr, &sChromeAttributes_specs[0] },
     519             :   { nullptr, nullptr }
     520             : };
     521             : 
     522             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     523             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     524             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     525             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     526             : 
     527             : 
     528             : static uint16_t sNativeProperties_sortedPropertyIndices[1];
     529             : static PropertyInfo sNativeProperties_propertyInfos[1];
     530             : 
     531             : static const NativePropertiesN<1> sNativeProperties = {
     532             :   false, 0,
     533             :   false, 0,
     534             :   true,  0 /* sMethods */,
     535             :   false, 0,
     536             :   false, 0,
     537             :   false, 0,
     538             :   false, 0,
     539             :   -1,
     540             :   1,
     541             :   sNativeProperties_sortedPropertyIndices,
     542             :   {
     543             :     { sMethods, &sNativeProperties_propertyInfos[0] }
     544             :   }
     545             : };
     546             : static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     547             :     "We have a property info count that is oversized");
     548             : 
     549             : static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[1];
     550             : static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[1];
     551             : 
     552             : static const NativePropertiesN<1> sChromeOnlyNativeProperties = {
     553             :   false, 0,
     554             :   false, 0,
     555             :   false, 0,
     556             :   true,  0 /* sChromeAttributes */,
     557             :   false, 0,
     558             :   false, 0,
     559             :   false, 0,
     560             :   -1,
     561             :   1,
     562             :   sChromeOnlyNativeProperties_sortedPropertyIndices,
     563             :   {
     564             :     { sChromeAttributes, &sChromeOnlyNativeProperties_propertyInfos[0] }
     565             :   }
     566             : };
     567             : static_assert(1 < 1ull << CHAR_BIT * sizeof(sChromeOnlyNativeProperties.propertyInfoCount),
     568             :     "We have a property info count that is oversized");
     569             : 
     570             : static bool
     571           0 : _constructor(JSContext* cx, unsigned argc, JS::Value* vp)
     572             : {
     573           0 :   JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     574           0 :   JS::Rooted<JSObject*> obj(cx, &args.callee());
     575           0 :   if (!args.isConstructing()) {
     576             :     // XXXbz wish I could get the name from the callee instead of
     577             :     // Adding more relocations
     578           0 :     return ThrowConstructorWithoutNew(cx, "IIRFilterNode");
     579             :   }
     580             : 
     581           0 :   GlobalObject global(cx, obj);
     582           0 :   if (global.Failed()) {
     583           0 :     return false;
     584             :   }
     585             : 
     586           0 :   JS::Rooted<JSObject*> desiredProto(cx);
     587           0 :   if (!GetDesiredProto(cx, args, &desiredProto)) {
     588           0 :     return false;
     589             :   }
     590             : 
     591           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     592           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "IIRFilterNode");
     593             :   }
     594           0 :   bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);
     595           0 :   NonNull<mozilla::dom::AudioContext> arg0;
     596           0 :   if (args[0].isObject()) {
     597             :     {
     598           0 :       nsresult rv = UnwrapObject<prototypes::id::BaseAudioContext, mozilla::dom::AudioContext>(args[0], arg0);
     599           0 :       if (NS_FAILED(rv)) {
     600           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of IIRFilterNode.constructor", "BaseAudioContext");
     601           0 :         return false;
     602             :       }
     603             :     }
     604             :   } else {
     605           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of IIRFilterNode.constructor");
     606           0 :     return false;
     607             :   }
     608           0 :   binding_detail::FastIIRFilterOptions arg1;
     609           0 :   if (!arg1.Init(cx, args[1],  "Argument 2 of IIRFilterNode.constructor", false)) {
     610           0 :     return false;
     611             :   }
     612           0 :   Maybe<JSAutoCompartment> ac;
     613           0 :   if (objIsXray) {
     614           0 :     obj = js::CheckedUnwrap(obj);
     615           0 :     if (!obj) {
     616           0 :       return false;
     617             :     }
     618           0 :     ac.emplace(cx, obj);
     619           0 :     if (!JS_WrapObject(cx, &desiredProto)) {
     620           0 :       return false;
     621             :     }
     622             :   }
     623           0 :   binding_detail::FastErrorResult rv;
     624           0 :   auto result(StrongOrRawPtr<mozilla::dom::IIRFilterNode>(mozilla::dom::IIRFilterNode::Constructor(global, NonNullHelper(arg0), Constify(arg1), rv)));
     625           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     626           0 :     return false;
     627             :   }
     628           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     629             :   static_assert(!IsPointer<decltype(result)>::value,
     630             :                 "NewObject implies that we need to keep the object alive with a strong reference.");
     631           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) {
     632           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     633           0 :     return false;
     634             :   }
     635           0 :   return true;
     636             : }
     637             : 
     638             : static const js::ClassOps sInterfaceObjectClassOps = {
     639             :     nullptr,               /* addProperty */
     640             :     nullptr,               /* delProperty */
     641             :     nullptr,               /* getProperty */
     642             :     nullptr,               /* setProperty */
     643             :     nullptr,               /* enumerate */
     644             :     nullptr,               /* newEnumerate */
     645             :     nullptr,               /* resolve */
     646             :     nullptr,               /* mayResolve */
     647             :     nullptr,               /* finalize */
     648             :     _constructor, /* call */
     649             :     nullptr,               /* hasInstance */
     650             :     _constructor, /* construct */
     651             :     nullptr,               /* trace */
     652             : };
     653             : 
     654             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     655             :   {
     656             :     "Function",
     657             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     658             :     &sInterfaceObjectClassOps,
     659             :     JS_NULL_CLASS_SPEC,
     660             :     JS_NULL_CLASS_EXT,
     661             :     &sInterfaceObjectClassObjectOps
     662             :   },
     663             :   eInterface,
     664             :   true,
     665             :   prototypes::id::IIRFilterNode,
     666             :   PrototypeTraits<prototypes::id::IIRFilterNode>::Depth,
     667             :   sNativePropertyHooks,
     668             :   "function IIRFilterNode() {\n    [native code]\n}",
     669             :   AudioNodeBinding::GetConstructorObject
     670             : };
     671             : 
     672             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     673             :   {
     674             :     "IIRFilterNodePrototype",
     675             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     676             :     JS_NULL_CLASS_OPS,
     677             :     JS_NULL_CLASS_SPEC,
     678             :     JS_NULL_CLASS_EXT,
     679             :     JS_NULL_OBJECT_OPS
     680             :   },
     681             :   eInterfacePrototype,
     682             :   false,
     683             :   prototypes::id::IIRFilterNode,
     684             :   PrototypeTraits<prototypes::id::IIRFilterNode>::Depth,
     685             :   sNativePropertyHooks,
     686             :   "[object IIRFilterNodePrototype]",
     687             :   AudioNodeBinding::GetProtoObject
     688             : };
     689             : 
     690             : bool
     691           0 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
     692             : {
     693             :   static bool sPrefValue;
     694             :   static bool sPrefCacheSetUp = false;
     695           0 :   if (!sPrefCacheSetUp) {
     696           0 :     sPrefCacheSetUp = true;
     697           0 :     Preferences::AddBoolVarCache(&sPrefValue, "dom.webaudio.enabled");
     698             :   }
     699             : 
     700           0 :   return sPrefValue;
     701             : }
     702             : 
     703             : JSObject*
     704           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     705             : {
     706           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     707             : }
     708             : 
     709             : static const js::ClassOps sClassOps = {
     710             :   _addProperty, /* addProperty */
     711             :   nullptr,               /* delProperty */
     712             :   nullptr,               /* getProperty */
     713             :   nullptr,               /* setProperty */
     714             :   nullptr,               /* enumerate */
     715             :   nullptr, /* newEnumerate */
     716             :   nullptr, /* resolve */
     717             :   nullptr, /* mayResolve */
     718             :   _finalize, /* finalize */
     719             :   nullptr, /* call */
     720             :   nullptr,               /* hasInstance */
     721             :   nullptr,               /* construct */
     722             :   nullptr, /* trace */
     723             : };
     724             : 
     725             : static const js::ClassExtension sClassExtension = {
     726             :   nullptr, /* weakmapKeyDelegateOp */
     727             :   _objectMoved /* objectMovedOp */
     728             : };
     729             : 
     730             : static const DOMJSClass sClass = {
     731             :   { "IIRFilterNode",
     732             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
     733             :     &sClassOps,
     734             :     JS_NULL_CLASS_SPEC,
     735             :     &sClassExtension,
     736             :     JS_NULL_OBJECT_OPS
     737             :   },
     738             :   { prototypes::id::EventTarget, prototypes::id::AudioNode, prototypes::id::IIRFilterNode, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
     739             :   IsBaseOf<nsISupports, mozilla::dom::IIRFilterNode >::value,
     740             :   sNativePropertyHooks,
     741             :   FindAssociatedGlobalForNative<mozilla::dom::IIRFilterNode>::Get,
     742             :   GetProtoObjectHandle,
     743             :   GetCCParticipant<mozilla::dom::IIRFilterNode>::Get()
     744             : };
     745             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
     746             :               "Must have the right minimal number of reserved slots.");
     747             : static_assert(1 >= 1,
     748             :               "Must have enough reserved slots.");
     749             : 
     750             : const JSClass*
     751           0 : GetJSClass()
     752             : {
     753           0 :   return sClass.ToJSClass();
     754             : }
     755             : 
     756             : bool
     757           0 : Wrap(JSContext* aCx, mozilla::dom::IIRFilterNode* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     758             : {
     759             :   MOZ_ASSERT(static_cast<mozilla::dom::IIRFilterNode*>(aObject) ==
     760             :              reinterpret_cast<mozilla::dom::IIRFilterNode*>(aObject),
     761             :              "Multiple inheritance for mozilla::dom::IIRFilterNode is broken.");
     762             :   MOZ_ASSERT(static_cast<mozilla::dom::AudioNode*>(aObject) ==
     763             :              reinterpret_cast<mozilla::dom::AudioNode*>(aObject),
     764             :              "Multiple inheritance for mozilla::dom::AudioNode is broken.");
     765             :   MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
     766             :              reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
     767             :              "Multiple inheritance for mozilla::dom::EventTarget is broken.");
     768           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     769           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     770           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
     771             :              "You should probably not be using Wrap() directly; use "
     772             :              "GetOrCreateDOMReflector instead");
     773             : 
     774           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
     775             :              "nsISupports must be on our primary inheritance chain");
     776             : 
     777           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
     778           0 :   if (!global) {
     779           0 :     return false;
     780             :   }
     781           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
     782           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
     783             : 
     784             :   // That might have ended up wrapping us already, due to the wonders
     785             :   // of XBL.  Check for that, and bail out as needed.
     786           0 :   aReflector.set(aCache->GetWrapper());
     787           0 :   if (aReflector) {
     788             : #ifdef DEBUG
     789           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
     790             : #endif // DEBUG
     791           0 :     return true;
     792             :   }
     793             : 
     794           0 :   JSAutoCompartment ac(aCx, global);
     795           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     796           0 :   if (!canonicalProto) {
     797           0 :     return false;
     798             :   }
     799           0 :   JS::Rooted<JSObject*> proto(aCx);
     800           0 :   if (aGivenProto) {
     801           0 :     proto = aGivenProto;
     802             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     803             :     // coming in, we changed compartments to that of "parent" so may need
     804             :     // to wrap the proto here.
     805           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     806           0 :       if (!JS_WrapObject(aCx, &proto)) {
     807           0 :         return false;
     808             :       }
     809             :     }
     810             :   } else {
     811           0 :     proto = canonicalProto;
     812             :   }
     813             : 
     814           0 :   BindingJSObjectCreator<mozilla::dom::IIRFilterNode> creator(aCx);
     815           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
     816           0 :   if (!aReflector) {
     817           0 :     return false;
     818             :   }
     819             : 
     820           0 :   aCache->SetWrapper(aReflector);
     821           0 :   creator.InitializationSucceeded();
     822             : 
     823           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
     824             :              aCache->GetWrapperPreserveColor() == aReflector);
     825             :   // If proto != canonicalProto, we have to preserve our wrapper;
     826             :   // otherwise we won't be able to properly recreate it later, since
     827             :   // we won't know what proto to use.  Note that we don't check
     828             :   // aGivenProto here, since it's entirely possible (and even
     829             :   // somewhat common) to have a non-null aGivenProto which is the
     830             :   // same as canonicalProto.
     831           0 :   if (proto != canonicalProto) {
     832           0 :     PreserveWrapper(aObject);
     833             :   }
     834             : 
     835           0 :   return true;
     836             : }
     837             : 
     838             : const NativePropertyHooks sNativePropertyHooks[] = { {
     839             :   nullptr,
     840             :   nullptr,
     841             :   nullptr,
     842             :   { sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast() },
     843             :   prototypes::id::IIRFilterNode,
     844             :   constructors::id::IIRFilterNode,
     845             :   AudioNodeBinding::sNativePropertyHooks,
     846             :   &DefaultXrayExpandoObjectClass
     847             : } };
     848             : 
     849             : void
     850           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     851             : {
     852           0 :   JS::Handle<JSObject*> parentProto(AudioNodeBinding::GetProtoObjectHandle(aCx));
     853           0 :   if (!parentProto) {
     854           0 :     return;
     855             :   }
     856             : 
     857           0 :   JS::Handle<JSObject*> constructorProto(AudioNodeBinding::GetConstructorObjectHandle(aCx));
     858           0 :   if (!constructorProto) {
     859           0 :     return;
     860             :   }
     861             : 
     862             :   static bool sIdsInited = false;
     863           0 :   if (!sIdsInited && NS_IsMainThread()) {
     864           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     865           0 :       return;
     866             :     }
     867           0 :     if (!InitIds(aCx, sChromeOnlyNativeProperties.Upcast())) {
     868           0 :       return;
     869             :     }
     870           0 :     sIdsInited = true;
     871             :   }
     872             : 
     873           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::IIRFilterNode);
     874           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::IIRFilterNode);
     875           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     876             :                               &sPrototypeClass.mBase, protoCache,
     877             :                               constructorProto, &sInterfaceObjectClass.mBase, 2, nullptr,
     878             :                               interfaceCache,
     879             :                               sNativeProperties.Upcast(),
     880           0 :                               nsContentUtils::ThreadsafeIsSystemCaller(aCx) ? sChromeOnlyNativeProperties.Upcast() : nullptr,
     881             :                               "IIRFilterNode", aDefineOnGlobal,
     882             :                               nullptr,
     883           0 :                               false);
     884             : }
     885             : 
     886             : JS::Handle<JSObject*>
     887           0 : GetProtoObjectHandle(JSContext* aCx)
     888             : {
     889             :   /* Get the interface prototype object for this class.  This will create the
     890             :      object as needed. */
     891           0 :   bool aDefineOnGlobal = true;
     892             : 
     893             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     894           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     895           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     896           0 :     return nullptr;
     897             :   }
     898             : 
     899             :   /* Check to see whether the interface objects are already installed */
     900           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     901           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::IIRFilterNode)) {
     902           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     903           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     904             :   }
     905             : 
     906             :   /*
     907             :    * The object might _still_ be null, but that's OK.
     908             :    *
     909             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     910             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     911             :    * changed after they have been set.
     912             :    *
     913             :    * Calling address() avoids the read read barrier that does gray
     914             :    * unmarking, but it's not possible for the object to be gray here.
     915             :    */
     916             : 
     917           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::IIRFilterNode);
     918           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     919           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     920             : }
     921             : 
     922             : JS::Handle<JSObject*>
     923           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     924             : {
     925             :   /* Get the interface object for this class.  This will create the object as
     926             :      needed. */
     927             : 
     928             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     929           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     930           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     931           0 :     return nullptr;
     932             :   }
     933             : 
     934             :   /* Check to see whether the interface objects are already installed */
     935           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     936           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::IIRFilterNode)) {
     937           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     938           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     939             :   }
     940             : 
     941             :   /*
     942             :    * The object might _still_ be null, but that's OK.
     943             :    *
     944             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     945             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     946             :    * changed after they have been set.
     947             :    *
     948             :    * Calling address() avoids the read read barrier that does gray
     949             :    * unmarking, but it's not possible for the object to be gray here.
     950             :    */
     951             : 
     952           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::IIRFilterNode);
     953           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     954           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     955             : }
     956             : 
     957             : JSObject*
     958           0 : GetConstructorObject(JSContext* aCx)
     959             : {
     960           0 :   return GetConstructorObjectHandle(aCx);
     961             : }
     962             : 
     963             : } // namespace IIRFilterNodeBinding
     964             : 
     965             : 
     966             : 
     967             : } // namespace dom
     968             : } // namespace mozilla

Generated by: LCOV version 1.13