Changeset 15376 in webkit for trunk/JavaScriptCore/API/JSNode.c
- Timestamp:
- Jul 12, 2006, 1:12:08 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSNode.c
r15328 r15376 40 40 // Example of throwing a type error for invalid values 41 41 if (!JSValueIsObjectOfClass(thisObject, JSNode_class(context))) { 42 JS InternalStringRef message = JSInternalStringCreateUTF8("TypeError: appendChild can only be called on nodes");43 *exception = JS StringMake(message);44 JS InternalStringRelease(message);42 JSStringRef message = JSStringCreateWithUTF8CString("TypeError: appendChild can only be called on nodes"); 43 *exception = JSValueMakeString(message); 44 JSStringRelease(message); 45 45 } else if (argc < 1 || !JSValueIsObjectOfClass(argv[0], JSNode_class(context))) { 46 JS InternalStringRef message = JSInternalStringCreateUTF8("TypeError: first argument to appendChild must be a node");47 *exception = JS StringMake(message);48 JS InternalStringRelease(message);46 JSStringRef message = JSStringCreateWithUTF8CString("TypeError: first argument to appendChild must be a node"); 47 *exception = JSValueMakeString(message); 48 JSStringRelease(message); 49 49 } else { 50 50 Node* node = JSObjectGetPrivate(thisObject); … … 54 54 } 55 55 56 return JS UndefinedMake();56 return JSValueMakeUndefined(); 57 57 } 58 58 … … 74 74 } 75 75 76 return JS UndefinedMake();76 return JSValueMakeUndefined(); 77 77 } 78 78 … … 96 96 } 97 97 98 return JS UndefinedMake();98 return JSValueMakeUndefined(); 99 99 } 100 100 … … 114 114 } 115 115 116 static bool JSNode_getNodeType(JSContextRef context, JSObjectRef object, JSInternalStringRef propertyName, JSValueRef* returnValue, JSValueRef* exception)116 static JSValueRef JSNode_getNodeType(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) 117 117 { 118 118 UNUSED_PARAM(context); … … 121 121 Node* node = JSObjectGetPrivate(object); 122 122 if (node) { 123 JSInternalStringRef nodeType = JSInternalStringCreateUTF8(node->nodeType); 124 *returnValue = JSStringMake(nodeType); 125 JSInternalStringRelease(nodeType); 126 return true; 127 } 128 return false; 129 } 130 131 static bool JSNode_getChildNodes(JSContextRef context, JSObjectRef thisObject, JSInternalStringRef propertyName, JSValueRef* returnValue, JSValueRef* exception) 123 JSStringRef nodeType = JSStringCreateWithUTF8CString(node->nodeType); 124 JSValueRef value = JSValueMakeString(nodeType); 125 JSStringRelease(nodeType); 126 return value; 127 } 128 129 return NULL; 130 } 131 132 static JSValueRef JSNode_getChildNodes(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) 132 133 { 133 134 UNUSED_PARAM(propertyName); 134 135 Node* node = JSObjectGetPrivate(thisObject); 135 136 assert(node); 136 *returnValue = JSNodeList_new(context, NodeList_new(node)); 137 return true; 138 } 139 140 static bool JSNode_getFirstChild(JSContextRef context, JSObjectRef object, JSInternalStringRef propertyName, JSValueRef* returnValue, JSValueRef* exception) 137 return JSNodeList_new(context, NodeList_new(node)); 138 } 139 140 static JSValueRef JSNode_getFirstChild(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) 141 141 { 142 142 UNUSED_PARAM(context); … … 144 144 UNUSED_PARAM(object); 145 145 146 *returnValue = JSUndefinedMake(); 147 return true; 146 return JSValueMakeUndefined(); 148 147 } 149 148 … … 180 179 if (!prototype) { 181 180 prototype = JSObjectMake(context, JSNodePrototype_class(context), NULL); 182 JS GCProtect(prototype);181 JSValueProtect(prototype); 183 182 } 184 183 return prototype;
Note:
See TracChangeset
for help on using the changeset viewer.