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:
Scott Kyle 2016-03-03 02:52:15 -08:00
parent 85832f0f02
commit 42cdf9daad
1 changed files with 1 additions and 7 deletions

View File

@ -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;