Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM AutocompleteInfo.webidl BY Codegen.py - DO NOT EDIT */
#include <type_traits>
#include "AtomList.h"
#include "AutocompleteInfoBinding.h"
#include "MainThreadUtils.h"
#include "js/CallAndConstruct.h"
#include "js/Exception.h"
#include "js/MapAndSet.h"
#include "js/Object.h"
#include "js/PropertyAndElement.h"
#include "js/PropertyDescriptor.h"
#include "js/experimental/JitInfo.h"
#include "mozilla/OwningNonNull.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/NonRefcountedDOMObject.h"
#include "mozilla/dom/PrimitiveConversions.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/SimpleGlobalObject.h"
namespace mozilla::dom {
namespace binding_detail {}; // Just to make sure it's known as a namespace
using namespace mozilla::dom::binding_detail;
AutocompleteInfo::AutocompleteInfo()
{
// Safe to pass a null context if we pass a null value
Init();
}
bool
AutocompleteInfo::InitIds(JSContext* cx, AutocompleteInfoAtoms* atomsCache)
{
MOZ_ASSERT(reinterpret_cast<jsid*>(atomsCache)->isVoid());
// Initialize these in reverse order so that any failure leaves the first one
// uninitialized.
if (!atomsCache->section_id.init(cx, "section") ||
!atomsCache->fieldName_id.init(cx, "fieldName") ||
!atomsCache->credentialType_id.init(cx, "credentialType") ||
!atomsCache->contactType_id.init(cx, "contactType") ||
!atomsCache->canAutomaticallyPersist_id.init(cx, "canAutomaticallyPersist") ||
!atomsCache->addressType_id.init(cx, "addressType")) {
return false;
}
return true;
}
bool
AutocompleteInfo::Init(const char* sourceDescription, bool passedToJSImpl)
{
{
// scope for any temporaries our default value setting needs.
mAddressType.AssignLiteral(u"");
}
mIsAnyMemberPresent = true;
{
// scope for any temporaries our default value setting needs.
mCanAutomaticallyPersist = true;
}
mIsAnyMemberPresent = true;
{
// scope for any temporaries our default value setting needs.
mContactType.AssignLiteral(u"");
}
mIsAnyMemberPresent = true;
{
// scope for any temporaries our default value setting needs.
mCredentialType.AssignLiteral(u"");
}
mIsAnyMemberPresent = true;
{
// scope for any temporaries our default value setting needs.
mFieldName.AssignLiteral(u"");
}
mIsAnyMemberPresent = true;
{
// scope for any temporaries our default value setting needs.
mSection.AssignLiteral(u"");
}
mIsAnyMemberPresent = true;
return true;
}
bool
AutocompleteInfo::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
{
AutocompleteInfoAtoms* atomsCache = GetAtomCache<AutocompleteInfoAtoms>(cx);
if (reinterpret_cast<jsid*>(atomsCache)->isVoid() &&
!InitIds(cx, atomsCache)) {
return false;
}
JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
if (!obj) {
return false;
}
rval.set(JS::ObjectValue(*obj));
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
nsString const & currentValue = mAddressType;
if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
return false;
}
if (!JS_DefinePropertyById(cx, obj, atomsCache->addressType_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
bool const & currentValue = mCanAutomaticallyPersist;
temp.setBoolean(currentValue);
if (!JS_DefinePropertyById(cx, obj, atomsCache->canAutomaticallyPersist_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
nsString const & currentValue = mContactType;
if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
return false;
}
if (!JS_DefinePropertyById(cx, obj, atomsCache->contactType_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
nsString const & currentValue = mCredentialType;
if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
return false;
}
if (!JS_DefinePropertyById(cx, obj, atomsCache->credentialType_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
nsString const & currentValue = mFieldName;
if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
return false;
}
if (!JS_DefinePropertyById(cx, obj, atomsCache->fieldName_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
nsString const & currentValue = mSection;
if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
return false;
}
if (!JS_DefinePropertyById(cx, obj, atomsCache->section_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
return true;
}
void
AutocompleteInfo::TraceDictionary(JSTracer* trc)
{
}
AutocompleteInfo&
AutocompleteInfo::operator=(const AutocompleteInfo& aOther)
{
DictionaryBase::operator=(aOther);
mAddressType = aOther.mAddressType;
mCanAutomaticallyPersist = aOther.mCanAutomaticallyPersist;
mContactType = aOther.mContactType;
mCredentialType = aOther.mCredentialType;
mFieldName = aOther.mFieldName;
mSection = aOther.mSection;
return *this;
}
bool
AutocompleteInfo::operator==(const AutocompleteInfo& aOther) const
{
if (mAddressType != aOther.mAddressType) {
return false;
}
if (mCanAutomaticallyPersist != aOther.mCanAutomaticallyPersist) {
return false;
}
if (mContactType != aOther.mContactType) {
return false;
}
if (mCredentialType != aOther.mCredentialType) {
return false;
}
if (mFieldName != aOther.mFieldName) {
return false;
}
if (mSection != aOther.mSection) {
return false;
}
return true;
}
} // namespace mozilla::dom