Changeset 15168 in webkit for trunk/JavaScriptCore/API/minidom.c
- Timestamp:
- Jul 5, 2006, 12:10:49 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/minidom.c
r15149 r15168 40 40 JSObjectRef globalObject = JSContextGetGlobalObject(context); 41 41 42 JS CharBufferRef printBuf = JSCharBufferCreateUTF8("print");42 JSStringBufferRef printBuf = JSStringBufferCreateUTF8("print"); 43 43 JSObjectSetProperty(context, globalObject, printBuf, JSFunctionMake(context, print), kJSPropertyAttributeNone); 44 JS CharBufferRelease(printBuf);44 JSStringBufferRelease(printBuf); 45 45 46 JS CharBufferRef nodeBuf = JSCharBufferCreateUTF8("Node");46 JSStringBufferRef nodeBuf = JSStringBufferCreateUTF8("Node"); 47 47 JSObjectSetProperty(context, globalObject, nodeBuf, JSConstructorMake(context, JSNode_construct), kJSPropertyAttributeNone); 48 JS CharBufferRelease(nodeBuf);48 JSStringBufferRelease(nodeBuf); 49 49 50 50 char* script = createStringWithContentsOfFile("minidom.js"); 51 JS CharBufferRef scriptBuf = JSCharBufferCreateUTF8(script);51 JSStringBufferRef scriptBuf = JSStringBufferCreateUTF8(script); 52 52 JSValueRef exception; 53 53 JSValueRef result = JSEvaluate(context, scriptBuf, NULL, NULL, 0, &exception); … … 56 56 else { 57 57 printf("FAIL: Test script threw exception:\n"); 58 JS CharBufferRef exceptionBuf = JSValueCopyStringValue(context, exception);59 CFStringRef exceptionCF = CFStringCreateWithJS CharBuffer(kCFAllocatorDefault, exceptionBuf);58 JSStringBufferRef exceptionBuf = JSValueCopyStringValue(context, exception); 59 CFStringRef exceptionCF = CFStringCreateWithJSStringBuffer(kCFAllocatorDefault, exceptionBuf); 60 60 CFShow(exceptionCF); 61 61 CFRelease(exceptionCF); 62 JS CharBufferRelease(exceptionBuf);62 JSStringBufferRelease(exceptionBuf); 63 63 } 64 JS CharBufferRelease(scriptBuf);64 JSStringBufferRelease(scriptBuf); 65 65 free(script); 66 66 … … 82 82 { 83 83 if (argc > 0) { 84 JS CharBufferRef stringBuf = JSValueCopyStringValue(context, argv[0]);85 size_t numChars = JS CharBufferGetMaxLengthUTF8(stringBuf);84 JSStringBufferRef stringBuf = JSValueCopyStringValue(context, argv[0]); 85 size_t numChars = JSStringBufferGetMaxLengthUTF8(stringBuf); 86 86 char string[numChars]; 87 JS CharBufferGetCharactersUTF8(stringBuf, string, numChars);87 JSStringBufferGetCharactersUTF8(stringBuf, string, numChars); 88 88 printf("%s\n", string); 89 89 }
Note:
See TracChangeset
for help on using the changeset viewer.