Changeset 15469 in webkit for trunk/JavaScriptCore/API/testapi.c


Ignore:
Timestamp:
Jul 16, 2006, 3:17:04 PM (19 years ago)
Author:
ggaren
Message:

Reviewed by Maciej.


  • Added names to functions.


  • Removed GetPrivate/SetPrivate from callbackFunctions and callbackConstructors. The private data idiom is that a JS object stores its native implementation as private data. For functions and constructors, the native implementation is nothing more than the callback they already store, so supporting private data, too, confuses the idiom. If you *really* want, you can still create a custom function with private data.
  • API/JSCallbackConstructor.cpp:
  • API/JSCallbackConstructor.h:
  • API/JSCallbackFunction.cpp: (KJS::JSCallbackFunction::JSCallbackFunction):
  • API/JSCallbackFunction.h:
  • API/JSCallbackObject.cpp: (KJS::JSCallbackObject::staticFunctionGetter):
  • API/JSObjectRef.cpp: (JSObjectMakeFunction): (JSObjectMakeFunctionWithBody): (JSObjectGetPrivate): (JSObjectSetPrivate):
  • API/JSObjectRef.h:
  • API/minidom.c: (main):
  • API/testapi.c: (main):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/testapi.c

    r15468 r15469  
    571571
    572572    JSStringRef print = JSStringCreateWithUTF8CString("print");
    573     JSObjectRef printFunction = JSObjectMakeFunction(context, print_callAsFunction);
     573    JSObjectRef printFunction = JSObjectMakeFunction(context, print, print_callAsFunction);
    574574    JSObjectSetProperty(context, globalObject, print, printFunction, kJSPropertyAttributeNone, NULL);
    575575    JSStringRelease(print);
    576576   
    577     assert(JSObjectSetPrivate(printFunction, (void*)1));
    578     assert(JSObjectGetPrivate(printFunction) == (void*)1);
     577    assert(!JSObjectSetPrivate(printFunction, (void*)1));
     578    assert(!JSObjectGetPrivate(printFunction));
    579579
    580580    JSStringRef myConstructorIString = JSStringCreateWithUTF8CString("MyConstructor");
     
    583583    JSStringRelease(myConstructorIString);
    584584   
    585     assert(JSObjectSetPrivate(myConstructor, (void*)1));
    586     assert(JSObjectGetPrivate(myConstructor) == (void*)1);
     585    assert(!JSObjectSetPrivate(myConstructor, (void*)1));
     586    assert(!JSObjectGetPrivate(myConstructor));
    587587   
    588588    o = JSObjectMake(context, NULL, NULL);
Note: See TracChangeset for help on using the changeset viewer.