LCOV - code coverage report
Current view: top level - dom/base - DOMCursor.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 38 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 13 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
       5             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #include "DOMCursor.h"
       8             : #include "mozilla/dom/DOMCursorBinding.h"
       9             : 
      10             : namespace mozilla {
      11             : namespace dom {
      12             : 
      13           0 : NS_IMPL_CYCLE_COLLECTION_INHERITED(DOMCursor, DOMRequest,
      14             :                                    mCallback)
      15             : 
      16           0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(DOMCursor)
      17           0 :   NS_INTERFACE_MAP_ENTRY(nsIDOMDOMCursor)
      18           0 : NS_INTERFACE_MAP_END_INHERITING(DOMRequest)
      19             : 
      20           0 : NS_IMPL_ADDREF_INHERITED(DOMCursor, DOMRequest)
      21           0 : NS_IMPL_RELEASE_INHERITED(DOMCursor, DOMRequest)
      22             : 
      23           0 : DOMCursor::DOMCursor(nsPIDOMWindowInner* aWindow, nsICursorContinueCallback* aCallback)
      24             :   : DOMRequest(aWindow)
      25             :   , mCallback(aCallback)
      26           0 :   , mFinished(false)
      27             : {
      28           0 : }
      29             : 
      30           0 : DOMCursor::DOMCursor(nsIGlobalObject* aGlobal, nsICursorContinueCallback* aCallback)
      31             :   : DOMRequest(aGlobal)
      32             :   , mCallback(aCallback)
      33           0 :   , mFinished(false)
      34             : {
      35           0 : }
      36             : 
      37             : void
      38           0 : DOMCursor::Reset()
      39             : {
      40           0 :   MOZ_ASSERT(!mFinished);
      41             : 
      42             :   // Reset the request state so we can FireSuccess() again.
      43           0 :   mResult.setUndefined();
      44           0 :   mDone = false;
      45           0 : }
      46             : 
      47             : void
      48           0 : DOMCursor::FireDone()
      49             : {
      50           0 :   Reset();
      51           0 :   mFinished = true;
      52           0 :   FireSuccess(JS::UndefinedHandleValue);
      53           0 : }
      54             : 
      55             : NS_IMETHODIMP
      56           0 : DOMCursor::GetDone(bool *aDone)
      57             : {
      58           0 :   *aDone = Done();
      59           0 :   return NS_OK;
      60             : }
      61             : 
      62             : NS_IMETHODIMP
      63           0 : DOMCursor::Continue()
      64             : {
      65           0 :   ErrorResult rv;
      66           0 :   Continue(rv);
      67           0 :   return rv.StealNSResult();
      68             : }
      69             : 
      70             : void
      71           0 : DOMCursor::Continue(ErrorResult& aRv)
      72             : {
      73           0 :   MOZ_ASSERT(mCallback, "If you're creating your own cursor class with no callback, you should override Continue()");
      74             : 
      75             :   // We need to have a result here because we must be in a 'success' state.
      76           0 :   if (mResult.isUndefined()) {
      77           0 :     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
      78           0 :     return;
      79             :   }
      80             : 
      81           0 :   Reset();
      82           0 :   mCallback->HandleContinue();
      83             : }
      84             : 
      85             : /* virtual */ JSObject*
      86           0 : DOMCursor::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
      87             : {
      88           0 :   return DOMCursorBinding::Wrap(aCx, this, aGivenProto);
      89             : }
      90             : 
      91             : } // namespace dom
      92             : } // namespace mozilla

Generated by: LCOV version 1.13