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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM DocumentTimeline.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "AnimationTimelineBinding.h"
       4             : #include "AtomList.h"
       5             : #include "DocumentTimelineBinding.h"
       6             : #include "WrapperFactory.h"
       7             : #include "mozilla/FloatingPoint.h"
       8             : #include "mozilla/OwningNonNull.h"
       9             : #include "mozilla/dom/BindingUtils.h"
      10             : #include "mozilla/dom/DOMJSClass.h"
      11             : #include "mozilla/dom/DocumentTimeline.h"
      12             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      13             : #include "mozilla/dom/PrimitiveConversions.h"
      14             : #include "mozilla/dom/ScriptSettings.h"
      15             : #include "mozilla/dom/SimpleGlobalObject.h"
      16             : #include "mozilla/dom/XrayExpandoClass.h"
      17             : #include "nsDocument.h"
      18             : 
      19             : namespace mozilla {
      20             : namespace dom {
      21             : 
      22             : 
      23           0 : DocumentTimelineOptions::DocumentTimelineOptions()
      24             : {
      25             :   // Safe to pass a null context if we pass a null value
      26           0 :   Init(nullptr, JS::NullHandleValue);
      27           0 : }
      28             : 
      29             : 
      30             : 
      31             : bool
      32           0 : DocumentTimelineOptions::InitIds(JSContext* cx, DocumentTimelineOptionsAtoms* atomsCache)
      33             : {
      34           0 :   MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache));
      35             : 
      36             :   // Initialize these in reverse order so that any failure leaves the first one
      37             :   // uninitialized.
      38           0 :   if (!atomsCache->originTime_id.init(cx, "originTime")) {
      39           0 :     return false;
      40             :   }
      41           0 :   return true;
      42             : }
      43             : 
      44             : bool
      45           0 : DocumentTimelineOptions::Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
      46             : {
      47             :   // Passing a null JSContext is OK only if we're initing from null,
      48             :   // Since in that case we will not have to do any property gets
      49             :   // Also evaluate isNullOrUndefined in order to avoid false-positive
      50             :   // checkers by static analysis tools
      51           0 :   MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined());
      52           0 :   DocumentTimelineOptionsAtoms* atomsCache = nullptr;
      53           0 :   if (cx) {
      54           0 :     atomsCache = GetAtomCache<DocumentTimelineOptionsAtoms>(cx);
      55           0 :     if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
      56           0 :       return false;
      57             :     }
      58             :   }
      59             : 
      60           0 :   if (!IsConvertibleToDictionary(val)) {
      61           0 :     return ThrowErrorMessage(cx, MSG_NOT_DICTIONARY, sourceDescription);
      62             :   }
      63             : 
      64           0 :   bool isNull = val.isNullOrUndefined();
      65             :   // We only need these if !isNull, in which case we have |cx|.
      66           0 :   Maybe<JS::Rooted<JSObject *> > object;
      67           0 :   Maybe<JS::Rooted<JS::Value> > temp;
      68           0 :   if (!isNull) {
      69           0 :     MOZ_ASSERT(cx);
      70           0 :     object.emplace(cx, &val.toObject());
      71           0 :     temp.emplace(cx);
      72             :   }
      73           0 :   if (!isNull) {
      74           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->originTime_id, temp.ptr())) {
      75           0 :       return false;
      76             :     }
      77             :   }
      78           0 :   if (!isNull && !temp->isUndefined()) {
      79           0 :     if (!ValueToPrimitive<double, eDefault>(cx, temp.ref(), &mOriginTime)) {
      80           0 :       return false;
      81           0 :     } else if (!mozilla::IsFinite(mOriginTime)) {
      82           0 :       ThrowErrorMessage(cx, MSG_NOT_FINITE, "'originTime' member of DocumentTimelineOptions");
      83           0 :       return false;
      84             :     }
      85             :   } else {
      86           0 :     mOriginTime = 0.0;
      87             :   }
      88           0 :   mIsAnyMemberPresent = true;
      89           0 :   return true;
      90             : }
      91             : 
      92             : bool
      93           0 : DocumentTimelineOptions::Init(const nsAString& aJSON)
      94             : {
      95           0 :   AutoJSAPI jsapi;
      96           0 :   JSObject* cleanGlobal = SimpleGlobalObject::Create(SimpleGlobalObject::GlobalType::BindingDetail);
      97           0 :   if (!cleanGlobal) {
      98           0 :     return false;
      99             :   }
     100           0 :   if (!jsapi.Init(cleanGlobal)) {
     101           0 :     return false;
     102             :   }
     103           0 :   JSContext* cx = jsapi.cx();
     104           0 :   JS::Rooted<JS::Value> json(cx);
     105           0 :   bool ok = ParseJSON(cx, aJSON, &json);
     106           0 :   NS_ENSURE_TRUE(ok, false);
     107           0 :   return Init(cx, json);
     108             : }
     109             : 
     110             : bool
     111           0 : DocumentTimelineOptions::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
     112             : {
     113           0 :   DocumentTimelineOptionsAtoms* atomsCache = GetAtomCache<DocumentTimelineOptionsAtoms>(cx);
     114           0 :   if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
     115           0 :     return false;
     116             :   }
     117             : 
     118           0 :   JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
     119           0 :   if (!obj) {
     120           0 :     return false;
     121             :   }
     122           0 :   rval.set(JS::ObjectValue(*obj));
     123             : 
     124             :   do {
     125             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     126           0 :     JS::Rooted<JS::Value> temp(cx);
     127           0 :     double const & currentValue = mOriginTime;
     128           0 :     temp.set(JS_NumberValue(double(currentValue)));
     129           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->originTime_id, temp, JSPROP_ENUMERATE)) {
     130           0 :       return false;
     131             :     }
     132           0 :     break;
     133             :   } while(0);
     134             : 
     135           0 :   return true;
     136             : }
     137             : 
     138             : bool
     139           0 : DocumentTimelineOptions::ToJSON(nsAString& aJSON) const
     140             : {
     141           0 :   AutoJSAPI jsapi;
     142           0 :   jsapi.Init();
     143           0 :   JSContext *cx = jsapi.cx();
     144             :   // It's safe to use UnprivilegedJunkScopeOrWorkerGlobal here
     145             :   // because we'll only be creating objects, in ways that have no
     146             :   // side-effects, followed by a call to JS::ToJSONMaybeSafely,
     147             :   // which likewise guarantees no side-effects for the sorts of
     148             :   // things we will pass it.
     149           0 :   JSAutoCompartment ac(cx, binding_detail::UnprivilegedJunkScopeOrWorkerGlobal());
     150           0 :   JS::Rooted<JS::Value> val(cx);
     151           0 :   if (!ToObjectInternal(cx, &val)) {
     152           0 :     return false;
     153             :   }
     154           0 :   JS::Rooted<JSObject*> obj(cx, &val.toObject());
     155           0 :   return StringifyToJSON(cx, obj, aJSON);
     156             : }
     157             : 
     158             : void
     159           0 : DocumentTimelineOptions::TraceDictionary(JSTracer* trc)
     160             : {
     161           0 : }
     162             : 
     163             : DocumentTimelineOptions&
     164           0 : DocumentTimelineOptions::operator=(const DocumentTimelineOptions& aOther)
     165             : {
     166           0 :   mOriginTime = aOther.mOriginTime;
     167           0 :   return *this;
     168             : }
     169             : 
     170             : namespace binding_detail {
     171             : } // namespace binding_detail
     172             : 
     173             : 
     174             : namespace DocumentTimelineBinding {
     175             : 
     176             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<AnimationTimelineBinding::NativeType>::value,
     177             :               "Can't inherit from an interface with a different ownership model.");
     178             : 
     179             : static bool
     180           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
     181             : {
     182           0 :   mozilla::dom::DocumentTimeline* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::DocumentTimeline>(obj);
     183             :   // We don't want to preserve if we don't have a wrapper, and we
     184             :   // obviously can't preserve if we're not initialized.
     185           0 :   if (self && self->GetWrapperPreserveColor()) {
     186           0 :     PreserveWrapper(self);
     187             :   }
     188           0 :   return true;
     189             : }
     190             : 
     191             : static void
     192           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     193             : {
     194           0 :   mozilla::dom::DocumentTimeline* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::DocumentTimeline>(obj);
     195           0 :   if (self) {
     196           0 :     ClearWrapper(self, self, obj);
     197           0 :     AddForDeferredFinalization<mozilla::dom::DocumentTimeline>(self);
     198             :   }
     199           0 : }
     200             : 
     201             : static void
     202           0 : _objectMoved(JSObject* obj, const JSObject* old)
     203             : {
     204           0 :   mozilla::dom::DocumentTimeline* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::DocumentTimeline>(obj);
     205           0 :   if (self) {
     206           0 :     UpdateWrapper(self, self, obj, old);
     207             :   }
     208           0 : }
     209             : 
     210             : static bool
     211           0 : _constructor(JSContext* cx, unsigned argc, JS::Value* vp)
     212             : {
     213           0 :   JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     214           0 :   JS::Rooted<JSObject*> obj(cx, &args.callee());
     215           0 :   if (!args.isConstructing()) {
     216             :     // XXXbz wish I could get the name from the callee instead of
     217             :     // Adding more relocations
     218           0 :     return ThrowConstructorWithoutNew(cx, "DocumentTimeline");
     219             :   }
     220             : 
     221           0 :   GlobalObject global(cx, obj);
     222           0 :   if (global.Failed()) {
     223           0 :     return false;
     224             :   }
     225             : 
     226           0 :   JS::Rooted<JSObject*> desiredProto(cx);
     227           0 :   if (!GetDesiredProto(cx, args, &desiredProto)) {
     228           0 :     return false;
     229             :   }
     230             : 
     231           0 :   bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);
     232           0 :   binding_detail::FastDocumentTimelineOptions arg0;
     233           0 :   if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue,  "Argument 1 of DocumentTimeline.constructor", false)) {
     234           0 :     return false;
     235             :   }
     236           0 :   Maybe<JSAutoCompartment> ac;
     237           0 :   if (objIsXray) {
     238           0 :     obj = js::CheckedUnwrap(obj);
     239           0 :     if (!obj) {
     240           0 :       return false;
     241             :     }
     242           0 :     ac.emplace(cx, obj);
     243           0 :     if (!JS_WrapObject(cx, &desiredProto)) {
     244           0 :       return false;
     245             :     }
     246             :   }
     247           0 :   binding_detail::FastErrorResult rv;
     248           0 :   auto result(StrongOrRawPtr<mozilla::dom::DocumentTimeline>(mozilla::dom::DocumentTimeline::Constructor(global, Constify(arg0), rv)));
     249           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     250           0 :     return false;
     251             :   }
     252           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     253             :   static_assert(!IsPointer<decltype(result)>::value,
     254             :                 "NewObject implies that we need to keep the object alive with a strong reference.");
     255           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) {
     256           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     257           0 :     return false;
     258             :   }
     259           0 :   return true;
     260             : }
     261             : 
     262             : static const js::ClassOps sInterfaceObjectClassOps = {
     263             :     nullptr,               /* addProperty */
     264             :     nullptr,               /* delProperty */
     265             :     nullptr,               /* getProperty */
     266             :     nullptr,               /* setProperty */
     267             :     nullptr,               /* enumerate */
     268             :     nullptr,               /* newEnumerate */
     269             :     nullptr,               /* resolve */
     270             :     nullptr,               /* mayResolve */
     271             :     nullptr,               /* finalize */
     272             :     _constructor, /* call */
     273             :     nullptr,               /* hasInstance */
     274             :     _constructor, /* construct */
     275             :     nullptr,               /* trace */
     276             : };
     277             : 
     278             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     279             :   {
     280             :     "Function",
     281             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     282             :     &sInterfaceObjectClassOps,
     283             :     JS_NULL_CLASS_SPEC,
     284             :     JS_NULL_CLASS_EXT,
     285             :     &sInterfaceObjectClassObjectOps
     286             :   },
     287             :   eInterface,
     288             :   true,
     289             :   prototypes::id::DocumentTimeline,
     290             :   PrototypeTraits<prototypes::id::DocumentTimeline>::Depth,
     291             :   sNativePropertyHooks,
     292             :   "function DocumentTimeline() {\n    [native code]\n}",
     293             :   AnimationTimelineBinding::GetConstructorObject
     294             : };
     295             : 
     296             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     297             :   {
     298             :     "DocumentTimelinePrototype",
     299             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     300             :     JS_NULL_CLASS_OPS,
     301             :     JS_NULL_CLASS_SPEC,
     302             :     JS_NULL_CLASS_EXT,
     303             :     JS_NULL_OBJECT_OPS
     304             :   },
     305             :   eInterfacePrototype,
     306             :   false,
     307             :   prototypes::id::DocumentTimeline,
     308             :   PrototypeTraits<prototypes::id::DocumentTimeline>::Depth,
     309             :   sNativePropertyHooks,
     310             :   "[object DocumentTimelinePrototype]",
     311             :   AnimationTimelineBinding::GetProtoObject
     312             : };
     313             : 
     314             : bool
     315           0 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
     316             : {
     317           0 :   return nsDocument::IsWebAnimationsEnabled(aCx, aObj);
     318             : }
     319             : 
     320             : JSObject*
     321           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     322             : {
     323           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     324             : }
     325             : 
     326             : static const js::ClassOps sClassOps = {
     327             :   _addProperty, /* addProperty */
     328             :   nullptr,               /* delProperty */
     329             :   nullptr,               /* getProperty */
     330             :   nullptr,               /* setProperty */
     331             :   nullptr,               /* enumerate */
     332             :   nullptr, /* newEnumerate */
     333             :   nullptr, /* resolve */
     334             :   nullptr, /* mayResolve */
     335             :   _finalize, /* finalize */
     336             :   nullptr, /* call */
     337             :   nullptr,               /* hasInstance */
     338             :   nullptr,               /* construct */
     339             :   nullptr, /* trace */
     340             : };
     341             : 
     342             : static const js::ClassExtension sClassExtension = {
     343             :   nullptr, /* weakmapKeyDelegateOp */
     344             :   _objectMoved /* objectMovedOp */
     345             : };
     346             : 
     347             : static const DOMJSClass sClass = {
     348             :   { "DocumentTimeline",
     349             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
     350             :     &sClassOps,
     351             :     JS_NULL_CLASS_SPEC,
     352             :     &sClassExtension,
     353             :     JS_NULL_OBJECT_OPS
     354             :   },
     355             :   { prototypes::id::AnimationTimeline, prototypes::id::DocumentTimeline, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
     356             :   IsBaseOf<nsISupports, mozilla::dom::DocumentTimeline >::value,
     357             :   sNativePropertyHooks,
     358             :   FindAssociatedGlobalForNative<mozilla::dom::DocumentTimeline>::Get,
     359             :   GetProtoObjectHandle,
     360             :   GetCCParticipant<mozilla::dom::DocumentTimeline>::Get()
     361             : };
     362             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
     363             :               "Must have the right minimal number of reserved slots.");
     364             : static_assert(1 >= 1,
     365             :               "Must have enough reserved slots.");
     366             : 
     367             : const JSClass*
     368           0 : GetJSClass()
     369             : {
     370           0 :   return sClass.ToJSClass();
     371             : }
     372             : 
     373             : bool
     374           0 : Wrap(JSContext* aCx, mozilla::dom::DocumentTimeline* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     375             : {
     376             :   MOZ_ASSERT(static_cast<mozilla::dom::DocumentTimeline*>(aObject) ==
     377             :              reinterpret_cast<mozilla::dom::DocumentTimeline*>(aObject),
     378             :              "Multiple inheritance for mozilla::dom::DocumentTimeline is broken.");
     379             :   MOZ_ASSERT(static_cast<mozilla::dom::AnimationTimeline*>(aObject) ==
     380             :              reinterpret_cast<mozilla::dom::AnimationTimeline*>(aObject),
     381             :              "Multiple inheritance for mozilla::dom::AnimationTimeline is broken.");
     382           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     383           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     384           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
     385             :              "You should probably not be using Wrap() directly; use "
     386             :              "GetOrCreateDOMReflector instead");
     387             : 
     388           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
     389             :              "nsISupports must be on our primary inheritance chain");
     390             : 
     391           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
     392           0 :   if (!global) {
     393           0 :     return false;
     394             :   }
     395           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
     396           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
     397             : 
     398             :   // That might have ended up wrapping us already, due to the wonders
     399             :   // of XBL.  Check for that, and bail out as needed.
     400           0 :   aReflector.set(aCache->GetWrapper());
     401           0 :   if (aReflector) {
     402             : #ifdef DEBUG
     403           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
     404             : #endif // DEBUG
     405           0 :     return true;
     406             :   }
     407             : 
     408           0 :   JSAutoCompartment ac(aCx, global);
     409           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     410           0 :   if (!canonicalProto) {
     411           0 :     return false;
     412             :   }
     413           0 :   JS::Rooted<JSObject*> proto(aCx);
     414           0 :   if (aGivenProto) {
     415           0 :     proto = aGivenProto;
     416             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     417             :     // coming in, we changed compartments to that of "parent" so may need
     418             :     // to wrap the proto here.
     419           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     420           0 :       if (!JS_WrapObject(aCx, &proto)) {
     421           0 :         return false;
     422             :       }
     423             :     }
     424             :   } else {
     425           0 :     proto = canonicalProto;
     426             :   }
     427             : 
     428           0 :   BindingJSObjectCreator<mozilla::dom::DocumentTimeline> creator(aCx);
     429           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
     430           0 :   if (!aReflector) {
     431           0 :     return false;
     432             :   }
     433             : 
     434           0 :   aCache->SetWrapper(aReflector);
     435           0 :   creator.InitializationSucceeded();
     436             : 
     437           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
     438             :              aCache->GetWrapperPreserveColor() == aReflector);
     439             :   // If proto != canonicalProto, we have to preserve our wrapper;
     440             :   // otherwise we won't be able to properly recreate it later, since
     441             :   // we won't know what proto to use.  Note that we don't check
     442             :   // aGivenProto here, since it's entirely possible (and even
     443             :   // somewhat common) to have a non-null aGivenProto which is the
     444             :   // same as canonicalProto.
     445           0 :   if (proto != canonicalProto) {
     446           0 :     PreserveWrapper(aObject);
     447             :   }
     448             : 
     449           0 :   return true;
     450             : }
     451             : 
     452             : const NativePropertyHooks sNativePropertyHooks[] = { {
     453             :   nullptr,
     454             :   nullptr,
     455             :   nullptr,
     456             :   { nullptr, nullptr },
     457             :   prototypes::id::DocumentTimeline,
     458             :   constructors::id::DocumentTimeline,
     459             :   AnimationTimelineBinding::sNativePropertyHooks,
     460             :   &DefaultXrayExpandoObjectClass
     461             : } };
     462             : 
     463             : void
     464           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     465             : {
     466           0 :   JS::Handle<JSObject*> parentProto(AnimationTimelineBinding::GetProtoObjectHandle(aCx));
     467           0 :   if (!parentProto) {
     468           0 :     return;
     469             :   }
     470             : 
     471           0 :   JS::Handle<JSObject*> constructorProto(AnimationTimelineBinding::GetConstructorObjectHandle(aCx));
     472           0 :   if (!constructorProto) {
     473           0 :     return;
     474             :   }
     475             : 
     476           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::DocumentTimeline);
     477           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::DocumentTimeline);
     478           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     479             :                               &sPrototypeClass.mBase, protoCache,
     480             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     481             :                               interfaceCache,
     482             :                               nullptr,
     483             :                               nullptr,
     484             :                               "DocumentTimeline", aDefineOnGlobal,
     485             :                               nullptr,
     486           0 :                               false);
     487             : }
     488             : 
     489             : JS::Handle<JSObject*>
     490           0 : GetProtoObjectHandle(JSContext* aCx)
     491             : {
     492             :   /* Get the interface prototype object for this class.  This will create the
     493             :      object as needed. */
     494           0 :   bool aDefineOnGlobal = true;
     495             : 
     496             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     497           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     498           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     499           0 :     return nullptr;
     500             :   }
     501             : 
     502             :   /* Check to see whether the interface objects are already installed */
     503           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     504           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::DocumentTimeline)) {
     505           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     506           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     507             :   }
     508             : 
     509             :   /*
     510             :    * The object might _still_ be null, but that's OK.
     511             :    *
     512             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     513             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     514             :    * changed after they have been set.
     515             :    *
     516             :    * Calling address() avoids the read read barrier that does gray
     517             :    * unmarking, but it's not possible for the object to be gray here.
     518             :    */
     519             : 
     520           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::DocumentTimeline);
     521           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     522           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     523             : }
     524             : 
     525             : JS::Handle<JSObject*>
     526           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     527             : {
     528             :   /* Get the interface object for this class.  This will create the object as
     529             :      needed. */
     530             : 
     531             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     532           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     533           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     534           0 :     return nullptr;
     535             :   }
     536             : 
     537             :   /* Check to see whether the interface objects are already installed */
     538           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     539           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::DocumentTimeline)) {
     540           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     541           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     542             :   }
     543             : 
     544             :   /*
     545             :    * The object might _still_ be null, but that's OK.
     546             :    *
     547             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     548             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     549             :    * changed after they have been set.
     550             :    *
     551             :    * Calling address() avoids the read read barrier that does gray
     552             :    * unmarking, but it's not possible for the object to be gray here.
     553             :    */
     554             : 
     555           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::DocumentTimeline);
     556           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     557           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     558             : }
     559             : 
     560             : JSObject*
     561           0 : GetConstructorObject(JSContext* aCx)
     562             : {
     563           0 :   return GetConstructorObjectHandle(aCx);
     564             : }
     565             : 
     566             : } // namespace DocumentTimelineBinding
     567             : 
     568             : 
     569             : 
     570             : } // namespace dom
     571             : } // namespace mozilla

Generated by: LCOV version 1.13