1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=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/. */
8 #include "mozilla/dom/DOMCursorBinding.h"
13 NS_IMPL_CYCLE_COLLECTION_INHERITED(DOMCursor
, DOMRequest
,
16 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(DOMCursor
)
17 NS_INTERFACE_MAP_ENTRY(nsIDOMDOMCursor
)
18 NS_INTERFACE_MAP_END_INHERITING(DOMRequest
)
20 NS_IMPL_ADDREF_INHERITED(DOMCursor
, DOMRequest
)
21 NS_IMPL_RELEASE_INHERITED(DOMCursor
, DOMRequest
)
23 DOMCursor::DOMCursor(nsPIDOMWindow
* aWindow
, nsICursorContinueCallback
* aCallback
)
25 , mCallback(aCallback
)
33 MOZ_ASSERT(!mFinished
);
35 // Reset the request state so we can FireSuccess() again.
45 FireSuccess(JS::UndefinedHandleValue
);
49 DOMCursor::GetDone(bool *aDone
)
60 return rv
.ErrorCode();
64 DOMCursor::Continue(ErrorResult
& aRv
)
66 MOZ_ASSERT(mCallback
, "If you're creating your own cursor class with no callback, you should override Continue()");
68 // We need to have a result here because we must be in a 'success' state.
69 if (mResult
== JSVAL_VOID
) {
70 aRv
.Throw(NS_ERROR_DOM_INVALID_STATE_ERR
);
75 mCallback
->HandleContinue();
78 /* virtual */ JSObject
*
79 DOMCursor::WrapObject(JSContext
* aCx
)
81 return DOMCursorBinding::Wrap(aCx
, this);
85 } // namespace mozilla