Copy as Markdown
Other Tools
/* THIS FILE IS AUTOGENERATED FROM ChannelWrapper.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_CHANNELWRAPPERBINDING_H_
#define DOM_CHANNELWRAPPERBINDING_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"
#include "mozilla/extensions/MatchPattern.h"
namespace mozilla {
namespace dom {
struct MozFrameAncestorInfoAtoms;
struct MozHTTPHeaderAtoms;
struct MozProxyInfoAtoms;
struct MozRequestFilterAtoms;
struct MozRequestMatchOptionsAtoms;
struct MozUrlClassificationAtoms;
struct NativePropertyHooks;
class ProtoAndIfaceCache;
} // namespace dom
namespace extensions {
class ChannelWrapper;
class MatchPatternSet;
} // namespace extensions
} // namespace mozilla
namespace mozilla {
namespace dom {
enum class MozContentPolicyType : uint8_t {
Main_frame,
Sub_frame,
Stylesheet,
Script,
Image,
Object,
Object_subrequest,
Xmlhttprequest,
Xslt,
Ping,
Beacon,
Xml_dtd,
Font,
Media,
Websocket,
Csp_report,
Imageset,
Web_manifest,
Speculative,
Other,
};
namespace binding_detail {
template <> struct EnumStrings<MozContentPolicyType> {
static constexpr nsLiteralCString Values[20] {
"main_frame"_ns,
"sub_frame"_ns,
"stylesheet"_ns,
"script"_ns,
"image"_ns,
"object"_ns,
"object_subrequest"_ns,
"xmlhttprequest"_ns,
"xslt"_ns,
"ping"_ns,
"beacon"_ns,
"xml_dtd"_ns,
"font"_ns,
"media"_ns,
"websocket"_ns,
"csp_report"_ns,
"imageset"_ns,
"web_manifest"_ns,
"speculative"_ns,
"other"_ns,
};
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, MozContentPolicyType aArgument, JS::MutableHandle<JS::Value> aValue);
enum class MozUrlClassificationFlags : uint8_t {
Fingerprinting,
Fingerprinting_content,
Cryptomining,
Cryptomining_content,
Emailtracking,
Emailtracking_content,
Tracking,
Tracking_ad,
Tracking_analytics,
Tracking_social,
Tracking_content,
Socialtracking,
Socialtracking_facebook,
Socialtracking_linkedin,
Socialtracking_twitter,
Any_basic_tracking,
Any_strict_tracking,
Any_social_tracking,
};
namespace binding_detail {
template <> struct EnumStrings<MozUrlClassificationFlags> {
static constexpr nsLiteralCString Values[18] {
"fingerprinting"_ns,
"fingerprinting_content"_ns,
"cryptomining"_ns,
"cryptomining_content"_ns,
"emailtracking"_ns,
"emailtracking_content"_ns,
"tracking"_ns,
"tracking_ad"_ns,
"tracking_analytics"_ns,
"tracking_social"_ns,
"tracking_content"_ns,
"socialtracking"_ns,
"socialtracking_facebook"_ns,
"socialtracking_linkedin"_ns,
"socialtracking_twitter"_ns,
"any_basic_tracking"_ns,
"any_strict_tracking"_ns,
"any_social_tracking"_ns,
};
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, MozUrlClassificationFlags aArgument, JS::MutableHandle<JS::Value> aValue);
struct MozFrameAncestorInfo : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR uint64_t mFrameId;
MOZ_INIT_OUTSIDE_CTOR nsCString mUrl;
MozFrameAncestorInfo();
explicit inline MozFrameAncestorInfo(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
MozFrameAncestorInfo(MozFrameAncestorInfo&& aOther) = default;
explicit inline MozFrameAncestorInfo(const MozFrameAncestorInfo& aOther)
{
*this = aOther;
}
bool
Init(const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
MozFrameAncestorInfo&
operator=(const MozFrameAncestorInfo& aOther);
private:
static bool
InitIds(JSContext* cx, MozFrameAncestorInfoAtoms* atomsCache);
};
namespace binding_detail {
struct FastMozFrameAncestorInfo : public MozFrameAncestorInfo
{
inline FastMozFrameAncestorInfo()
: MozFrameAncestorInfo(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct MozHTTPHeader : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR nsCString mName;
MOZ_INIT_OUTSIDE_CTOR nsCString mValue;
MozHTTPHeader();
explicit inline MozHTTPHeader(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
MozHTTPHeader(MozHTTPHeader&& aOther) = default;
explicit inline MozHTTPHeader(const MozHTTPHeader& aOther)
{
*this = aOther;
}
bool
Init(const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
MozHTTPHeader&
operator=(const MozHTTPHeader& aOther);
private:
static bool
InitIds(JSContext* cx, MozHTTPHeaderAtoms* atomsCache);
};
namespace binding_detail {
struct FastMozHTTPHeader : public MozHTTPHeader
{
inline FastMozHTTPHeader()
: MozHTTPHeader(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct MozProxyInfo : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR nsCString mConnectionIsolationKey;
MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFailoverTimeout;
MOZ_INIT_OUTSIDE_CTOR nsCString mHost;
MOZ_INIT_OUTSIDE_CTOR int32_t mPort;
MOZ_INIT_OUTSIDE_CTOR nsCString mProxyAuthorizationHeader;
MOZ_INIT_OUTSIDE_CTOR bool mProxyDNS;
MOZ_INIT_OUTSIDE_CTOR nsCString mType;
MOZ_INIT_OUTSIDE_CTOR nsCString mUsername;
MozProxyInfo();
explicit inline MozProxyInfo(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
MozProxyInfo(MozProxyInfo&& aOther) = default;
explicit inline MozProxyInfo(const MozProxyInfo& aOther)
{
*this = aOther;
}
bool
Init(const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
MozProxyInfo&
operator=(const MozProxyInfo& aOther);
private:
static bool
InitIds(JSContext* cx, MozProxyInfoAtoms* atomsCache);
};
namespace binding_detail {
struct FastMozProxyInfo : public MozProxyInfo
{
inline FastMozProxyInfo()
: MozProxyInfo(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct MozRequestFilter : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Nullable<bool> mIncognito;
MOZ_INIT_OUTSIDE_CTOR Nullable<Sequence<MozContentPolicyType>> mTypes;
MOZ_INIT_OUTSIDE_CTOR RefPtr<mozilla::extensions::MatchPatternSet> mUrls;
MozRequestFilter();
explicit inline MozRequestFilter(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
MozRequestFilter(MozRequestFilter&& aOther) = default;
explicit inline MozRequestFilter(const MozRequestFilter& 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);
inline void
TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
{
ImplCycleCollectionTraverse(aCallback, mUrls, "mUrls", aFlags);
}
inline void
UnlinkForCC()
{
ImplCycleCollectionUnlink(mUrls);
}
MozRequestFilter&
operator=(const MozRequestFilter& aOther);
private:
static bool
InitIds(JSContext* cx, MozRequestFilterAtoms* atomsCache);
};
namespace binding_detail {
struct FastMozRequestFilter : public MozRequestFilter
{
inline FastMozRequestFilter()
: MozRequestFilter(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct MozRequestMatchOptions : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR bool mIsProxy;
MozRequestMatchOptions();
explicit inline MozRequestMatchOptions(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
MozRequestMatchOptions(MozRequestMatchOptions&& aOther) = default;
explicit inline MozRequestMatchOptions(const MozRequestMatchOptions& 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);
MozRequestMatchOptions&
operator=(const MozRequestMatchOptions& aOther);
private:
static bool
InitIds(JSContext* cx, MozRequestMatchOptionsAtoms* atomsCache);
};
namespace binding_detail {
struct FastMozRequestMatchOptions : public MozRequestMatchOptions
{
inline FastMozRequestMatchOptions()
: MozRequestMatchOptions(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct MozUrlClassification : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Sequence<MozUrlClassificationFlags> mFirstParty;
MOZ_INIT_OUTSIDE_CTOR Sequence<MozUrlClassificationFlags> mThirdParty;
MozUrlClassification();
explicit inline MozUrlClassification(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
MozUrlClassification(MozUrlClassification&& aOther) = default;
explicit inline MozUrlClassification(const MozUrlClassification& aOther)
{
*this = aOther;
}
bool
Init(const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
MozUrlClassification&
operator=(const MozUrlClassification& aOther);
private:
static bool
InitIds(JSContext* cx, MozUrlClassificationAtoms* atomsCache);
};
namespace binding_detail {
struct FastMozUrlClassification : public MozUrlClassification
{
inline FastMozUrlClassification()
: MozUrlClassification(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
namespace ChannelWrapper_Binding {
typedef mozilla::extensions::ChannelWrapper NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::extensions::ChannelWrapper* 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
ClearCachedMethodValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedTypeValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedFinalURIValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedFinalURLValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedStatusCodeValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedStatusLineValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedErrorStringValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedProxyInfoValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedRemoteAddressValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedLoadInfoValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedIsServiceWorkerScriptValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedOriginURLValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedDocumentURLValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedCanModifyValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedBrowserElementValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedFrameAncestorsValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedUrlClassificationValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedThirdPartyValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedRequestSizeValue(mozilla::extensions::ChannelWrapper* aObject);
void
ClearCachedResponseSizeValue(mozilla::extensions::ChannelWrapper* aObject);
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::ChannelWrapper,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace ChannelWrapper_Binding
} // namespace dom
template <>
struct MaxContiguousEnumValue<dom::MozContentPolicyType>
{
static constexpr dom::MozContentPolicyType value = dom::MozContentPolicyType::Other;
static_assert(static_cast<uint8_t>(dom::MozContentPolicyType::Main_frame) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(std::size(dom::binding_detail::EnumStrings<dom::MozContentPolicyType>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
template <>
struct MaxContiguousEnumValue<dom::MozUrlClassificationFlags>
{
static constexpr dom::MozUrlClassificationFlags value = dom::MozUrlClassificationFlags::Any_social_tracking;
static_assert(static_cast<uint8_t>(dom::MozUrlClassificationFlags::Fingerprinting) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(std::size(dom::binding_detail::EnumStrings<dom::MozUrlClassificationFlags>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
} // namespace mozilla
#endif // DOM_CHANNELWRAPPERBINDING_H_