From 42cdf9daadeae632437cfef420eeba7d816249dc Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Thu, 3 Mar 2016 02:52:15 -0800 Subject: [PATCH] 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. --- src/js_schema.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/js_schema.cpp b/src/js_schema.cpp index 529d282e..3bd4dfe5 100644 --- a/src/js_schema.cpp +++ b/src/js_schema.cpp @@ -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;