Changeset 15443 in webkit for trunk/JavaScriptCore/API/testapi.c
- Timestamp:
- Jul 14, 2006, 9:10:31 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/testapi.c
r15437 r15443 39 39 static void assertEqualsAsBoolean(JSValueRef value, bool expectedValue) 40 40 { 41 if (JSValueToBoolean(context, value , NULL) != expectedValue)41 if (JSValueToBoolean(context, value) != expectedValue) 42 42 fprintf(stderr, "assertEqualsAsBoolean failed: %p, %d\n", value, expectedValue); 43 43 } … … 106 106 } 107 107 108 static bool MyObject_hasProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName , JSValueRef* exception)108 static bool MyObject_hasProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName) 109 109 { 110 110 UNUSED_PARAM(context); … … 160 160 return true; 161 161 162 if (JSStringIsEqualToUTF8CString(propertyName, "throwOnDelete")) { 163 *exception = JSValueMakeNumber(2); 164 return false; 165 } 166 162 167 return false; 163 168 } … … 206 211 207 212 JSStringRef numberString = JSStringCreateWithUTF8CString("Number"); 208 JSObjectRef numberConstructor = JSValueToObject(context, JSObjectGetProperty(context, JSContextGetGlobalObject(context), numberString ), NULL);213 JSObjectRef numberConstructor = JSValueToObject(context, JSObjectGetProperty(context, JSContextGetGlobalObject(context), numberString, NULL), NULL); 209 214 JSStringRelease(numberString); 210 215 211 return JSValueIsInstanceOfConstructor(context, possibleValue, numberConstructor );216 return JSValueIsInstanceOfConstructor(context, possibleValue, numberConstructor, NULL); 212 217 } 213 218 … … 218 223 219 224 switch (type) { 220 case kJSTypeBoolean:221 *exception = JSValueMakeNumber(2);222 return NULL;223 225 case kJSTypeNumber: 224 226 return JSValueMakeNumber(1); … … 288 290 if (argc > 0) { 289 291 JSStringRef value = JSStringCreateWithUTF8CString("value"); 290 JSObjectSetProperty(context, result, value, argv[0], kJSPropertyAttributeNone );292 JSObjectSetProperty(context, result, value, argv[0], kJSPropertyAttributeNone, NULL); 291 293 JSStringRelease(value); 292 294 } … … 371 373 assert(didInitialize); 372 374 JSStringRef myObjectIString = JSStringCreateWithUTF8CString("MyObject"); 373 JSObjectSetProperty(context, globalObject, myObjectIString, myObject, kJSPropertyAttributeNone );375 JSObjectSetProperty(context, globalObject, myObjectIString, myObject, kJSPropertyAttributeNone, NULL); 374 376 JSStringRelease(myObjectIString); 375 377 … … 389 391 assert(exception); 390 392 391 exception = NULL; 392 assert(!JSValueToBoolean(context, myObject, &exception)); 393 assert(exception); 393 assert(JSValueToBoolean(context, myObject)); 394 394 395 395 exception = NULL; … … 505 505 506 506 JSStringRef array = JSStringCreateWithUTF8CString("Array"); 507 v = JSObjectGetProperty(context, globalObject, array );507 v = JSObjectGetProperty(context, globalObject, array, NULL); 508 508 assert(v); 509 509 JSObjectRef arrayConstructor = JSValueToObject(context, v, NULL); … … 511 511 result = JSObjectCallAsConstructor(context, arrayConstructor, 0, NULL, NULL); 512 512 assert(result); 513 assert(JSValueIsInstanceOfConstructor(context, result, arrayConstructor ));514 assert(!JSValueIsInstanceOfConstructor(context, JSValueMakeNull(), arrayConstructor ));513 assert(JSValueIsInstanceOfConstructor(context, result, arrayConstructor, NULL)); 514 assert(!JSValueIsInstanceOfConstructor(context, JSValueMakeNull(), arrayConstructor, NULL)); 515 515 516 516 JSStringRef functionBody; … … 521 521 assert(!JSObjectMakeFunctionWithBody(context, functionBody, NULL, 1, &exception)); 522 522 assert(JSValueIsObject(exception)); 523 v = JSObjectGetProperty(context, JSValueToObject(context, exception, NULL), line );523 v = JSObjectGetProperty(context, JSValueToObject(context, exception, NULL), line, NULL); 524 524 assert(v); 525 525 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) … … 537 537 JSStringRef print = JSStringCreateWithUTF8CString("print"); 538 538 JSObjectRef printFunction = JSObjectMakeFunction(context, print_callAsFunction); 539 JSObjectSetProperty(context, globalObject, print, printFunction, kJSPropertyAttributeNone );539 JSObjectSetProperty(context, globalObject, print, printFunction, kJSPropertyAttributeNone, NULL); 540 540 JSStringRelease(print); 541 541 … … 545 545 JSStringRef myConstructorIString = JSStringCreateWithUTF8CString("MyConstructor"); 546 546 JSObjectRef myConstructor = JSObjectMakeConstructor(context, myConstructor_callAsConstructor); 547 JSObjectSetProperty(context, globalObject, myConstructorIString, myConstructor, kJSPropertyAttributeNone );547 JSObjectSetProperty(context, globalObject, myConstructorIString, myConstructor, kJSPropertyAttributeNone, NULL); 548 548 JSStringRelease(myConstructorIString); 549 549 … … 552 552 553 553 o = JSObjectMake(context, NULL, NULL); 554 JSObjectSetProperty(context, o, jsOneIString, JSValueMakeNumber(1), kJSPropertyAttributeNone );555 JSObjectSetProperty(context, o, jsCFIString, JSValueMakeNumber(1), kJSPropertyAttributeDontEnum );554 JSObjectSetProperty(context, o, jsOneIString, JSValueMakeNumber(1), kJSPropertyAttributeNone, NULL); 555 JSObjectSetProperty(context, o, jsCFIString, JSValueMakeNumber(1), kJSPropertyAttributeDontEnum, NULL); 556 556 JSPropertyEnumeratorRef enumerator = JSObjectCreatePropertyEnumerator(o); 557 557 int count = 0;
Note:
See TracChangeset
for help on using the changeset viewer.