LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dom/bindings - EventListenerBinding.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 22 32 68.8 %
Date: 2017-07-14 16:53:18 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM EventListener.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "AtomList.h"
       4             : #include "EventListenerBinding.h"
       5             : #include "mozilla/OwningNonNull.h"
       6             : #include "mozilla/dom/BindingUtils.h"
       7             : #include "mozilla/dom/Event.h"
       8             : #include "mozilla/dom/NonRefcountedDOMObject.h"
       9             : 
      10             : namespace mozilla {
      11             : namespace dom {
      12             : 
      13             : void
      14          32 : EventListener::HandleEvent(JSContext* cx, JS::Handle<JS::Value> aThisVal, Event& event, ErrorResult& aRv)
      15             : {
      16          64 :   JS::Rooted<JS::Value> rval(cx, JS::UndefinedValue());
      17          64 :   JS::AutoValueVector argv(cx);
      18          32 :   if (!argv.resize(1)) {
      19           0 :     aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
      20           0 :     return;
      21             :   }
      22          32 :   unsigned argc = 1;
      23             : 
      24             :   do {
      25          32 :     if (!GetOrCreateDOMReflector(cx, event, argv[0])) {
      26           0 :       MOZ_ASSERT(true || JS_IsExceptionPending(cx));
      27           0 :       aRv.Throw(NS_ERROR_UNEXPECTED);
      28           0 :       return;
      29             :     }
      30          32 :     break;
      31             :   } while (0);
      32             : 
      33          32 :   bool isCallable = JS::IsCallable(mCallback);
      34          64 :   JS::Rooted<JS::Value> callable(cx);
      35          32 :   if (isCallable) {
      36          11 :     callable = JS::ObjectValue(*mCallback);
      37             :   } else {
      38          21 :     EventListenerAtoms* atomsCache = GetAtomCache<EventListenerAtoms>(cx);
      39          84 :     if ((!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) ||
      40          84 :         !GetCallableProperty(cx, atomsCache->handleEvent_id, &callable)) {
      41           0 :       aRv.Throw(NS_ERROR_UNEXPECTED);
      42           0 :       return;
      43             :     }
      44             :   }
      45          85 :   JS::Rooted<JS::Value> thisValue(cx, isCallable ? aThisVal.get()
      46          85 :                                                  : JS::ObjectValue(*mCallback));
      47          96 :   if (!JS::Call(cx, thisValue, callable,
      48          64 :                 JS::HandleValueArray::subarray(argv, 0, argc), &rval)) {
      49           0 :     aRv.NoteJSContextException(cx);
      50           0 :     return;
      51             :   }
      52             : }
      53             : 
      54             : bool
      55           1 : EventListener::InitIds(JSContext* cx, EventListenerAtoms* atomsCache)
      56             : {
      57           1 :   MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache));
      58             : 
      59             :   // Initialize these in reverse order so that any failure leaves the first one
      60             :   // uninitialized.
      61           1 :   if (!atomsCache->handleEvent_id.init(cx, "handleEvent")) {
      62           0 :     return false;
      63             :   }
      64           1 :   return true;
      65             : }
      66             : 
      67             : 
      68             : 
      69             : namespace binding_detail {
      70             : } // namespace binding_detail
      71             : 
      72             : 
      73             : } // namespace dom
      74             : } // namespace mozilla

Generated by: LCOV version 1.13