Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM CookieStore.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_COOKIESTOREBINDING_H_
#define DOM_COOKIESTOREBINDING_H_
#include "js/CallAndConstruct.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/EnumTypeTraits.h"
#include "mozilla/Span.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/PrototypeList.h"
namespace mozilla {
namespace dom {
struct CookieInitAtoms;
struct CookieListItemAtoms;
class CookieStore;
struct CookieStoreDeleteOptionsAtoms;
struct CookieStoreGetOptionsAtoms;
struct NativePropertyHooks;
class ProtoAndIfaceCache;
} // namespace dom
} // namespace mozilla
namespace mozilla {
namespace dom {
enum class CookieSameSite : uint8_t {
Strict,
Lax,
None,
};
namespace binding_detail {
template <> struct EnumStrings<CookieSameSite> {
static constexpr nsLiteralCString Values[3] {
"strict"_ns,
"lax"_ns,
"none"_ns,
};
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, CookieSameSite aArgument, JS::MutableHandle<JS::Value> aValue);
struct CookieInit : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR nsString mDomain;
MOZ_INIT_OUTSIDE_CTOR Nullable<double> mExpires;
MOZ_INIT_OUTSIDE_CTOR nsString mName;
MOZ_INIT_OUTSIDE_CTOR bool mPartitioned;
MOZ_INIT_OUTSIDE_CTOR nsString mPath;
MOZ_INIT_OUTSIDE_CTOR CookieSameSite mSameSite;
MOZ_INIT_OUTSIDE_CTOR nsString mValue;
CookieInit();
explicit inline CookieInit(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
CookieInit(CookieInit&& aOther) = default;
explicit inline CookieInit(const CookieInit& aOther)
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
TraceDictionary(JSTracer* trc);
CookieInit&
operator=(const CookieInit& aOther);
private:
static bool
InitIds(JSContext* cx, CookieInitAtoms* atomsCache);
};
namespace binding_detail {
struct FastCookieInit : public CookieInit
{
inline FastCookieInit()
: CookieInit(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct CookieListItem : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mName;
MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mValue;
CookieListItem();
explicit inline CookieListItem(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
CookieListItem(CookieListItem&& aOther) = default;
explicit inline CookieListItem(const CookieListItem& aOther)
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
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);
CookieListItem&
operator=(const CookieListItem& aOther);
private:
static bool
InitIds(JSContext* cx, CookieListItemAtoms* atomsCache);
};
namespace binding_detail {
struct FastCookieListItem : public CookieListItem
{
inline FastCookieListItem()
: CookieListItem(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct CookieStoreDeleteOptions : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR nsString mDomain;
MOZ_INIT_OUTSIDE_CTOR nsString mName;
MOZ_INIT_OUTSIDE_CTOR bool mPartitioned;
MOZ_INIT_OUTSIDE_CTOR nsString mPath;
CookieStoreDeleteOptions();
explicit inline CookieStoreDeleteOptions(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
CookieStoreDeleteOptions(CookieStoreDeleteOptions&& aOther) = default;
explicit inline CookieStoreDeleteOptions(const CookieStoreDeleteOptions& aOther)
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
TraceDictionary(JSTracer* trc);
CookieStoreDeleteOptions&
operator=(const CookieStoreDeleteOptions& aOther);
private:
static bool
InitIds(JSContext* cx, CookieStoreDeleteOptionsAtoms* atomsCache);
};
namespace binding_detail {
struct FastCookieStoreDeleteOptions : public CookieStoreDeleteOptions
{
inline FastCookieStoreDeleteOptions()
: CookieStoreDeleteOptions(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct CookieStoreGetOptions : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mName;
MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mUrl;
CookieStoreGetOptions();
explicit inline CookieStoreGetOptions(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
CookieStoreGetOptions(CookieStoreGetOptions&& aOther) = default;
explicit inline CookieStoreGetOptions(const CookieStoreGetOptions& aOther)
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
TraceDictionary(JSTracer* trc);
CookieStoreGetOptions&
operator=(const CookieStoreGetOptions& aOther);
private:
static bool
InitIds(JSContext* cx, CookieStoreGetOptionsAtoms* atomsCache);
};
namespace binding_detail {
struct FastCookieStoreGetOptions : public CookieStoreGetOptions
{
inline FastCookieStoreGetOptions()
: CookieStoreGetOptions(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
namespace CookieStore_Binding {
typedef mozilla::dom::CookieStore NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::CookieStore* 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, DefineInterfaceProperty aDefineOnGlobal);
JS::Handle<JSObject*>
GetConstructorObjectHandle(JSContext* aCx);
inline bool CreateAndDefineOnGlobal(JSContext* aCx)
{
// Get the interface or namespace object for this class. This will
// create the object as needed and always define the properties for
// it on the global. The caller should make sure the interface or
// namespace is exposed on the global before calling this.
return GetPerInterfaceObjectHandle(aCx, constructors::id::CookieStore,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace CookieStore_Binding
} // namespace dom
template <>
struct MaxContiguousEnumValue<dom::CookieSameSite>
{
static constexpr dom::CookieSameSite value = dom::CookieSameSite::None;
static_assert(static_cast<uint8_t>(dom::CookieSameSite::Strict) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(std::size(dom::binding_detail::EnumStrings<dom::CookieSameSite>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
} // namespace mozilla
#endif // DOM_COOKIESTOREBINDING_H_