Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM WebCompat.webidl BY Codegen.py - DO NOT EDIT */
#include <type_traits>
#include "AtomList.h"
#include "MainThreadUtils.h"
#include "WebCompatBinding.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/BindingCallContext.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/NonRefcountedDOMObject.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;
CkEditorVersion::CkEditorVersion()
{
// Safe to pass a null context if we pass a null value
Init(nullptr, JS::NullHandleValue);
}
bool
CkEditorVersion::InitIds(JSContext* cx, CkEditorVersionAtoms* atomsCache)
{
MOZ_ASSERT(reinterpret_cast<jsid*>(atomsCache)->isVoid());
// Initialize these in reverse order so that any failure leaves the first one
// uninitialized.
if (!atomsCache->version_id.init(cx, "version")) {
return false;
}
return true;
}
bool
CkEditorVersion::Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
{
// Passing a null JSContext is OK only if we're initing from null,
// Since in that case we will not have to do any property gets
// Also evaluate isNullOrUndefined in order to avoid false-positive
// checkers by static analysis tools
MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined());
CkEditorVersionAtoms* atomsCache = nullptr;
if (cx) {
atomsCache = GetAtomCache<CkEditorVersionAtoms>(cx);
if (reinterpret_cast<jsid*>(atomsCache)->isVoid() &&
!InitIds(cx, atomsCache)) {
return false;
}
}
if (!IsConvertibleToDictionary(val)) {
return cx.ThrowErrorMessage<MSG_CONVERSION_ERROR>(sourceDescription, "dictionary");
}
bool isNull = val.isNullOrUndefined();
// We only need these if !isNull, in which case we have |cx|.
Maybe<JS::Rooted<JSObject *> > object;
Maybe<JS::Rooted<JS::Value> > temp;
if (!isNull) {
MOZ_ASSERT(cx);
object.emplace(cx, &val.toObject());
temp.emplace(cx);
}
if (!isNull) {
if (!JS_GetPropertyById(cx, *object, atomsCache->version_id, temp.ptr())) {
return false;
}
}
if (!isNull && !temp->isUndefined()) {
if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mVersion)) {
return false;
}
mIsAnyMemberPresent = true;
} else if (cx) {
// Don't error out if we have no cx. In that
// situation the caller is default-constructing us and we'll
// just assume they know what they're doing.
return cx.ThrowErrorMessage<MSG_MISSING_REQUIRED_DICTIONARY_MEMBER>("'version' member of CkEditorVersion");
}
return true;
}
bool
CkEditorVersion::Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
{
// We don't want to use sourceDescription for our context here;
// that's not really what it's formatted for.
BindingCallContext cx(cx_, nullptr);
return Init(cx, val, sourceDescription, passedToJSImpl);
}
void
CkEditorVersion::TraceDictionary(JSTracer* trc)
{
}
CkEditorVersion&
CkEditorVersion::operator=(const CkEditorVersion& aOther)
{
DictionaryBase::operator=(aOther);
mVersion = aOther.mVersion;
return *this;
}
CkEditorProperty::CkEditorProperty()
{
// Safe to pass a null context if we pass a null value
Init(nullptr, JS::NullHandleValue);
}
bool
CkEditorProperty::InitIds(JSContext* cx, CkEditorPropertyAtoms* atomsCache)
{
MOZ_ASSERT(reinterpret_cast<jsid*>(atomsCache)->isVoid());
// Initialize these in reverse order so that any failure leaves the first one
// uninitialized.
if (!atomsCache->JEDITOR_id.init(cx, "JEDITOR") ||
!atomsCache->CKEDITOR_id.init(cx, "CKEDITOR")) {
return false;
}
return true;
}
bool
CkEditorProperty::Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
{
// Passing a null JSContext is OK only if we're initing from null,
// Since in that case we will not have to do any property gets
// Also evaluate isNullOrUndefined in order to avoid false-positive
// checkers by static analysis tools
MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined());
CkEditorPropertyAtoms* atomsCache = nullptr;
if (cx) {
atomsCache = GetAtomCache<CkEditorPropertyAtoms>(cx);
if (reinterpret_cast<jsid*>(atomsCache)->isVoid() &&
!InitIds(cx, atomsCache)) {
return false;
}
}
if (!IsConvertibleToDictionary(val)) {
return cx.ThrowErrorMessage<MSG_CONVERSION_ERROR>(sourceDescription, "dictionary");
}
bool isNull = val.isNullOrUndefined();
// We only need these if !isNull, in which case we have |cx|.
Maybe<JS::Rooted<JSObject *> > object;
Maybe<JS::Rooted<JS::Value> > temp;
if (!isNull) {
MOZ_ASSERT(cx);
object.emplace(cx, &val.toObject());
temp.emplace(cx);
}
if (!isNull) {
if (!JS_GetPropertyById(cx, *object, atomsCache->CKEDITOR_id, temp.ptr())) {
return false;
}
}
if (!isNull && !temp->isUndefined()) {
mCKEDITOR.Construct();
if (!(mCKEDITOR.Value()).Init(cx, temp.ref(), "'CKEDITOR' member of CkEditorProperty", passedToJSImpl)) {
return false;
}
mIsAnyMemberPresent = true;
}
if (!isNull) {
if (!JS_GetPropertyById(cx, *object, atomsCache->JEDITOR_id, temp.ptr())) {
return false;
}
}
if (!isNull && !temp->isUndefined()) {
mJEDITOR.Construct();
if (!(mJEDITOR.Value()).Init(cx, temp.ref(), "'JEDITOR' member of CkEditorProperty", passedToJSImpl)) {
return false;
}
mIsAnyMemberPresent = true;
}
return true;
}
bool
CkEditorProperty::Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
{
// We don't want to use sourceDescription for our context here;
// that's not really what it's formatted for.
BindingCallContext cx(cx_, nullptr);
return Init(cx, val, sourceDescription, passedToJSImpl);
}
void
CkEditorProperty::TraceDictionary(JSTracer* trc)
{
}
CkEditorProperty&
CkEditorProperty::operator=(const CkEditorProperty& aOther)
{
DictionaryBase::operator=(aOther);
mCKEDITOR.Reset();
if (aOther.mCKEDITOR.WasPassed()) {
mCKEDITOR.Construct(aOther.mCKEDITOR.Value());
}
mJEDITOR.Reset();
if (aOther.mJEDITOR.WasPassed()) {
mJEDITOR.Construct(aOther.mJEDITOR.Value());
}
return *this;
}
} // namespace mozilla::dom