no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / dom / bindings / CallbackInterface.h
blob4cb46217c26350c4edba0f8290f14da16be860d0
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
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /**
8 * A common base class for representing WebIDL callback interface types in C++.
10 * This class implements common functionality like lifetime management,
11 * initialization with the callback object, and setup of the call environment.
12 * Subclasses corresponding to particular callback interface types should
13 * provide methods that actually do the various necessary calls.
16 #ifndef mozilla_dom_CallbackInterface_h
17 #define mozilla_dom_CallbackInterface_h
19 #include "mozilla/dom/CallbackObject.h"
21 namespace mozilla::dom {
23 class CallbackInterface : public CallbackObject {
24 public:
25 // See CallbackObject for an explanation of the arguments.
26 explicit CallbackInterface(JSContext* aCx, JS::Handle<JSObject*> aCallback,
27 JS::Handle<JSObject*> aCallbackGlobal,
28 nsIGlobalObject* aIncumbentGlobal)
29 : CallbackObject(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal) {}
31 // See CallbackObject for an explanation of the arguments.
32 explicit CallbackInterface(JSObject* aCallback, JSObject* aCallbackGlobal,
33 JSObject* aAsyncStack,
34 nsIGlobalObject* aIncumbentGlobal)
35 : CallbackObject(aCallback, aCallbackGlobal, aAsyncStack,
36 aIncumbentGlobal) {}
38 protected:
39 bool GetCallableProperty(BindingCallContext& cx, JS::Handle<jsid> aPropId,
40 JS::MutableHandle<JS::Value> aCallable);
42 // See CallbackObject for an explanation of the arguments.
43 CallbackInterface(JSObject* aCallback, JSObject* aCallbackGlobal,
44 const FastCallbackConstructor&)
45 : CallbackObject(aCallback, aCallbackGlobal, FastCallbackConstructor()) {}
48 } // namespace mozilla::dom
50 #endif // mozilla_dom_CallbackFunction_h