Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM TrustedTypes.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_TRUSTEDTYPESBINDING_H_
#define DOM_TRUSTEDTYPESBINDING_H_
#include "js/CallAndConstruct.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/CallbackFunction.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/PrototypeList.h"
#include "mozilla/dom/ToJSValue.h"
namespace mozilla {
namespace dom {
class CreateHTMLCallback;
class CreateScriptCallback;
class CreateScriptURLCallback;
struct NativePropertyHooks;
class ProtoAndIfaceCache;
class TrustedHTML;
class TrustedScript;
class TrustedScriptURL;
class TrustedTypePolicy;
class TrustedTypePolicyFactory;
struct TrustedTypePolicyOptionsAtoms;
} // namespace dom
} // namespace mozilla
namespace mozilla::dom {
class CreateHTMLCallback : public CallbackFunction
{
public:
explicit inline CreateHTMLCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline CreateHTMLCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
: CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline CreateHTMLCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline CreateHTMLCallback(CallbackFunction* aOther)
: CallbackFunction(aOther)
{
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, const nsAString& input, const nsTArray<JS::Value>& arguments, nsString& aRetVal, 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 = "CreateHTMLCallback";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
JS::Rooted<JS::Value> thisValJS(s.GetContext());
if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
return Call(s.GetCallContext(), thisValJS, input, arguments, aRetVal, aRv);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(const nsAString& input, const nsTArray<JS::Value>& arguments, nsString& aRetVal, 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 = "CreateHTMLCallback";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
return Call(s.GetCallContext(), JS::UndefinedHandleValue, input, arguments, aRetVal, aRv);
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, const nsAString& input, const nsTArray<JS::Value>& arguments, nsString& aRetVal, const char* aExecutionReason = nullptr)
{
return Call(thisVal, input, arguments, aRetVal, IgnoreErrors(), aExecutionReason);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(const nsAString& input, const nsTArray<JS::Value>& arguments, nsString& aRetVal, const char* aExecutionReason = nullptr)
{
return Call(input, arguments, aRetVal, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
}
inline bool
operator==(const CreateHTMLCallback& aOther) const
{
return CallbackFunction::operator==(aOther);
}
private:
MOZ_CAN_RUN_SCRIPT void Call(BindingCallContext& cx, JS::Handle<JS::Value> aThisVal, const nsAString& input, const nsTArray<JS::Value>& arguments, nsString& aRetVal, ErrorResult& aRv);
};
namespace binding_detail {
class FastCreateHTMLCallback : public CreateHTMLCallback
{
public:
explicit inline FastCreateHTMLCallback(JSObject* aCallback, JSObject* aCallbackGlobal)
: CreateHTMLCallback(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
inline void
Trace(JSTracer* aTracer)
{
CreateHTMLCallback::Trace(aTracer);
}
inline void
FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
{
CreateHTMLCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
}
};
} // namespace binding_detail
class CreateScriptCallback : public CallbackFunction
{
public:
explicit inline CreateScriptCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline CreateScriptCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
: CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline CreateScriptCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline CreateScriptCallback(CallbackFunction* aOther)
: CallbackFunction(aOther)
{
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, const nsAString& input, const nsTArray<JS::Value>& arguments, nsString& aRetVal, 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 = "CreateScriptCallback";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
JS::Rooted<JS::Value> thisValJS(s.GetContext());
if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
return Call(s.GetCallContext(), thisValJS, input, arguments, aRetVal, aRv);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(const nsAString& input, const nsTArray<JS::Value>& arguments, nsString& aRetVal, 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 = "CreateScriptCallback";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
return Call(s.GetCallContext(), JS::UndefinedHandleValue, input, arguments, aRetVal, aRv);
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, const nsAString& input, const nsTArray<JS::Value>& arguments, nsString& aRetVal, const char* aExecutionReason = nullptr)
{
return Call(thisVal, input, arguments, aRetVal, IgnoreErrors(), aExecutionReason);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(const nsAString& input, const nsTArray<JS::Value>& arguments, nsString& aRetVal, const char* aExecutionReason = nullptr)
{
return Call(input, arguments, aRetVal, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
}
inline bool
operator==(const CreateScriptCallback& aOther) const
{
return CallbackFunction::operator==(aOther);
}
private:
MOZ_CAN_RUN_SCRIPT void Call(BindingCallContext& cx, JS::Handle<JS::Value> aThisVal, const nsAString& input, const nsTArray<JS::Value>& arguments, nsString& aRetVal, ErrorResult& aRv);
};
namespace binding_detail {
class FastCreateScriptCallback : public CreateScriptCallback
{
public:
explicit inline FastCreateScriptCallback(JSObject* aCallback, JSObject* aCallbackGlobal)
: CreateScriptCallback(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
inline void
Trace(JSTracer* aTracer)
{
CreateScriptCallback::Trace(aTracer);
}
inline void
FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
{
CreateScriptCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
}
};
} // namespace binding_detail
class CreateScriptURLCallback : public CallbackFunction
{
public:
explicit inline CreateScriptURLCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline CreateScriptURLCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
: CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline CreateScriptURLCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline CreateScriptURLCallback(CallbackFunction* aOther)
: CallbackFunction(aOther)
{
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, const nsAString& input, const nsTArray<JS::Value>& arguments, nsString& aRetVal, 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 = "CreateScriptURLCallback";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
JS::Rooted<JS::Value> thisValJS(s.GetContext());
if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
return Call(s.GetCallContext(), thisValJS, input, arguments, aRetVal, aRv);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(const nsAString& input, const nsTArray<JS::Value>& arguments, nsString& aRetVal, 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 = "CreateScriptURLCallback";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
return Call(s.GetCallContext(), JS::UndefinedHandleValue, input, arguments, aRetVal, aRv);
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, const nsAString& input, const nsTArray<JS::Value>& arguments, nsString& aRetVal, const char* aExecutionReason = nullptr)
{
return Call(thisVal, input, arguments, aRetVal, IgnoreErrors(), aExecutionReason);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(const nsAString& input, const nsTArray<JS::Value>& arguments, nsString& aRetVal, const char* aExecutionReason = nullptr)
{
return Call(input, arguments, aRetVal, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
}
inline bool
operator==(const CreateScriptURLCallback& aOther) const
{
return CallbackFunction::operator==(aOther);
}
private:
MOZ_CAN_RUN_SCRIPT void Call(BindingCallContext& cx, JS::Handle<JS::Value> aThisVal, const nsAString& input, const nsTArray<JS::Value>& arguments, nsString& aRetVal, ErrorResult& aRv);
};
namespace binding_detail {
class FastCreateScriptURLCallback : public CreateScriptURLCallback
{
public:
explicit inline FastCreateScriptURLCallback(JSObject* aCallback, JSObject* aCallbackGlobal)
: CreateScriptURLCallback(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
inline void
Trace(JSTracer* aTracer)
{
CreateScriptURLCallback::Trace(aTracer);
}
inline void
FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
{
CreateScriptURLCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
}
};
} // namespace binding_detail
struct TrustedTypePolicyOptions : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<CreateHTMLCallback>> mCreateHTML;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<CreateScriptCallback>> mCreateScript;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<CreateScriptURLCallback>> mCreateScriptURL;
TrustedTypePolicyOptions();
explicit inline TrustedTypePolicyOptions(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
TrustedTypePolicyOptions(TrustedTypePolicyOptions&& aOther) = default;
private:
TrustedTypePolicyOptions(const TrustedTypePolicyOptions&) = delete;
TrustedTypePolicyOptions& operator=(const TrustedTypePolicyOptions&) = delete;
static bool
InitIds(JSContext* cx, TrustedTypePolicyOptionsAtoms* atomsCache);
public:
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, mCreateHTML, "mCreateHTML", aFlags);
ImplCycleCollectionTraverse(aCallback, mCreateScript, "mCreateScript", aFlags);
ImplCycleCollectionTraverse(aCallback, mCreateScriptURL, "mCreateScriptURL", aFlags);
}
inline void
UnlinkForCC()
{
ImplCycleCollectionUnlink(mCreateHTML);
ImplCycleCollectionUnlink(mCreateScript);
ImplCycleCollectionUnlink(mCreateScriptURL);
}
};
namespace binding_detail {
struct FastTrustedTypePolicyOptions : public TrustedTypePolicyOptions
{
inline FastTrustedTypePolicyOptions()
: TrustedTypePolicyOptions(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
namespace TrustedHTML_Binding {
typedef mozilla::dom::TrustedHTML NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TrustedHTML* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
{
/* Get the interface prototype object for this class. This will create the
object as needed. */
return GetPerInterfaceObjectHandle(aCx, prototypes::id::TrustedHTML,
&CreateInterfaceObjects,
/* aDefineOnGlobal = */ true);
}
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::TrustedHTML,
&CreateInterfaceObjects,
aDefineOnGlobal);
}
JSObject*
GetConstructorObject(JSContext* aCx);
} // namespace TrustedHTML_Binding
namespace TrustedScript_Binding {
typedef mozilla::dom::TrustedScript NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TrustedScript* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
{
/* Get the interface prototype object for this class. This will create the
object as needed. */
return GetPerInterfaceObjectHandle(aCx, prototypes::id::TrustedScript,
&CreateInterfaceObjects,
/* aDefineOnGlobal = */ true);
}
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::TrustedScript,
&CreateInterfaceObjects,
aDefineOnGlobal);
}
JSObject*
GetConstructorObject(JSContext* aCx);
} // namespace TrustedScript_Binding
namespace TrustedScriptURL_Binding {
typedef mozilla::dom::TrustedScriptURL NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TrustedScriptURL* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
{
/* Get the interface prototype object for this class. This will create the
object as needed. */
return GetPerInterfaceObjectHandle(aCx, prototypes::id::TrustedScriptURL,
&CreateInterfaceObjects,
/* aDefineOnGlobal = */ true);
}
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::TrustedScriptURL,
&CreateInterfaceObjects,
aDefineOnGlobal);
}
JSObject*
GetConstructorObject(JSContext* aCx);
} // namespace TrustedScriptURL_Binding
namespace TrustedTypePolicy_Binding {
typedef mozilla::dom::TrustedTypePolicy NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TrustedTypePolicy* 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);
inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
{
/* Get the interface prototype object for this class. This will create the
object as needed. */
return GetPerInterfaceObjectHandle(aCx, prototypes::id::TrustedTypePolicy,
&CreateInterfaceObjects,
/* aDefineOnGlobal = */ true);
}
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::TrustedTypePolicy,
&CreateInterfaceObjects,
aDefineOnGlobal);
}
JSObject*
GetConstructorObject(JSContext* aCx);
} // namespace TrustedTypePolicy_Binding
namespace TrustedTypePolicyFactory_Binding {
typedef mozilla::dom::TrustedTypePolicyFactory NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TrustedTypePolicyFactory* 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;
}
bool
ClearCachedEmptyHTMLValue(JSContext* aCx, mozilla::dom::TrustedTypePolicyFactory* aObject);
bool
ClearCachedEmptyScriptValue(JSContext* aCx, mozilla::dom::TrustedTypePolicyFactory* aObject);
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
{
/* Get the interface prototype object for this class. This will create the
object as needed. */
return GetPerInterfaceObjectHandle(aCx, prototypes::id::TrustedTypePolicyFactory,
&CreateInterfaceObjects,
/* aDefineOnGlobal = */ true);
}
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::TrustedTypePolicyFactory,
&CreateInterfaceObjects,
aDefineOnGlobal);
}
JSObject*
GetConstructorObject(JSContext* aCx);
} // namespace TrustedTypePolicyFactory_Binding
} // namespace mozilla::dom
#endif // DOM_TRUSTEDTYPESBINDING_H_