Changeset 67129 in webkit for trunk/JavaScriptCore/API
- Timestamp:
- Sep 9, 2010, 5:13:29 PM (15 years ago)
- Location:
- trunk/JavaScriptCore/API
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSObjectRef.cpp
r60762 r67129 383 383 APIEntryShim entryShim(exec); 384 384 JSObject* jsObject = toJS(object); 385 JSValue jsValue = toJS(exec, value);385 JSValue jsValue = value ? toJS(exec, value) : JSValue(); 386 386 Identifier name(propertyName->identifier(&exec->globalData())); 387 387 if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::info)) { -
trunk/JavaScriptCore/API/tests/testapi.c
r63277 r67129 934 934 if (!JSObjectSetPrivateProperty(context, myObject, privatePropertyName, aHeapRef)) { 935 935 printf("FAIL: Could not set private property.\n"); 936 failed = 1; 937 } else {936 failed = 1; 937 } else 938 938 printf("PASS: Set private property.\n"); 939 }940 939 aStackRef = 0; 941 940 if (JSObjectSetPrivateProperty(context, aHeapRef, privatePropertyName, aHeapRef)) { 942 941 printf("FAIL: JSObjectSetPrivateProperty should fail on non-API objects.\n"); 943 failed = 1; 944 } else {942 failed = 1; 943 } else 945 944 printf("PASS: Did not allow JSObjectSetPrivateProperty on a non-API object.\n"); 946 }947 945 if (JSObjectGetPrivateProperty(context, myObject, privatePropertyName) != aHeapRef) { 948 946 printf("FAIL: Could not retrieve private property.\n"); … … 955 953 } else 956 954 printf("PASS: JSObjectGetPrivateProperty return NULL.\n"); 957 955 958 956 if (JSObjectGetProperty(context, myObject, privatePropertyName, 0) == aHeapRef) { 959 957 printf("FAIL: Accessed private property through ordinary property lookup.\n"); … … 961 959 } else 962 960 printf("PASS: Cannot access private property through ordinary property lookup.\n"); 963 961 964 962 JSGarbageCollect(context); 965 963 966 964 for (int i = 0; i < 10000; i++) 967 965 JSObjectMake(context, 0, 0); … … 974 972 printf("PASS: Private property does not appear to have been collected.\n"); 975 973 JSStringRelease(lengthStr); 976 974 975 if (!JSObjectSetPrivateProperty(context, myObject, privatePropertyName, 0)) { 976 printf("FAIL: Could not set private property to NULL.\n"); 977 failed = 1; 978 } else 979 printf("PASS: Set private property to NULL.\n"); 980 if (JSObjectGetPrivateProperty(context, myObject, privatePropertyName)) { 981 printf("FAIL: Could not retrieve private property.\n"); 982 failed = 1; 983 } else 984 printf("PASS: Retrieved private property.\n"); 985 977 986 JSStringRef validJSON = JSStringCreateWithUTF8CString("{\"aProperty\":true}"); 978 987 JSValueRef jsonObject = JSValueMakeFromJSONString(context, validJSON);
Note:
See TracChangeset
for help on using the changeset viewer.