/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */

#ifndef mozilla_dom_WebGL2RenderingContextBinding_h
#define mozilla_dom_WebGL2RenderingContextBinding_h

#include "js/RootingAPI.h"
#include "jsfriendapi.h"
#include "jspubtd.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/TypedArray.h"
#include "mozilla/dom/UnionMember.h"

namespace mozilla {

class WebGL2Context;
struct WebGL2ContextAtoms;
class WebGLBuffer;
class WebGLQuery;
struct WebGLQueryAtoms;
class WebGLSampler;
struct WebGLSamplerAtoms;
class WebGLSync;
struct WebGLSyncAtoms;
class WebGLTransformFeedback;
struct WebGLTransformFeedbackAtoms;

namespace dom {

struct NativePropertyHooks;
class OwningWebGLBufferOrLongLong;
class ProtoAndIfaceCache;

} // namespace dom

} // namespace mozilla

namespace mozilla {
namespace dom {

void
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningWebGLBufferOrLongLong& aUnion, const char* aName, uint32_t aFlags = 0);


void
ImplCycleCollectionUnlink(OwningWebGLBufferOrLongLong& aUnion);


class UnsignedLongOrUint32ArrayOrBoolean
{
  friend class UnsignedLongOrUint32ArrayOrBooleanArgument;
  enum Type
  {
    eUninitialized,
    eUnsignedLong,
    eUint32Array,
    eBoolean
  };

  union Value
  {
    UnionMember<uint32_t > mUnsignedLong;
    UnionMember<RootedTypedArray<Uint32Array> > mUint32Array;
    UnionMember<bool > mBoolean;

  };

  Type mType;
  Value mValue;

  UnsignedLongOrUint32ArrayOrBoolean(const UnsignedLongOrUint32ArrayOrBoolean&) = delete;
  void operator=(const UnsignedLongOrUint32ArrayOrBoolean) = delete;
public:
  explicit inline UnsignedLongOrUint32ArrayOrBoolean()
    : mType(eUninitialized)
  {
  }

  inline ~UnsignedLongOrUint32ArrayOrBoolean()
  {
    Uninit();
  }

  inline uint32_t&
  RawSetAsUnsignedLong()
  {
    if (mType == eUnsignedLong) {
      return mValue.mUnsignedLong.Value();
    }
    MOZ_ASSERT(mType == eUninitialized);
    mType = eUnsignedLong;
    return mValue.mUnsignedLong.SetValue();
  }

  inline uint32_t&
  SetAsUnsignedLong()
  {
    if (mType == eUnsignedLong) {
      return mValue.mUnsignedLong.Value();
    }
    Uninit();
    mType = eUnsignedLong;
    return mValue.mUnsignedLong.SetValue();
  }

  inline bool
  IsUnsignedLong() const
  {
    return mType == eUnsignedLong;
  }

  inline uint32_t&
  GetAsUnsignedLong()
  {
    MOZ_ASSERT(IsUnsignedLong(), "Wrong type!");
    return mValue.mUnsignedLong.Value();
  }

  inline uint32_t
  GetAsUnsignedLong() const
  {
    MOZ_ASSERT(IsUnsignedLong(), "Wrong type!");
    return mValue.mUnsignedLong.Value();
  }

  inline RootedTypedArray<Uint32Array>&
  RawSetAsUint32Array(JSContext* cx)
  {
    if (mType == eUint32Array) {
      return mValue.mUint32Array.Value();
    }
    MOZ_ASSERT(mType == eUninitialized);
    mType = eUint32Array;
    return mValue.mUint32Array.SetValue(cx);
  }

  inline RootedTypedArray<Uint32Array>&
  SetAsUint32Array(JSContext* cx)
  {
    if (mType == eUint32Array) {
      return mValue.mUint32Array.Value();
    }
    Uninit();
    mType = eUint32Array;
    return mValue.mUint32Array.SetValue(cx);
  }

  inline bool
  IsUint32Array() const
  {
    return mType == eUint32Array;
  }

  inline RootedTypedArray<Uint32Array>&
  GetAsUint32Array()
  {
    MOZ_ASSERT(IsUint32Array(), "Wrong type!");
    return mValue.mUint32Array.Value();
  }

  inline Uint32Array const &
  GetAsUint32Array() const
  {
    MOZ_ASSERT(IsUint32Array(), "Wrong type!");
    return mValue.mUint32Array.Value();
  }

  inline bool&
  RawSetAsBoolean()
  {
    if (mType == eBoolean) {
      return mValue.mBoolean.Value();
    }
    MOZ_ASSERT(mType == eUninitialized);
    mType = eBoolean;
    return mValue.mBoolean.SetValue();
  }

  inline bool&
  SetAsBoolean()
  {
    if (mType == eBoolean) {
      return mValue.mBoolean.Value();
    }
    Uninit();
    mType = eBoolean;
    return mValue.mBoolean.SetValue();
  }

  inline bool
  IsBoolean() const
  {
    return mType == eBoolean;
  }

  inline bool&
  GetAsBoolean()
  {
    MOZ_ASSERT(IsBoolean(), "Wrong type!");
    return mValue.mBoolean.Value();
  }

  inline bool
  GetAsBoolean() const
  {
    MOZ_ASSERT(IsBoolean(), "Wrong type!");
    return mValue.mBoolean.Value();
  }

  inline void
  Uninit()
  {
    switch (mType) {
      case eUninitialized: {
        break;
      }
      case eUnsignedLong: {
        DestroyUnsignedLong();
        break;
      }
      case eUint32Array: {
        DestroyUint32Array();
        break;
      }
      case eBoolean: {
        DestroyBoolean();
        break;
      }
    }
  }

  bool
  ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;

private:
  inline void
  DestroyUnsignedLong()
  {
    MOZ_ASSERT(IsUnsignedLong(), "Wrong type!");
    mValue.mUnsignedLong.Destroy();
    mType = eUninitialized;
  }

  inline void
  DestroyUint32Array()
  {
    MOZ_ASSERT(IsUint32Array(), "Wrong type!");
    mValue.mUint32Array.Destroy();
    mType = eUninitialized;
  }

  inline void
  DestroyBoolean()
  {
    MOZ_ASSERT(IsBoolean(), "Wrong type!");
    mValue.mBoolean.Destroy();
    mType = eUninitialized;
  }
};


class OwningUnsignedLongOrUint32ArrayOrBoolean : public AllOwningUnionBase
{
  friend void ImplCycleCollectionUnlink(OwningUnsignedLongOrUint32ArrayOrBoolean& aUnion);
  enum Type
  {
    eUninitialized,
    eUnsignedLong,
    eUint32Array,
    eBoolean
  };

  union Value
  {
    UnionMember<uint32_t > mUnsignedLong;
    UnionMember<Uint32Array > mUint32Array;
    UnionMember<bool > mBoolean;

  };

  Type mType;
  Value mValue;

  OwningUnsignedLongOrUint32ArrayOrBoolean(const OwningUnsignedLongOrUint32ArrayOrBoolean&) = delete;
  void operator=(const OwningUnsignedLongOrUint32ArrayOrBoolean) = delete;
public:
  explicit inline OwningUnsignedLongOrUint32ArrayOrBoolean()
    : mType(eUninitialized)
  {
  }

  inline ~OwningUnsignedLongOrUint32ArrayOrBoolean()
  {
    Uninit();
  }

  uint32_t&
  RawSetAsUnsignedLong();

  uint32_t&
  SetAsUnsignedLong();

  bool
  TrySetToUnsignedLong(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);

  inline bool
  IsUnsignedLong() const
  {
    return mType == eUnsignedLong;
  }

  inline uint32_t&
  GetAsUnsignedLong()
  {
    MOZ_ASSERT(IsUnsignedLong(), "Wrong type!");
    return mValue.mUnsignedLong.Value();
  }

  inline uint32_t const &
  GetAsUnsignedLong() const
  {
    MOZ_ASSERT(IsUnsignedLong(), "Wrong type!");
    return mValue.mUnsignedLong.Value();
  }

  Uint32Array&
  RawSetAsUint32Array();

  Uint32Array&
  SetAsUint32Array();

  bool
  TrySetToUint32Array(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);

  inline bool
  IsUint32Array() const
  {
    return mType == eUint32Array;
  }

  inline Uint32Array&
  GetAsUint32Array()
  {
    MOZ_ASSERT(IsUint32Array(), "Wrong type!");
    return mValue.mUint32Array.Value();
  }

  inline Uint32Array const &
  GetAsUint32Array() const
  {
    MOZ_ASSERT(IsUint32Array(), "Wrong type!");
    return mValue.mUint32Array.Value();
  }

  bool&
  RawSetAsBoolean();

  bool&
  SetAsBoolean();

  bool
  TrySetToBoolean(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);

  inline bool
  IsBoolean() const
  {
    return mType == eBoolean;
  }

  inline bool&
  GetAsBoolean()
  {
    MOZ_ASSERT(IsBoolean(), "Wrong type!");
    return mValue.mBoolean.Value();
  }

  inline bool const &
  GetAsBoolean() const
  {
    MOZ_ASSERT(IsBoolean(), "Wrong type!");
    return mValue.mBoolean.Value();
  }

  void
  Uninit();

  bool
  ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;

  void
  TraceUnion(JSTracer* trc);

private:
  void
  DestroyUnsignedLong();

  void
  DestroyUint32Array();

  void
  DestroyBoolean();
};


class WebGLBufferOrLongLong
{
  friend class WebGLBufferOrLongLongArgument;
  enum Type
  {
    eUninitialized,
    eWebGLBuffer,
    eLongLong
  };

  union Value
  {
    UnionMember<NonNull<mozilla::WebGLBuffer> > mWebGLBuffer;
    UnionMember<int64_t > mLongLong;

  };

  Type mType;
  Value mValue;

  WebGLBufferOrLongLong(const WebGLBufferOrLongLong&) = delete;
  void operator=(const WebGLBufferOrLongLong) = delete;
public:
  explicit inline WebGLBufferOrLongLong()
    : mType(eUninitialized)
  {
  }

  inline ~WebGLBufferOrLongLong()
  {
    Uninit();
  }

  inline NonNull<mozilla::WebGLBuffer>&
  RawSetAsWebGLBuffer()
  {
    if (mType == eWebGLBuffer) {
      return mValue.mWebGLBuffer.Value();
    }
    MOZ_ASSERT(mType == eUninitialized);
    mType = eWebGLBuffer;
    return mValue.mWebGLBuffer.SetValue();
  }

  inline NonNull<mozilla::WebGLBuffer>&
  SetAsWebGLBuffer()
  {
    if (mType == eWebGLBuffer) {
      return mValue.mWebGLBuffer.Value();
    }
    Uninit();
    mType = eWebGLBuffer;
    return mValue.mWebGLBuffer.SetValue();
  }

  inline bool
  IsWebGLBuffer() const
  {
    return mType == eWebGLBuffer;
  }

  inline NonNull<mozilla::WebGLBuffer>&
  GetAsWebGLBuffer()
  {
    MOZ_ASSERT(IsWebGLBuffer(), "Wrong type!");
    return mValue.mWebGLBuffer.Value();
  }

  inline mozilla::WebGLBuffer&
  GetAsWebGLBuffer() const
  {
    MOZ_ASSERT(IsWebGLBuffer(), "Wrong type!");
    return mValue.mWebGLBuffer.Value();
  }

  inline int64_t&
  RawSetAsLongLong()
  {
    if (mType == eLongLong) {
      return mValue.mLongLong.Value();
    }
    MOZ_ASSERT(mType == eUninitialized);
    mType = eLongLong;
    return mValue.mLongLong.SetValue();
  }

  inline int64_t&
  SetAsLongLong()
  {
    if (mType == eLongLong) {
      return mValue.mLongLong.Value();
    }
    Uninit();
    mType = eLongLong;
    return mValue.mLongLong.SetValue();
  }

  inline bool
  IsLongLong() const
  {
    return mType == eLongLong;
  }

  inline int64_t&
  GetAsLongLong()
  {
    MOZ_ASSERT(IsLongLong(), "Wrong type!");
    return mValue.mLongLong.Value();
  }

  inline int64_t
  GetAsLongLong() const
  {
    MOZ_ASSERT(IsLongLong(), "Wrong type!");
    return mValue.mLongLong.Value();
  }

  inline void
  Uninit()
  {
    switch (mType) {
      case eUninitialized: {
        break;
      }
      case eWebGLBuffer: {
        DestroyWebGLBuffer();
        break;
      }
      case eLongLong: {
        DestroyLongLong();
        break;
      }
    }
  }

  bool
  ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;

private:
  inline void
  DestroyWebGLBuffer()
  {
    MOZ_ASSERT(IsWebGLBuffer(), "Wrong type!");
    mValue.mWebGLBuffer.Destroy();
    mType = eUninitialized;
  }

  inline void
  DestroyLongLong()
  {
    MOZ_ASSERT(IsLongLong(), "Wrong type!");
    mValue.mLongLong.Destroy();
    mType = eUninitialized;
  }
};


class OwningWebGLBufferOrLongLong : public AllOwningUnionBase
{
  friend void ImplCycleCollectionUnlink(OwningWebGLBufferOrLongLong& aUnion);
  enum Type
  {
    eUninitialized,
    eWebGLBuffer,
    eLongLong
  };

  union Value
  {
    UnionMember<OwningNonNull<mozilla::WebGLBuffer> > mWebGLBuffer;
    UnionMember<int64_t > mLongLong;

  };

  Type mType;
  Value mValue;

public:
  explicit inline OwningWebGLBufferOrLongLong()
    : mType(eUninitialized)
  {
  }

  explicit inline OwningWebGLBufferOrLongLong(const OwningWebGLBufferOrLongLong& aOther)
    : mType(eUninitialized)
  {
    *this = aOther;
  }

  inline ~OwningWebGLBufferOrLongLong()
  {
    Uninit();
  }

  OwningNonNull<mozilla::WebGLBuffer>&
  RawSetAsWebGLBuffer();

  OwningNonNull<mozilla::WebGLBuffer>&
  SetAsWebGLBuffer();

  bool
  TrySetToWebGLBuffer(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);

  inline bool
  IsWebGLBuffer() const
  {
    return mType == eWebGLBuffer;
  }

  inline OwningNonNull<mozilla::WebGLBuffer>&
  GetAsWebGLBuffer()
  {
    MOZ_ASSERT(IsWebGLBuffer(), "Wrong type!");
    return mValue.mWebGLBuffer.Value();
  }

  inline OwningNonNull<mozilla::WebGLBuffer> const &
  GetAsWebGLBuffer() const
  {
    MOZ_ASSERT(IsWebGLBuffer(), "Wrong type!");
    return mValue.mWebGLBuffer.Value();
  }

  int64_t&
  RawSetAsLongLong();

  int64_t&
  SetAsLongLong();

  bool
  TrySetToLongLong(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);

  inline bool
  IsLongLong() const
  {
    return mType == eLongLong;
  }

  inline int64_t&
  GetAsLongLong()
  {
    MOZ_ASSERT(IsLongLong(), "Wrong type!");
    return mValue.mLongLong.Value();
  }

  inline int64_t const &
  GetAsLongLong() const
  {
    MOZ_ASSERT(IsLongLong(), "Wrong type!");
    return mValue.mLongLong.Value();
  }

  void
  Uninit();

  bool
  ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;

  void
  TraceUnion(JSTracer* trc);

  void
  operator=(const OwningWebGLBufferOrLongLong& aOther);

private:
  void
  DestroyWebGLBuffer();

  void
  DestroyLongLong();
};


namespace WebGL2RenderingContextBinding {

  typedef mozilla::WebGL2Context NativeType;

  // We declare this as an array so that retrieving a pointer to this
  // binding's property hooks only requires compile/link-time resolvable
  // address arithmetic.  Declaring it as a pointer instead would require
  // doing a run-time load to fetch a pointer to this binding's property
  // hooks.  And then structures which embedded a pointer to this structure
  // would require a run-time load for proper initialization, which would
  // then induce static constructors.  Lots of static constructors.
  extern const NativePropertyHooks sNativePropertyHooks[];

  JSObject*
  DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);

  bool
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);

  const JSClass*
  GetJSClass();

  bool
  Wrap(JSContext* aCx, mozilla::WebGL2Context* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);

  template <class T>
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
  {
    JS::Rooted<JSObject*> reflector(aCx);
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
  }

  void
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);

  JS::Handle<JSObject*>
  GetProtoObjectHandle(JSContext* aCx, JS::Handle<JSObject*> aGlobal);

  JS::Handle<JSObject*>
  GetConstructorObjectHandle(JSContext* aCx, JS::Handle<JSObject*> aGlobal, bool aDefineOnGlobal = true);

  JSObject*
  GetConstructorObject(JSContext* aCx, JS::Handle<JSObject*> aGlobal);

} // namespace WebGL2RenderingContextBinding



namespace WebGLQueryBinding {

  typedef mozilla::WebGLQuery NativeType;

  // We declare this as an array so that retrieving a pointer to this
  // binding's property hooks only requires compile/link-time resolvable
  // address arithmetic.  Declaring it as a pointer instead would require
  // doing a run-time load to fetch a pointer to this binding's property
  // hooks.  And then structures which embedded a pointer to this structure
  // would require a run-time load for proper initialization, which would
  // then induce static constructors.  Lots of static constructors.
  extern const NativePropertyHooks sNativePropertyHooks[];

  JSObject*
  DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);

  bool
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);

  const JSClass*
  GetJSClass();

  bool
  Wrap(JSContext* aCx, mozilla::WebGLQuery* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);

  template <class T>
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
  {
    JS::Rooted<JSObject*> reflector(aCx);
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
  }

  void
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);

  JS::Handle<JSObject*>
  GetProtoObjectHandle(JSContext* aCx, JS::Handle<JSObject*> aGlobal);

  JS::Handle<JSObject*>
  GetConstructorObjectHandle(JSContext* aCx, JS::Handle<JSObject*> aGlobal, bool aDefineOnGlobal = true);

  JSObject*
  GetConstructorObject(JSContext* aCx, JS::Handle<JSObject*> aGlobal);

} // namespace WebGLQueryBinding



namespace WebGLSamplerBinding {

  typedef mozilla::WebGLSampler NativeType;

  // We declare this as an array so that retrieving a pointer to this
  // binding's property hooks only requires compile/link-time resolvable
  // address arithmetic.  Declaring it as a pointer instead would require
  // doing a run-time load to fetch a pointer to this binding's property
  // hooks.  And then structures which embedded a pointer to this structure
  // would require a run-time load for proper initialization, which would
  // then induce static constructors.  Lots of static constructors.
  extern const NativePropertyHooks sNativePropertyHooks[];

  JSObject*
  DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);

  bool
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);

  const JSClass*
  GetJSClass();

  bool
  Wrap(JSContext* aCx, mozilla::WebGLSampler* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);

  template <class T>
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
  {
    JS::Rooted<JSObject*> reflector(aCx);
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
  }

  void
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);

  JS::Handle<JSObject*>
  GetProtoObjectHandle(JSContext* aCx, JS::Handle<JSObject*> aGlobal);

  JS::Handle<JSObject*>
  GetConstructorObjectHandle(JSContext* aCx, JS::Handle<JSObject*> aGlobal, bool aDefineOnGlobal = true);

  JSObject*
  GetConstructorObject(JSContext* aCx, JS::Handle<JSObject*> aGlobal);

} // namespace WebGLSamplerBinding



namespace WebGLSyncBinding {

  typedef mozilla::WebGLSync NativeType;

  // We declare this as an array so that retrieving a pointer to this
  // binding's property hooks only requires compile/link-time resolvable
  // address arithmetic.  Declaring it as a pointer instead would require
  // doing a run-time load to fetch a pointer to this binding's property
  // hooks.  And then structures which embedded a pointer to this structure
  // would require a run-time load for proper initialization, which would
  // then induce static constructors.  Lots of static constructors.
  extern const NativePropertyHooks sNativePropertyHooks[];

  JSObject*
  DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);

  bool
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);

  const JSClass*
  GetJSClass();

  bool
  Wrap(JSContext* aCx, mozilla::WebGLSync* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);

  template <class T>
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
  {
    JS::Rooted<JSObject*> reflector(aCx);
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
  }

  void
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);

  JS::Handle<JSObject*>
  GetProtoObjectHandle(JSContext* aCx, JS::Handle<JSObject*> aGlobal);

  JS::Handle<JSObject*>
  GetConstructorObjectHandle(JSContext* aCx, JS::Handle<JSObject*> aGlobal, bool aDefineOnGlobal = true);

  JSObject*
  GetConstructorObject(JSContext* aCx, JS::Handle<JSObject*> aGlobal);

} // namespace WebGLSyncBinding



namespace WebGLTransformFeedbackBinding {

  typedef mozilla::WebGLTransformFeedback NativeType;

  // We declare this as an array so that retrieving a pointer to this
  // binding's property hooks only requires compile/link-time resolvable
  // address arithmetic.  Declaring it as a pointer instead would require
  // doing a run-time load to fetch a pointer to this binding's property
  // hooks.  And then structures which embedded a pointer to this structure
  // would require a run-time load for proper initialization, which would
  // then induce static constructors.  Lots of static constructors.
  extern const NativePropertyHooks sNativePropertyHooks[];

  JSObject*
  DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);

  bool
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);

  const JSClass*
  GetJSClass();

  bool
  Wrap(JSContext* aCx, mozilla::WebGLTransformFeedback* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);

  template <class T>
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
  {
    JS::Rooted<JSObject*> reflector(aCx);
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
  }

  void
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);

  JS::Handle<JSObject*>
  GetProtoObjectHandle(JSContext* aCx, JS::Handle<JSObject*> aGlobal);

  JS::Handle<JSObject*>
  GetConstructorObjectHandle(JSContext* aCx, JS::Handle<JSObject*> aGlobal, bool aDefineOnGlobal = true);

  JSObject*
  GetConstructorObject(JSContext* aCx, JS::Handle<JSObject*> aGlobal);

} // namespace WebGLTransformFeedbackBinding



} // namespace dom
} // namespace mozilla

#endif // mozilla_dom_WebGL2RenderingContextBinding_h
