Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM NodeFilter.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_NODEFILTERBINDING_H_
#define DOM_NODEFILTERBINDING_H_
#include "js/CallAndConstruct.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/CallbackInterface.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/PrototypeList.h"
#include "mozilla/dom/ToJSValue.h"
class nsINode;
namespace mozilla {
namespace dom {
struct NativePropertyHooks;
class NodeFilter;
struct NodeFilterAtoms;
class ProtoAndIfaceCache;
} // namespace dom
} // namespace mozilla
namespace mozilla::dom {
namespace NodeFilter_Binding {
typedef mozilla::dom::NodeFilter NativeType;
static const uint16_t FILTER_ACCEPT = 1;
static const uint16_t FILTER_REJECT = 2;
static const uint16_t FILTER_SKIP = 3;
static const uint32_t SHOW_ALL = 4294967295;
static const uint32_t SHOW_ELEMENT = 1;
static const uint32_t SHOW_ATTRIBUTE = 2;
static const uint32_t SHOW_TEXT = 4;
static const uint32_t SHOW_CDATA_SECTION = 8;
static const uint32_t SHOW_ENTITY_REFERENCE = 16;
static const uint32_t SHOW_ENTITY = 32;
static const uint32_t SHOW_PROCESSING_INSTRUCTION = 64;
static const uint32_t SHOW_COMMENT = 128;
static const uint32_t SHOW_DOCUMENT = 256;
static const uint32_t SHOW_DOCUMENT_TYPE = 512;
static const uint32_t SHOW_DOCUMENT_FRAGMENT = 1024;
static const uint32_t SHOW_NOTATION = 2048;
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
{
/* Get the interface object for this class. This will create the object as
needed. */
return GetPerInterfaceObjectHandle(aCx, constructors::id::NodeFilter,
&CreateInterfaceObjects,
aDefineOnGlobal);
}
JSObject*
GetConstructorObject(JSContext* aCx);
} // namespace NodeFilter_Binding
class NodeFilter : public CallbackInterface
{
public:
explicit inline NodeFilter(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
: CallbackInterface(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
{
}
explicit inline NodeFilter(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
: CallbackInterface(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
explicit inline NodeFilter(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
: CallbackInterface(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
{
}
template <typename T>
inline uint16_t
AcceptNode(const T& thisVal, nsINode& node, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
{
MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
if (!aExecutionReason) {
aExecutionReason = "NodeFilter.acceptNode";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return uint16_t(0);
}
JS::Rooted<JS::Value> thisValJS(s.GetContext());
if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
aRv.Throw(NS_ERROR_FAILURE);
return uint16_t(0);
}
return AcceptNode(s.GetCallContext(), thisValJS, node, aRv);
}
inline uint16_t
AcceptNode(nsINode& node, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
{
MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
if (!aExecutionReason) {
aExecutionReason = "NodeFilter.acceptNode";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return uint16_t(0);
}
return AcceptNode(s.GetCallContext(), JS::UndefinedHandleValue, node, aRv);
}
template <typename T>
inline uint16_t
AcceptNode(const T& thisVal, nsINode& node, const char* aExecutionReason = nullptr)
{
return AcceptNode(thisVal, node, IgnoreErrors(), aExecutionReason);
}
inline uint16_t
AcceptNode(nsINode& node, const char* aExecutionReason = nullptr)
{
return AcceptNode(node, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
}
inline bool
operator==(const NodeFilter& aOther) const
{
return CallbackInterface::operator==(aOther);
}
private:
uint16_t AcceptNode(BindingCallContext& cx, JS::Handle<JS::Value> aThisVal, nsINode& node, ErrorResult& aRv);
static bool
InitIds(JSContext* cx, NodeFilterAtoms* atomsCache);
};
namespace binding_detail {
class FastNodeFilter : public NodeFilter
{
public:
explicit inline FastNodeFilter(JSObject* aCallback, JSObject* aCallbackGlobal)
: NodeFilter(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
inline void
Trace(JSTracer* aTracer)
{
NodeFilter::Trace(aTracer);
}
inline void
FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
{
NodeFilter::FinishSlowJSInitIfMoreThanOneOwner(aCx);
}
};
} // namespace binding_detail
} // namespace mozilla::dom
#endif // DOM_NODEFILTERBINDING_H_