Changeset 155495 in webkit for trunk/Source/JavaScriptCore/API
- Timestamp:
- Sep 10, 2013, 6:16:50 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/tests/testapi.c
r154647 r155495 1044 1044 } 1045 1045 1046 static JSValueRef valueToObjectExceptionCallAsFunction(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1047 { 1048 UNUSED_PARAM(function); 1049 UNUSED_PARAM(thisObject); 1050 UNUSED_PARAM(argumentCount); 1051 UNUSED_PARAM(arguments); 1052 JSValueRef jsUndefined = JSValueMakeUndefined(JSContextGetGlobalContext(ctx)); 1053 JSValueToObject(JSContextGetGlobalContext(ctx), jsUndefined, exception); 1054 1055 return JSValueMakeUndefined(ctx); 1056 } 1057 static bool valueToObjectExceptionTest() 1058 { 1059 JSGlobalContextRef testContext; 1060 JSClassDefinition globalObjectClassDefinition = kJSClassDefinitionEmpty; 1061 globalObjectClassDefinition.initialize = globalObject_initialize; 1062 globalObjectClassDefinition.staticValues = globalObject_staticValues; 1063 globalObjectClassDefinition.staticFunctions = globalObject_staticFunctions; 1064 globalObjectClassDefinition.attributes = kJSClassAttributeNoAutomaticPrototype; 1065 JSClassRef globalObjectClass = JSClassCreate(&globalObjectClassDefinition); 1066 testContext = JSGlobalContextCreateInGroup(NULL, globalObjectClass); 1067 JSObjectRef globalObject = JSContextGetGlobalObject(testContext); 1068 1069 JSStringRef valueToObject = JSStringCreateWithUTF8CString("valueToObject"); 1070 JSObjectRef valueToObjectFunction = JSObjectMakeFunctionWithCallback(testContext, valueToObject, valueToObjectExceptionCallAsFunction); 1071 JSObjectSetProperty(testContext, globalObject, valueToObject, valueToObjectFunction, kJSPropertyAttributeNone, NULL); 1072 JSStringRelease(valueToObject); 1073 1074 JSStringRef test = JSStringCreateWithUTF8CString("valueToObject();"); 1075 JSEvaluateScript(testContext, test, NULL, NULL, 1, NULL); 1076 1077 JSStringRelease(test); 1078 JSClassRelease(globalObjectClass); 1079 JSGlobalContextRelease(testContext); 1080 1081 return true; 1082 } 1083 1046 1084 static void checkConstnessInJSObjectNames() 1047 1085 { … … 1976 2014 failed = true; 1977 2015 } 2016 if (valueToObjectExceptionTest()) 2017 printf("PASS: throwException did not crash when handling an error with appendMessageToError set and no codeBlock available.\n"); 1978 2018 1979 2019 if (failed) {
Note:
See TracChangeset
for help on using the changeset viewer.