Disallow non-constructors to have schema property
Non-constructor functions (e.g. arrow functions and native functions) as well as regular objects should not be allowed as valid schema hosts. Neither of these cases were ever actually tested or used anywhere.
This commit is contained in:
parent
85832f0f02
commit
42cdf9daad
|
@ -136,16 +136,10 @@ static inline ObjectSchema RJSParseObjectSchema(JSContextRef ctx, JSObjectRef ob
|
|||
|
||||
JSObjectRef objectConstructor = NULL;
|
||||
|
||||
if (JSObjectIsFunction(ctx, objectSchemaObject) || JSObjectIsConstructor(ctx, objectSchemaObject)) {
|
||||
if (JSObjectIsConstructor(ctx, objectSchemaObject)) {
|
||||
objectConstructor = objectSchemaObject;
|
||||
objectSchemaObject = RJSValidatedObjectProperty(ctx, objectConstructor, schemaString, "Realm object constructor must have a 'schema' property.");
|
||||
}
|
||||
else {
|
||||
JSValueRef subSchemaValue = RJSValidatedPropertyValue(ctx, objectSchemaObject, schemaString);
|
||||
if (!JSValueIsUndefined(ctx, subSchemaValue)) {
|
||||
objectSchemaObject = RJSValidatedValueToObject(ctx, subSchemaValue);
|
||||
}
|
||||
}
|
||||
|
||||
ObjectDefaults objectDefaults;
|
||||
ObjectSchema objectSchema;
|
||||
|
|
Loading…
Reference in New Issue