Changeset 15474 in webkit for trunk/JavaScriptCore/API/testapi.c
- Timestamp:
- Jul 16, 2006, 7:00:40 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/testapi.c
r15473 r15474 116 116 || JSStringIsEqualToUTF8CString(propertyName, "cantFind") 117 117 || JSStringIsEqualToUTF8CString(propertyName, "myPropertyName") 118 || JSStringIsEqualToUTF8CString(propertyName, "hasPropertyLie")) { 118 || JSStringIsEqualToUTF8CString(propertyName, "hasPropertyLie") 119 || JSStringIsEqualToUTF8CString(propertyName, "0")) { 119 120 return true; 120 121 } … … 138 139 if (JSStringIsEqualToUTF8CString(propertyName, "cantFind")) { 139 140 return JSValueMakeUndefined(); 141 } 142 143 if (JSStringIsEqualToUTF8CString(propertyName, "0")) { 144 *exception = JSValueMakeNumber(1); 145 return JSValueMakeNumber(1); 140 146 } 141 147 … … 415 421 assert(!JSValueIsEqual(context, jsObjectNoProto, JSValueMakeNumber(1), &exception)); 416 422 assert(exception); 423 424 exception = NULL; 425 JSObjectGetPropertyAtIndex(context, myObject, 0, &exception); 426 assert(1 == JSValueToNumber(context, exception, NULL)); 417 427 418 428 assertEqualsAsBoolean(jsUndefined, false); … … 525 535 526 536 JSStringRef array = JSStringCreateWithUTF8CString("Array"); 527 v = JSObjectGetProperty(context, globalObject, array, NULL); 528 assert(v); 529 JSObjectRef arrayConstructor = JSValueToObject(context, v, NULL); 537 JSObjectRef arrayConstructor = JSValueToObject(context, JSObjectGetProperty(context, globalObject, array, NULL), NULL); 530 538 JSStringRelease(array); 531 539 result = JSObjectCallAsConstructor(context, arrayConstructor, 0, NULL, NULL); 532 540 assert(result); 541 assert(JSValueIsObject(result)); 533 542 assert(JSValueIsInstanceOfConstructor(context, result, arrayConstructor, NULL)); 534 543 assert(!JSValueIsInstanceOfConstructor(context, JSValueMakeNull(), arrayConstructor, NULL)); 535 544 545 o = JSValueToObject(context, result, NULL); 546 exception = NULL; 547 assert(JSValueIsUndefined(JSObjectGetPropertyAtIndex(context, o, 0, &exception))); 548 assert(!exception); 549 550 JSObjectSetPropertyAtIndex(context, o, 0, JSValueMakeNumber(1), &exception); 551 assert(!exception); 552 553 exception = NULL; 554 assert(1 == JSValueToNumber(context, JSObjectGetPropertyAtIndex(context, o, 0, &exception), &exception)); 555 assert(!exception); 556 536 557 JSStringRef functionBody; 537 558 JSObjectRef function; … … 543 564 assert(JSValueIsObject(exception)); 544 565 v = JSObjectGetProperty(context, JSValueToObject(context, exception, NULL), line, NULL); 545 assert(v);546 566 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) 547 567 JSStringRelease(functionBody); … … 619 639 v = JSObjectCallAsFunction(context, function, o, 0, NULL, NULL); 620 640 assert(JSValueIsEqual(context, v, o, NULL)); 641 642 621 643 622 644 char* scriptUTF8 = createStringWithContentsOfFile("testapi.js");
Note:
See TracChangeset
for help on using the changeset viewer.