Changeset 15310 in webkit for trunk/JavaScriptCore/API/JSNode.c


Ignore:
Timestamp:
Jul 10, 2006, 2:17:26 PM (19 years ago)
Author:
ggaren
Message:

Reviewed by Darin.

Improved type safety by implementing opaque JSValue/JSObject typing through
abuse of 'const', not void*. Also fixed an alarming number of bugs
exposed by this new type safety.


I made one design change in JavaScriptCore, which is that the JSObject
constructor should take a JSValue* as its prototype argument, not a JSObject*,
since we allow the prototype to be any JSValue*, including jsNull(), for
example.


  • API/APICast.h: (toJS):
  • API/JSBase.h:
  • API/JSCallbackConstructor.cpp: (KJS::JSCallbackConstructor::construct):
  • API/JSCallbackFunction.cpp: (KJS::JSCallbackFunction::callAsFunction):
  • API/JSCallbackObject.cpp: (KJS::JSCallbackObject::JSCallbackObject): (KJS::JSCallbackObject::getOwnPropertySlot): (KJS::JSCallbackObject::put): (KJS::JSCallbackObject::construct): (KJS::JSCallbackObject::callAsFunction): (KJS::JSCallbackObject::staticFunctionGetter):
  • API/JSCallbackObject.h:
  • API/JSContextRef.cpp: (JSEvaluate):
  • API/JSNode.c: (JSNodePrototype_appendChild): (JSNodePrototype_removeChild): (JSNodePrototype_replaceChild):
  • API/JSObjectRef.cpp: (JSObjectMake): (JSFunctionMakeWithBody): (JSObjectGetProperty): (JSObjectCallAsFunction): (JSObjectCallAsConstructor):
  • API/JSObjectRef.h:
  • API/testapi.c: (main):
  • ChangeLog:
  • kjs/object.h: (KJS::JSObject::JSObject):
File:
1 edited

Legend:

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

    r15307 r15310  
    4949    } else {
    5050        Node* node = JSObjectGetPrivate(thisObject);
    51         Node* child = JSObjectGetPrivate(argv[0]);
     51        Node* child = JSObjectGetPrivate(JSValueToObject(context, argv[0]));
    5252
    5353        Node_appendChild(node, child);
     
    6767            if (JSValueIsObjectOfClass(argv[0], JSNode_class(context))) {
    6868                Node* node = JSObjectGetPrivate(thisObject);
    69                 Node* child = JSObjectGetPrivate(argv[0]);
     69                Node* child = JSObjectGetPrivate(JSValueToObject(context, argv[0]));
    7070               
    7171                Node_removeChild(node, child);
     
    8787                if (JSValueIsObjectOfClass(argv[1], JSNode_class(context))) {
    8888                    Node* node = JSObjectGetPrivate(thisObject);
    89                     Node* newChild = JSObjectGetPrivate(argv[0]);
    90                     Node* oldChild = JSObjectGetPrivate(argv[1]);
     89                    Node* newChild = JSObjectGetPrivate(JSValueToObject(context, argv[0]));
     90                    Node* oldChild = JSObjectGetPrivate(JSValueToObject(context, argv[1]));
    9191                   
    9292                    Node_replaceChild(node, newChild, oldChild);
Note: See TracChangeset for help on using the changeset viewer.