Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (206765 => 206766)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-10-04 03:33:57 UTC (rev 206765)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-10-04 06:28:55 UTC (rev 206766)
@@ -520,76 +520,224 @@
{
VM& vm = state.vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
- if (value.isUndefinedOrNull())
- return TestObj::Dictionary { { }, TestObj::EnumType::EnumValue1, TestObj::EnumType::EmptyString, "defaultString", { }, false, { }, { }, { }, { }, 0, 0, { }, { }, 0, 0, { }, { }, { }, 0, { }, 0, { }, 0, { }, 0, { }, 0, nullptr, jsUndefined(), jsUndefined(), { } };
- auto* object = value.getObject();
- if (UNLIKELY(!object || object->type() == RegExpObjectType)) {
+ bool isNullOrUndefined = value.isUndefinedOrNull();
+ auto* object = isNullOrUndefined ? nullptr : value.getObject();
+ if (UNLIKELY(!isNullOrUndefined && !object)) {
throwTypeError(&state, throwScope);
return Nullopt;
}
- auto enumerationValueWithoutDefault = convertOptional<TestObj::EnumType>(state, object->get(&state, Identifier::fromString(&state, "enumerationValueWithoutDefault")));
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto enumerationValueWithDefault = convertOptional<TestObj::EnumType>(state, object->get(&state, Identifier::fromString(&state, "enumerationValueWithDefault")), TestObj::EnumType::EnumValue1);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto enumerationValueWithEmptyStringDefault = convertOptional<TestObj::EnumType>(state, object->get(&state, Identifier::fromString(&state, "enumerationValueWithEmptyStringDefault")), TestObj::EnumType::EmptyString);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto stringWithDefault = convertOptional<String>(state, object->get(&state, Identifier::fromString(&state, "stringWithDefault")), "defaultString");
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto stringWithoutDefault = convertOptional<String>(state, object->get(&state, Identifier::fromString(&state, "stringWithoutDefault")));
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto booleanWithDefault = convertOptional<bool>(state, object->get(&state, Identifier::fromString(&state, "booleanWithDefault")), false);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto booleanWithoutDefault = convertOptional<bool>(state, object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault")));
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto sequenceOfStrings = convertOptional<Vector<String>>(state, object->get(&state, Identifier::fromString(&state, "sequenceOfStrings")));
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto restrictedDouble = convertOptional<double>(state, object->get(&state, Identifier::fromString(&state, "restrictedDouble")), ShouldAllowNonFinite::No);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto unrestrictedDouble = convertOptional<double>(state, object->get(&state, Identifier::fromString(&state, "unrestrictedDouble")), ShouldAllowNonFinite::Yes);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto restrictedDoubleWithDefault = convertOptional<double>(state, object->get(&state, Identifier::fromString(&state, "restrictedDoubleWithDefault")), ShouldAllowNonFinite::No, 0);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto unrestrictedDoubleWithDefault = convertOptional<double>(state, object->get(&state, Identifier::fromString(&state, "unrestrictedDoubleWithDefault")), ShouldAllowNonFinite::Yes, 0);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto restrictedFloat = convertOptional<float>(state, object->get(&state, Identifier::fromString(&state, "restrictedFloat")), ShouldAllowNonFinite::No);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto unrestrictedFloat = convertOptional<float>(state, object->get(&state, Identifier::fromString(&state, "unrestrictedFloat")), ShouldAllowNonFinite::Yes);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto restrictedFloatWithDefault = convertOptional<float>(state, object->get(&state, Identifier::fromString(&state, "restrictedFloatWithDefault")), ShouldAllowNonFinite::No, 0);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto unrestrictedFloatWithDefault = convertOptional<float>(state, object->get(&state, Identifier::fromString(&state, "unrestrictedFloatWithDefault")), ShouldAllowNonFinite::Yes, 0);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto smallIntegerClamped = convertOptional<int8_t>(state, object->get(&state, Identifier::fromString(&state, "smallIntegerClamped")), Clamp);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto smallIntegerWithDefault = convertOptional<int8_t>(state, object->get(&state, Identifier::fromString(&state, "smallIntegerWithDefault")), NormalConversion);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto smallUnsignedIntegerEnforcedRange = convertOptional<uint8_t>(state, object->get(&state, Identifier::fromString(&state, "smallUnsignedIntegerEnforcedRange")), EnforceRange);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto smallUnsignedIntegerWithDefault = convertOptional<uint8_t>(state, object->get(&state, Identifier::fromString(&state, "smallUnsignedIntegerWithDefault")), NormalConversion, 0);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto integer = convertOptional<int32_t>(state, object->get(&state, Identifier::fromString(&state, "integer")), NormalConversion);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto integerWithDefault = convertOptional<int32_t>(state, object->get(&state, Identifier::fromString(&state, "integerWithDefault")), NormalConversion, 0);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto unsignedInteger = convertOptional<uint32_t>(state, object->get(&state, Identifier::fromString(&state, "unsignedInteger")), NormalConversion);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto unsignedIntegerWithDefault = convertOptional<uint32_t>(state, object->get(&state, Identifier::fromString(&state, "unsignedIntegerWithDefault")), NormalConversion, 0);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto largeInteger = convertOptional<int64_t>(state, object->get(&state, Identifier::fromString(&state, "largeInteger")), NormalConversion);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto largeIntegerWithDefault = convertOptional<int64_t>(state, object->get(&state, Identifier::fromString(&state, "largeIntegerWithDefault")), NormalConversion, 0);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto unsignedLargeInteger = convertOptional<uint64_t>(state, object->get(&state, Identifier::fromString(&state, "unsignedLargeInteger")), NormalConversion);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto unsignedLargeIntegerWithDefault = convertOptional<uint64_t>(state, object->get(&state, Identifier::fromString(&state, "unsignedLargeIntegerWithDefault")), NormalConversion, 0);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto* nullableNode = convertWrapperType<Node, JSNode>(state, object->get(&state, Identifier::fromString(&state, "nullableNode")), IsNullable::Yes);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto anyValue = convertOptional<JSC::JSValue>(state, object->get(&state, Identifier::fromString(&state, "anyValue")), jsUndefined());
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto anyTypedefValue = convertOptional<JSC::JSValue>(state, object->get(&state, Identifier::fromString(&state, "anyTypedefValue")), jsUndefined());
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto dictionaryMember = convertDictionary<TestObj::DictionaryThatShouldTolerateNull>(state, object->get(&state, Identifier::fromString(&state, "dictionaryMember")));
+ if (UNLIKELY(object && object->type() == RegExpObjectType)) {
+ throwTypeError(&state, throwScope);
+ return Nullopt;
+ }
+ JSValue enumerationValueWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "enumerationValueWithoutDefault"));
+ Converter<TestObj::EnumType>::OptionalValue enumerationValueWithoutDefault;
+ if (!enumerationValueWithoutDefaultValue.isUndefined()) {
+ enumerationValueWithoutDefault = convert<TestObj::EnumType>(state, enumerationValueWithoutDefaultValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue enumerationValueWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "enumerationValueWithDefault"));
+ TestObj::EnumType enumerationValueWithDefault;
+ if (!enumerationValueWithDefaultValue.isUndefined()) {
+ enumerationValueWithDefault = convert<TestObj::EnumType>(state, enumerationValueWithDefaultValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ enumerationValueWithDefault = TestObj::EnumType::EnumValue1;
+ JSValue enumerationValueWithEmptyStringDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "enumerationValueWithEmptyStringDefault"));
+ TestObj::EnumType enumerationValueWithEmptyStringDefault;
+ if (!enumerationValueWithEmptyStringDefaultValue.isUndefined()) {
+ enumerationValueWithEmptyStringDefault = convert<TestObj::EnumType>(state, enumerationValueWithEmptyStringDefaultValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ enumerationValueWithEmptyStringDefault = TestObj::EnumType::EmptyString;
+ JSValue stringWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "stringWithDefault"));
+ String stringWithDefault;
+ if (!stringWithDefaultValue.isUndefined()) {
+ stringWithDefault = convert<String>(state, stringWithDefaultValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ stringWithDefault = "defaultString";
+ JSValue stringWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "stringWithoutDefault"));
+ Converter<String>::OptionalValue stringWithoutDefault;
+ if (!stringWithoutDefaultValue.isUndefined()) {
+ stringWithoutDefault = convert<String>(state, stringWithoutDefaultValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue booleanWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithDefault"));
+ bool booleanWithDefault;
+ if (!booleanWithDefaultValue.isUndefined()) {
+ booleanWithDefault = convert<bool>(state, booleanWithDefaultValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ booleanWithDefault = false;
+ JSValue booleanWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"));
+ Converter<bool>::OptionalValue booleanWithoutDefault;
+ if (!booleanWithoutDefaultValue.isUndefined()) {
+ booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue sequenceOfStringsValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "sequenceOfStrings"));
+ Converter<Vector<String>>::OptionalValue sequenceOfStrings;
+ if (!sequenceOfStringsValue.isUndefined()) {
+ sequenceOfStrings = convert<Vector<String>>(state, sequenceOfStringsValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue restrictedDoubleValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "restrictedDouble"));
+ Converter<double>::OptionalValue restrictedDouble;
+ if (!restrictedDoubleValue.isUndefined()) {
+ restrictedDouble = convert<double>(state, restrictedDoubleValue, ShouldAllowNonFinite::No);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue unrestrictedDoubleValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unrestrictedDouble"));
+ Converter<double>::OptionalValue unrestrictedDouble;
+ if (!unrestrictedDoubleValue.isUndefined()) {
+ unrestrictedDouble = convert<double>(state, unrestrictedDoubleValue, ShouldAllowNonFinite::Yes);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue restrictedDoubleWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "restrictedDoubleWithDefault"));
+ double restrictedDoubleWithDefault;
+ if (!restrictedDoubleWithDefaultValue.isUndefined()) {
+ restrictedDoubleWithDefault = convert<double>(state, restrictedDoubleWithDefaultValue, ShouldAllowNonFinite::No);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ restrictedDoubleWithDefault = 0;
+ JSValue unrestrictedDoubleWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unrestrictedDoubleWithDefault"));
+ double unrestrictedDoubleWithDefault;
+ if (!unrestrictedDoubleWithDefaultValue.isUndefined()) {
+ unrestrictedDoubleWithDefault = convert<double>(state, unrestrictedDoubleWithDefaultValue, ShouldAllowNonFinite::Yes);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ unrestrictedDoubleWithDefault = 0;
+ JSValue restrictedFloatValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "restrictedFloat"));
+ Converter<float>::OptionalValue restrictedFloat;
+ if (!restrictedFloatValue.isUndefined()) {
+ restrictedFloat = convert<float>(state, restrictedFloatValue, ShouldAllowNonFinite::No);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue unrestrictedFloatValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unrestrictedFloat"));
+ Converter<float>::OptionalValue unrestrictedFloat;
+ if (!unrestrictedFloatValue.isUndefined()) {
+ unrestrictedFloat = convert<float>(state, unrestrictedFloatValue, ShouldAllowNonFinite::Yes);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue restrictedFloatWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "restrictedFloatWithDefault"));
+ float restrictedFloatWithDefault;
+ if (!restrictedFloatWithDefaultValue.isUndefined()) {
+ restrictedFloatWithDefault = convert<float>(state, restrictedFloatWithDefaultValue, ShouldAllowNonFinite::No);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ restrictedFloatWithDefault = 0;
+ JSValue unrestrictedFloatWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unrestrictedFloatWithDefault"));
+ float unrestrictedFloatWithDefault;
+ if (!unrestrictedFloatWithDefaultValue.isUndefined()) {
+ unrestrictedFloatWithDefault = convert<float>(state, unrestrictedFloatWithDefaultValue, ShouldAllowNonFinite::Yes);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ unrestrictedFloatWithDefault = 0;
+ JSValue smallIntegerClampedValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "smallIntegerClamped"));
+ Converter<int8_t>::OptionalValue smallIntegerClamped;
+ if (!smallIntegerClampedValue.isUndefined()) {
+ smallIntegerClamped = convert<int8_t>(state, smallIntegerClampedValue, Clamp);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue smallIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "smallIntegerWithDefault"));
+ Converter<int8_t>::OptionalValue smallIntegerWithDefault;
+ if (!smallIntegerWithDefaultValue.isUndefined()) {
+ smallIntegerWithDefault = convert<int8_t>(state, smallIntegerWithDefaultValue, NormalConversion);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue smallUnsignedIntegerEnforcedRangeValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "smallUnsignedIntegerEnforcedRange"));
+ Converter<uint8_t>::OptionalValue smallUnsignedIntegerEnforcedRange;
+ if (!smallUnsignedIntegerEnforcedRangeValue.isUndefined()) {
+ smallUnsignedIntegerEnforcedRange = convert<uint8_t>(state, smallUnsignedIntegerEnforcedRangeValue, EnforceRange);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue smallUnsignedIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "smallUnsignedIntegerWithDefault"));
+ uint8_t smallUnsignedIntegerWithDefault;
+ if (!smallUnsignedIntegerWithDefaultValue.isUndefined()) {
+ smallUnsignedIntegerWithDefault = convert<uint8_t>(state, smallUnsignedIntegerWithDefaultValue, NormalConversion);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ smallUnsignedIntegerWithDefault = 0;
+ JSValue integerValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "integer"));
+ Converter<int32_t>::OptionalValue integer;
+ if (!integerValue.isUndefined()) {
+ integer = convert<int32_t>(state, integerValue, NormalConversion);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue integerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "integerWithDefault"));
+ int32_t integerWithDefault;
+ if (!integerWithDefaultValue.isUndefined()) {
+ integerWithDefault = convert<int32_t>(state, integerWithDefaultValue, NormalConversion);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ integerWithDefault = 0;
+ JSValue unsignedIntegerValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unsignedInteger"));
+ Converter<uint32_t>::OptionalValue unsignedInteger;
+ if (!unsignedIntegerValue.isUndefined()) {
+ unsignedInteger = convert<uint32_t>(state, unsignedIntegerValue, NormalConversion);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue unsignedIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unsignedIntegerWithDefault"));
+ uint32_t unsignedIntegerWithDefault;
+ if (!unsignedIntegerWithDefaultValue.isUndefined()) {
+ unsignedIntegerWithDefault = convert<uint32_t>(state, unsignedIntegerWithDefaultValue, NormalConversion);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ unsignedIntegerWithDefault = 0;
+ JSValue largeIntegerValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "largeInteger"));
+ Converter<int64_t>::OptionalValue largeInteger;
+ if (!largeIntegerValue.isUndefined()) {
+ largeInteger = convert<int64_t>(state, largeIntegerValue, NormalConversion);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue largeIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "largeIntegerWithDefault"));
+ int64_t largeIntegerWithDefault;
+ if (!largeIntegerWithDefaultValue.isUndefined()) {
+ largeIntegerWithDefault = convert<int64_t>(state, largeIntegerWithDefaultValue, NormalConversion);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ largeIntegerWithDefault = 0;
+ JSValue unsignedLargeIntegerValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unsignedLargeInteger"));
+ Converter<uint64_t>::OptionalValue unsignedLargeInteger;
+ if (!unsignedLargeIntegerValue.isUndefined()) {
+ unsignedLargeInteger = convert<uint64_t>(state, unsignedLargeIntegerValue, NormalConversion);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue unsignedLargeIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unsignedLargeIntegerWithDefault"));
+ uint64_t unsignedLargeIntegerWithDefault;
+ if (!unsignedLargeIntegerWithDefaultValue.isUndefined()) {
+ unsignedLargeIntegerWithDefault = convert<uint64_t>(state, unsignedLargeIntegerWithDefaultValue, NormalConversion);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ unsignedLargeIntegerWithDefault = 0;
+ JSValue nullableNodeValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "nullableNode"));
+ Node* nullableNode;
+ if (!nullableNodeValue.isUndefined()) {
+ nullableNode = convertWrapperType<Node, JSNode>(state, nullableNodeValue, IsNullable::Yes);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ nullableNode = nullptr;
+ JSValue anyValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "anyValue"));
+ JSC::JSValue anyValue;
+ if (!anyValueValue.isUndefined()) {
+ anyValue = convert<JSC::JSValue>(state, anyValueValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ anyValue = jsUndefined();
+ JSValue anyTypedefValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "anyTypedefValue"));
+ JSC::JSValue anyTypedefValue;
+ if (!anyTypedefValueValue.isUndefined()) {
+ anyTypedefValue = convert<JSC::JSValue>(state, anyTypedefValueValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ anyTypedefValue = jsUndefined();
+ JSValue dictionaryMemberValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "dictionaryMember"));
+ Converter<TestObj::DictionaryThatShouldTolerateNull>::OptionalValue dictionaryMember;
+ if (!dictionaryMemberValue.isUndefined()) {
+ dictionaryMember = convertDictionary<TestObj::DictionaryThatShouldTolerateNull>(state, dictionaryMemberValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
return TestObj::Dictionary { WTFMove(enumerationValueWithoutDefault), WTFMove(enumerationValueWithDefault), WTFMove(enumerationValueWithEmptyStringDefault), WTFMove(stringWithDefault), WTFMove(stringWithoutDefault), WTFMove(booleanWithDefault), WTFMove(booleanWithoutDefault), WTFMove(sequenceOfStrings), WTFMove(restrictedDouble), WTFMove(unrestrictedDouble), WTFMove(restrictedDoubleWithDefault), WTFMove(unrestrictedDoubleWithDefault), WTFMove(restrictedFloat), WTFMove(unrestrictedFloat), WTFMove(restrictedFloatWithDefault), WTFMove(unrestrictedFloatWithDefault), WTFMove(smallIntegerClamped), WTFMove(smallIntegerWithDefault), WTFMove(smallUnsignedIntegerEnforcedRange), WTFMove(smallUnsignedIntegerWithDefault), WTFMove(integer), WTFMove(integerWithDefault), WTFMove(unsignedInteger), WTFMove(unsignedIntegerWithDefault), WTFMove(largeInteger), WTFMove(largeIntegerWithDefault), WTFMove(unsignedLargeInteger), WTFMove(unsignedLargeIntegerWithDefault), WTF
Move(nullableNode), WTFMove(anyValue), WTFMove(anyTypedefValue), dictionaryMember.value() };
}
@@ -597,18 +745,49 @@
{
VM& vm = state.vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
- auto* object = value.getObject();
- if (UNLIKELY(!object || object->type() == RegExpObjectType)) {
+ bool isNullOrUndefined = value.isUndefinedOrNull();
+ auto* object = isNullOrUndefined ? nullptr : value.getObject();
+ if (UNLIKELY(!isNullOrUndefined && !object)) {
throwTypeError(&state, throwScope);
return Nullopt;
}
- auto requiredEnumerationValue = convert<TestObj::EnumType>(state, object->get(&state, Identifier::fromString(&state, "requiredEnumerationValue")));
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto booleanWithoutDefault = convertOptional<bool>(state, object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault")));
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto* nonNullableNode = convertWrapperType<Node, JSNode>(state, object->get(&state, Identifier::fromString(&state, "nonNullableNode")), IsNullable::No);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto requiredDictionaryMember = convertDictionary<TestObj::Dictionary>(state, object->get(&state, Identifier::fromString(&state, "requiredDictionaryMember")));
+ if (UNLIKELY(object && object->type() == RegExpObjectType)) {
+ throwTypeError(&state, throwScope);
+ return Nullopt;
+ }
+ JSValue requiredEnumerationValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "requiredEnumerationValue"));
+ TestObj::EnumType requiredEnumerationValue;
+ if (!requiredEnumerationValueValue.isUndefined()) {
+ requiredEnumerationValue = convert<TestObj::EnumType>(state, requiredEnumerationValueValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else {
+ throwTypeError(&state, throwScope);
+ return Nullopt;
+ }
+ JSValue booleanWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"));
+ Converter<bool>::OptionalValue booleanWithoutDefault;
+ if (!booleanWithoutDefaultValue.isUndefined()) {
+ booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue nonNullableNodeValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "nonNullableNode"));
+ Node* nonNullableNode;
+ if (!nonNullableNodeValue.isUndefined()) {
+ nonNullableNode = convertWrapperType<Node, JSNode>(state, nonNullableNodeValue, IsNullable::No);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else {
+ throwTypeError(&state, throwScope);
+ return Nullopt;
+ }
+ JSValue requiredDictionaryMemberValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "requiredDictionaryMember"));
+ TestObj::Dictionary requiredDictionaryMember;
+ if (!requiredDictionaryMemberValue.isUndefined()) {
+ requiredDictionaryMember = convertDictionary<TestObj::Dictionary>(state, requiredDictionaryMemberValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else {
+ throwTypeError(&state, throwScope);
+ return Nullopt;
+ }
return TestObj::DictionaryThatShouldNotTolerateNull { WTFMove(requiredEnumerationValue), WTFMove(booleanWithoutDefault), *nonNullableNode, requiredDictionaryMember.value() };
}
@@ -616,16 +795,28 @@
{
VM& vm = state.vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
- if (value.isUndefinedOrNull())
- return TestObj::DictionaryThatShouldTolerateNull { { }, { } };
- auto* object = value.getObject();
- if (UNLIKELY(!object || object->type() == RegExpObjectType)) {
+ bool isNullOrUndefined = value.isUndefinedOrNull();
+ auto* object = isNullOrUndefined ? nullptr : value.getObject();
+ if (UNLIKELY(!isNullOrUndefined && !object)) {
throwTypeError(&state, throwScope);
return Nullopt;
}
- auto enumerationValue = convertOptional<TestObj::EnumType>(state, object->get(&state, Identifier::fromString(&state, "enumerationValue")));
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto booleanWithoutDefault = convertOptional<bool>(state, object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault")));
+ if (UNLIKELY(object && object->type() == RegExpObjectType)) {
+ throwTypeError(&state, throwScope);
+ return Nullopt;
+ }
+ JSValue enumerationValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "enumerationValue"));
+ Converter<TestObj::EnumType>::OptionalValue enumerationValue;
+ if (!enumerationValueValue.isUndefined()) {
+ enumerationValue = convert<TestObj::EnumType>(state, enumerationValueValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue booleanWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"));
+ Converter<bool>::OptionalValue booleanWithoutDefault;
+ if (!booleanWithoutDefaultValue.isUndefined()) {
+ booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
return TestObj::DictionaryThatShouldTolerateNull { WTFMove(enumerationValue), WTFMove(booleanWithoutDefault) };
}
@@ -633,16 +824,28 @@
{
VM& vm = state.vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
- if (value.isUndefinedOrNull())
- return AlternateDictionaryName { { }, { } };
- auto* object = value.getObject();
- if (UNLIKELY(!object || object->type() == RegExpObjectType)) {
+ bool isNullOrUndefined = value.isUndefinedOrNull();
+ auto* object = isNullOrUndefined ? nullptr : value.getObject();
+ if (UNLIKELY(!isNullOrUndefined && !object)) {
throwTypeError(&state, throwScope);
return Nullopt;
}
- auto enumerationValue = convertOptional<TestObj::EnumType>(state, object->get(&state, Identifier::fromString(&state, "enumerationValue")));
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- auto booleanWithoutDefault = convertOptional<bool>(state, object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault")));
+ if (UNLIKELY(object && object->type() == RegExpObjectType)) {
+ throwTypeError(&state, throwScope);
+ return Nullopt;
+ }
+ JSValue enumerationValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "enumerationValue"));
+ Converter<TestObj::EnumType>::OptionalValue enumerationValue;
+ if (!enumerationValueValue.isUndefined()) {
+ enumerationValue = convert<TestObj::EnumType>(state, enumerationValueValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue booleanWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"));
+ Converter<bool>::OptionalValue booleanWithoutDefault;
+ if (!booleanWithoutDefaultValue.isUndefined()) {
+ booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
return AlternateDictionaryName { WTFMove(enumerationValue), WTFMove(booleanWithoutDefault) };
}