Changeset 15235 in webkit for trunk/JavaScriptCore
- Timestamp:
- Jul 8, 2006, 11:08:34 AM (19 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSObjectRef.cpp
r15234 r15235 128 128 } 129 129 130 bool JSObjectGetProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName, JSValueRef* value)130 JSValueRef JSObjectGetProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName) 131 131 { 132 132 JSLock lock; … … 136 136 137 137 JSValue* jsValue = jsObject->get(exec, Identifier(nameRep)); 138 if ( value)139 *value = toRef(jsValue);140 return !jsValue->isUndefined();138 if (jsValue->isUndefined()) 139 return 0; 140 return jsValue; 141 141 } 142 142 -
trunk/JavaScriptCore/API/JSObjectRef.h
r15233 r15235 387 387 @param object The JSObject whose property you want to get. 388 388 @param propertyName A JSStringBuffer containing the property's name. 389 @param value A pointer to a JSValueRef in which to store the property's value. On return, value will contain the property's value. Pass NULL if you do not care to store the property's value. 390 @result true if the object has a property whose name matches propertyName, otherwise false. If this function returns false, the contents of value will be unmodified. 391 */ 392 bool JSObjectGetProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName, JSValueRef* value); 389 @result The property's value, or NULL if the object does not have a property whose name matches propertyName. 390 */ 391 JSValueRef JSObjectGetProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName); 393 392 /*! 394 393 @function -
trunk/JavaScriptCore/API/testapi.c
r15233 r15235 536 536 JSStringBufferRelease(badSyntaxBuf); 537 537 538 v = NULL;539 538 JSStringBufferRef arrayBuf = JSStringBufferCreateUTF8("Array"); 540 assert(JSObjectGetProperty(context, globalObject, arrayBuf, &v)); 539 v = JSObjectGetProperty(context, globalObject, arrayBuf); 540 assert(v); 541 541 JSObjectRef arrayConstructor = JSValueToObject(context, v); 542 542 JSStringBufferRelease(arrayBuf); … … 548 548 JSStringBufferRef functionBuf; 549 549 550 v = NULL;551 550 exception = NULL; 552 551 functionBuf = JSStringBufferCreateUTF8("rreturn Array;"); … … 554 553 assert(!JSFunctionMakeWithBody(context, functionBuf, NULL, 1, &exception)); 555 554 assert(JSValueIsObject(exception)); 556 assert(JSObjectGetProperty(context, exception, lineBuf, &v)); 555 v = JSObjectGetProperty(context, exception, lineBuf); 556 assert(v); 557 557 assertEqualsAsNumber(v, 2); // FIXME: Lexer::setCode bumps startingLineNumber by 1 -- we need to change internal callers so that it doesn't have to (saying '0' to mean '1' in the API would be really confusing -- it's really confusing internally, in fact) 558 558 JSStringBufferRelease(functionBuf); -
trunk/JavaScriptCore/ChangeLog
r15234 r15235 1 2006-07-08 Geoffrey Garen <[email protected]> 2 3 Reviewed by Anders. 4 5 - Make JSObjectGetProperty return a JSValue or NULL, like JSEvaluate does. 6 7 * API/JSObjectRef.cpp: 8 (JSObjectGetProperty): 9 * API/JSObjectRef.h: 10 * API/testapi.c: 11 (main): 12 1 13 2006-07-08 Geoffrey Garen <[email protected]> 2 14
Note:
See TracChangeset
for help on using the changeset viewer.