/* THIS FILE IS AUTOGENERATED FROM Console.webidl BY Codegen.py - DO NOT EDIT */

#ifndef mozilla_dom_ConsoleBinding_h
#define mozilla_dom_ConsoleBinding_h

#include "js/RootingAPI.h"
#include "jspubtd.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/FakeString.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/UnionMember.h"

namespace mozilla {
namespace dom {

class Console;
struct ConsoleAtoms;
struct ConsoleCounterAtoms;
struct ConsoleCounterErrorAtoms;
struct ConsoleEventAtoms;
struct ConsoleProfileEventAtoms;
struct ConsoleStackEntryAtoms;
struct ConsoleTimerEndAtoms;
struct ConsoleTimerErrorAtoms;
struct ConsoleTimerStartAtoms;
struct NativePropertyHooks;
class OwningUnsignedLongLongOrString;
class ProtoAndIfaceCache;
class UnsignedLongLongOrString;

} // namespace dom
} // namespace mozilla

namespace mozilla {
namespace dom {

struct ConsoleCounter : public DictionaryBase
{
  MOZ_INIT_OUTSIDE_CTOR uint32_t mCount;
  MOZ_INIT_OUTSIDE_CTOR nsString mLabel;

  ConsoleCounter();

  explicit inline ConsoleCounter(const FastDictionaryInitializer& )
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline ConsoleCounter(const ConsoleCounter& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const ConsoleCounter& aOther);

private:
  static bool
  InitIds(JSContext* cx, ConsoleCounterAtoms* atomsCache);
};

namespace binding_detail {
struct FastConsoleCounter : public ConsoleCounter
{
  inline FastConsoleCounter()
    : ConsoleCounter(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct ConsoleCounterError : public DictionaryBase
{
  MOZ_INIT_OUTSIDE_CTOR nsString mError;

  ConsoleCounterError();

  explicit inline ConsoleCounterError(const FastDictionaryInitializer& )
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline ConsoleCounterError(const ConsoleCounterError& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const ConsoleCounterError& aOther);

private:
  static bool
  InitIds(JSContext* cx, ConsoleCounterErrorAtoms* atomsCache);
};

namespace binding_detail {
struct FastConsoleCounterError : public ConsoleCounterError
{
  inline FastConsoleCounterError()
    : ConsoleCounterError(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct ConsoleProfileEvent : public DictionaryBase
{
  MOZ_INIT_OUTSIDE_CTOR nsString mAction;
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<JS::Value>> mArguments;

  ConsoleProfileEvent();

  explicit inline ConsoleProfileEvent(const FastDictionaryInitializer& )
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

private:
  ConsoleProfileEvent(const ConsoleProfileEvent&) = delete;
  void operator=(const ConsoleProfileEvent&) = delete;

  static bool
  InitIds(JSContext* cx, ConsoleProfileEventAtoms* atomsCache);

public:
  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  void
  TraceDictionary(JSTracer* trc);
};

namespace binding_detail {
struct FastConsoleProfileEvent : public ConsoleProfileEvent
{
  inline FastConsoleProfileEvent()
    : ConsoleProfileEvent(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct ConsoleStackEntry : public DictionaryBase
{
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mAsyncCause;
  MOZ_INIT_OUTSIDE_CTOR uint32_t mColumnNumber;
  MOZ_INIT_OUTSIDE_CTOR nsString mFilename;
  MOZ_INIT_OUTSIDE_CTOR nsString mFunctionName;
  MOZ_INIT_OUTSIDE_CTOR uint32_t mLanguage;
  MOZ_INIT_OUTSIDE_CTOR uint32_t mLineNumber;

  ConsoleStackEntry();

  explicit inline ConsoleStackEntry(const FastDictionaryInitializer& )
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline ConsoleStackEntry(const ConsoleStackEntry& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const ConsoleStackEntry& aOther);

private:
  static bool
  InitIds(JSContext* cx, ConsoleStackEntryAtoms* atomsCache);
};

namespace binding_detail {
struct FastConsoleStackEntry : public ConsoleStackEntry
{
  inline FastConsoleStackEntry()
    : ConsoleStackEntry(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct ConsoleTimerEnd : public DictionaryBase
{
  MOZ_INIT_OUTSIDE_CTOR double mDuration;
  MOZ_INIT_OUTSIDE_CTOR nsString mName;

  ConsoleTimerEnd();

  explicit inline ConsoleTimerEnd(const FastDictionaryInitializer& )
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline ConsoleTimerEnd(const ConsoleTimerEnd& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const ConsoleTimerEnd& aOther);

private:
  static bool
  InitIds(JSContext* cx, ConsoleTimerEndAtoms* atomsCache);
};

namespace binding_detail {
struct FastConsoleTimerEnd : public ConsoleTimerEnd
{
  inline FastConsoleTimerEnd()
    : ConsoleTimerEnd(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct ConsoleTimerError : public DictionaryBase
{
  MOZ_INIT_OUTSIDE_CTOR nsString mError;

  ConsoleTimerError();

  explicit inline ConsoleTimerError(const FastDictionaryInitializer& )
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline ConsoleTimerError(const ConsoleTimerError& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const ConsoleTimerError& aOther);

private:
  static bool
  InitIds(JSContext* cx, ConsoleTimerErrorAtoms* atomsCache);
};

namespace binding_detail {
struct FastConsoleTimerError : public ConsoleTimerError
{
  inline FastConsoleTimerError()
    : ConsoleTimerError(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct ConsoleTimerStart : public DictionaryBase
{
  MOZ_INIT_OUTSIDE_CTOR nsString mName;
  MOZ_INIT_OUTSIDE_CTOR double mStarted;

  ConsoleTimerStart();

  explicit inline ConsoleTimerStart(const FastDictionaryInitializer& )
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline ConsoleTimerStart(const ConsoleTimerStart& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const ConsoleTimerStart& aOther);

private:
  static bool
  InitIds(JSContext* cx, ConsoleTimerStartAtoms* atomsCache);
};

namespace binding_detail {
struct FastConsoleTimerStart : public ConsoleTimerStart
{
  inline FastConsoleTimerStart()
    : ConsoleTimerStart(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


class UnsignedLongLongOrString
{
  friend class UnsignedLongLongOrStringArgument;
  enum Type
  {
    eUninitialized,
    eUnsignedLongLong,
    eString
  };

  union Value
  {
    UnionMember<uint64_t > mUnsignedLongLong;
    UnionMember<binding_detail::FakeString > mString;

  };

  Type mType;
  Value mValue;

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

  inline ~UnsignedLongLongOrString()
  {
    Uninit();
  }

  inline uint64_t&
  RawSetAsUnsignedLongLong()
  {
    if (mType == eUnsignedLongLong) {
      return mValue.mUnsignedLongLong.Value();
    }
    MOZ_ASSERT(mType == eUninitialized);
    mType = eUnsignedLongLong;
    return mValue.mUnsignedLongLong.SetValue();
  }

  inline uint64_t&
  SetAsUnsignedLongLong()
  {
    if (mType == eUnsignedLongLong) {
      return mValue.mUnsignedLongLong.Value();
    }
    Uninit();
    mType = eUnsignedLongLong;
    return mValue.mUnsignedLongLong.SetValue();
  }

  inline bool
  IsUnsignedLongLong() const
  {
    return mType == eUnsignedLongLong;
  }

  inline uint64_t&
  GetAsUnsignedLongLong()
  {
    MOZ_ASSERT(IsUnsignedLongLong(), "Wrong type!");
    return mValue.mUnsignedLongLong.Value();
  }

  inline uint64_t
  GetAsUnsignedLongLong() const
  {
    MOZ_ASSERT(IsUnsignedLongLong(), "Wrong type!");
    return mValue.mUnsignedLongLong.Value();
  }

  inline binding_detail::FakeString&
  RawSetAsString()
  {
    if (mType == eString) {
      return mValue.mString.Value();
    }
    MOZ_ASSERT(mType == eUninitialized);
    mType = eString;
    return mValue.mString.SetValue();
  }

  inline binding_detail::FakeString&
  SetAsString()
  {
    if (mType == eString) {
      return mValue.mString.Value();
    }
    Uninit();
    mType = eString;
    return mValue.mString.SetValue();
  }

  inline bool
  IsString() const
  {
    return mType == eString;
  }

  inline binding_detail::FakeString&
  GetAsString()
  {
    MOZ_ASSERT(IsString(), "Wrong type!");
    return mValue.mString.Value();
  }

  inline const nsAString&
  GetAsString() const
  {
    MOZ_ASSERT(IsString(), "Wrong type!");
    return mValue.mString.Value();
  }

  inline void
  Uninit()
  {
    switch (mType) {
      case eUninitialized: {
        break;
      }
      case eUnsignedLongLong: {
        DestroyUnsignedLongLong();
        break;
      }
      case eString: {
        DestroyString();
        break;
      }
    }
  }

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

private:
  inline void
  DestroyUnsignedLongLong()
  {
    MOZ_ASSERT(IsUnsignedLongLong(), "Wrong type!");
    mValue.mUnsignedLongLong.Destroy();
    mType = eUninitialized;
  }

  inline void
  DestroyString()
  {
    MOZ_ASSERT(IsString(), "Wrong type!");
    mValue.mString.Destroy();
    mType = eUninitialized;
  }
};


class OwningUnsignedLongLongOrString : public AllOwningUnionBase
{
  friend void ImplCycleCollectionUnlink(OwningUnsignedLongLongOrString& aUnion);
  enum Type
  {
    eUninitialized,
    eUnsignedLongLong,
    eString
  };

  union Value
  {
    UnionMember<uint64_t > mUnsignedLongLong;
    UnionMember<nsString > mString;

  };

  Type mType;
  Value mValue;

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

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

  inline ~OwningUnsignedLongLongOrString()
  {
    Uninit();
  }

  uint64_t&
  RawSetAsUnsignedLongLong();

  uint64_t&
  SetAsUnsignedLongLong();

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

  inline bool
  IsUnsignedLongLong() const
  {
    return mType == eUnsignedLongLong;
  }

  inline uint64_t&
  GetAsUnsignedLongLong()
  {
    MOZ_ASSERT(IsUnsignedLongLong(), "Wrong type!");
    return mValue.mUnsignedLongLong.Value();
  }

  inline uint64_t const &
  GetAsUnsignedLongLong() const
  {
    MOZ_ASSERT(IsUnsignedLongLong(), "Wrong type!");
    return mValue.mUnsignedLongLong.Value();
  }

  nsString&
  RawSetAsString();

  nsString&
  SetAsString();

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

  inline void
  SetStringData(const nsString::char_type* aData, nsString::size_type aLength)
  {
    RawSetAsString().Assign(aData, aLength);
  }

  inline bool
  IsString() const
  {
    return mType == eString;
  }

  inline nsString&
  GetAsString()
  {
    MOZ_ASSERT(IsString(), "Wrong type!");
    return mValue.mString.Value();
  }

  inline nsString const &
  GetAsString() const
  {
    MOZ_ASSERT(IsString(), "Wrong type!");
    return mValue.mString.Value();
  }

  void
  Uninit();

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

  void
  TraceUnion(JSTracer* trc);

  void
  operator=(const OwningUnsignedLongLongOrString& aOther);

private:
  void
  DestroyUnsignedLongLong();

  void
  DestroyString();
};


struct ConsoleEvent : public DictionaryBase
{
  MOZ_INIT_OUTSIDE_CTOR Optional<OwningUnsignedLongLongOrString> mID;
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<JS::Value>> mArguments;
  MOZ_INIT_OUTSIDE_CTOR uint32_t mColumnNumber;
  MOZ_INIT_OUTSIDE_CTOR JS::Value mCounter;
  MOZ_INIT_OUTSIDE_CTOR nsString mFilename;
  MOZ_INIT_OUTSIDE_CTOR nsString mFunctionName;
  MOZ_INIT_OUTSIDE_CTOR nsString mGroupName;
  MOZ_INIT_OUTSIDE_CTOR Optional<OwningUnsignedLongLongOrString> mInnerID;
  MOZ_INIT_OUTSIDE_CTOR nsString mLevel;
  MOZ_INIT_OUTSIDE_CTOR uint32_t mLineNumber;
  MOZ_INIT_OUTSIDE_CTOR JS::Value mOriginAttributes;
  MOZ_INIT_OUTSIDE_CTOR bool mPrivate;
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<nsString>> mStyles;
  MOZ_INIT_OUTSIDE_CTOR double mTimeStamp;
  MOZ_INIT_OUTSIDE_CTOR JS::Value mTimer;

  ConsoleEvent();

  explicit inline ConsoleEvent(const FastDictionaryInitializer& )
    : mCounter(JS::UndefinedValue()),
      mOriginAttributes(JS::UndefinedValue()),
      mTimer(JS::UndefinedValue())
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

private:
  ConsoleEvent(const ConsoleEvent&) = delete;
  void operator=(const ConsoleEvent&) = delete;

  static bool
  InitIds(JSContext* cx, ConsoleEventAtoms* atomsCache);

public:
  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  void
  TraceDictionary(JSTracer* trc);
};

namespace binding_detail {
struct FastConsoleEvent : public ConsoleEvent
{
  inline FastConsoleEvent()
    : ConsoleEvent(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


namespace consoleBinding {

  typedef mozilla::dom::Console NativeType;

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

  // 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[];

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

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

  JSObject*
  GetConstructorObject(JSContext* aCx);

} // namespace consoleBinding



} // namespace dom
} // namespace mozilla

#endif // mozilla_dom_ConsoleBinding_h
