Changeset 53657 in webkit for trunk/JavaScriptCore/API/tests/testapi.c
- Timestamp:
- Jan 21, 2010, 4:06:00 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/tests/testapi.c
r51068 r53657 624 624 } 625 625 626 static JSClassRef Derived2_class(JSContextRef context) 627 { 628 static JSClassRef jsClass; 629 if (!jsClass) { 630 JSClassDefinition definition = kJSClassDefinitionEmpty; 631 definition.parentClass = Derived_class(context); 632 jsClass = JSClassCreate(&definition); 633 } 634 return jsClass; 635 } 636 626 637 static JSValueRef print_callAsFunction(JSContextRef ctx, JSObjectRef functionObject, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 627 638 { … … 1071 1082 ASSERT(!JSObjectGetPrivate(myConstructor)); 1072 1083 1084 string = JSStringCreateWithUTF8CString("Base"); 1085 JSObjectRef baseConstructor = JSObjectMakeConstructor(context, Base_class(context), NULL); 1086 JSObjectSetProperty(context, globalObject, string, baseConstructor, kJSPropertyAttributeNone, NULL); 1087 JSStringRelease(string); 1088 1073 1089 string = JSStringCreateWithUTF8CString("Derived"); 1074 1090 JSObjectRef derivedConstructor = JSObjectMakeConstructor(context, Derived_class(context), NULL); … … 1076 1092 JSStringRelease(string); 1077 1093 1094 string = JSStringCreateWithUTF8CString("Derived2"); 1095 JSObjectRef derived2Constructor = JSObjectMakeConstructor(context, Derived2_class(context), NULL); 1096 JSObjectSetProperty(context, globalObject, string, derived2Constructor, kJSPropertyAttributeNone, NULL); 1097 JSStringRelease(string); 1098 1078 1099 o = JSObjectMake(context, NULL, NULL); 1079 1100 JSObjectSetProperty(context, o, jsOneIString, JSValueMakeNumber(context, 1), kJSPropertyAttributeNone, NULL); … … 1174 1195 script = JSStringCreateWithUTF8CString(scriptUTF8); 1175 1196 result = JSEvaluateScript(context, script, NULL, NULL, 1, &exception); 1176 if ( JSValueIsUndefined(context, result))1197 if (result && JSValueIsUndefined(context, result)) 1177 1198 printf("PASS: Test script executed successfully.\n"); 1178 1199 else {
Note:
See TracChangeset
for help on using the changeset viewer.