Changeset 15133 in webkit
- Timestamp:
- Jul 1, 2006 9:06:07 PM (18 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 14 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSBase.h
r15096 r15133 31 31 typedef struct __JSContext* JSContextRef; 32 32 typedef struct __JSCharBuffer* JSCharBufferRef; 33 typedef struct __JSClass* JSClassRef; 33 34 typedef struct __JSPropertyList* JSPropertyListRef; 34 typedef struct __JSProperty ListEnumerator* JSPropertyListEnumeratorRef;35 typedef struct __JSPropertyEnumerator* JSPropertyEnumeratorRef; 35 36 36 37 /* Base type of all JS values, and polymorphic functions on them */ -
trunk/JavaScriptCore/API/JSCallbackObject.cpp
r14951 r15133 28 28 #include "JSCallbackObject.h" 29 29 #include "JSCharBufferRef.h" 30 #include "JSClassRef.h" 30 31 #include "JSObjectRef.h" 31 32 #include "internal.h" 33 #include "reference.h" 32 34 #include "reference_list.h" 33 35 34 36 namespace KJS { 35 37 36 const ClassInfo JSCallbackObject::info = { " JSCallbackObject", 0, 0, 0 };37 38 JSCallbackObject::JSCallbackObject( const JSObjectCallbacks* callbacks)38 const ClassInfo JSCallbackObject::info = { "CallbackObject", 0, 0, 0 }; 39 40 JSCallbackObject::JSCallbackObject(JSClassRef jsClass) 39 41 : JSObject() 40 , m_privateData(0) 41 , m_callbacks(*callbacks) 42 { 42 { 43 init(jsClass); 44 } 45 46 JSCallbackObject::JSCallbackObject(JSClassRef jsClass, JSObject* prototype) 47 : JSObject(prototype) 48 { 49 init(jsClass); 50 } 51 52 void JSCallbackObject::init(JSClassRef jsClass) 53 { 54 m_privateData = 0; 55 m_class = JSClassRetain(jsClass); 56 43 57 JSObjectRef thisRef = toRef(this); 44 58 45 59 do { 46 if (JSInitializeCallback initialize = callbacks->initialize)60 if (JSInitializeCallback initialize = jsClass->callbacks.initialize) 47 61 initialize(thisRef); 48 } while ((callbacks = callbacks->parentCallbacks)); 49 } 50 51 JSCallbackObject::JSCallbackObject(const JSObjectCallbacks* callbacks, JSObject* prototype) 52 : JSObject(prototype) 53 , m_privateData(0) 54 , m_callbacks(*callbacks) 55 { 56 JSObjectRef thisRef = toRef(this); 57 58 do { 59 if (JSInitializeCallback initialize = callbacks->initialize) 60 initialize(thisRef); 61 } while ((callbacks = callbacks->parentCallbacks)); 62 } while ((jsClass = jsClass->parent)); 62 63 } 63 64 … … 66 67 JSObjectRef thisRef = toRef(this); 67 68 68 for (JS ObjectCallbacks* callbacks = &m_callbacks; callbacks; callbacks = callbacks->parentCallbacks)69 if (JSFinalizeCallback finalize = callbacks->finalize)69 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) 70 if (JSFinalizeCallback finalize = jsClass->callbacks.finalize) 70 71 finalize(thisRef); 72 73 JSClassRelease(m_class); 71 74 } 72 75 73 76 UString JSCallbackObject::className() const 74 77 { 75 JSObjectRef thisRef = toRef(this); 76 77 for (const JSObjectCallbacks* callbacks = &m_callbacks; callbacks; callbacks = callbacks->parentCallbacks) { 78 if (JSCopyDescriptionCallback copyDescriptionCallback = callbacks->copyDescription) { 79 JSCharBufferRef descriptionBuf = copyDescriptionCallback(thisRef); 80 UString description(toJS(descriptionBuf)); 81 JSCharBufferRelease(descriptionBuf); 82 return description; 83 } 84 } 85 86 return JSObject::className(); 78 return classInfo()->className; 87 79 } 88 80 … … 91 83 JSObjectRef thisRef = toRef(this); 92 84 JSCharBufferRef propertyNameRef = toRef(propertyName.ustring().rep()); 93 94 // optional optimization for cases when we only need to know if the property exists, not its value95 for (const JSObjectCallbacks* callbacks = &m_callbacks; callbacks; callbacks = callbacks->parentCallbacks) {96 if (JSHasPropertyCallback hasPropertyCallback = callbacks->hasProperty) {85 86 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) { 87 // optional optimization to bypass getProperty in cases when we only need to know if the property exists 88 if (JSHasPropertyCallback hasPropertyCallback = jsClass->callbacks.hasProperty) { 97 89 if (hasPropertyCallback(thisRef, propertyNameRef)) { 98 slot.setCustom(0, callbackGetter); 99 return true; 100 } 101 } 102 } 103 104 for (const JSObjectCallbacks* callbacks = &m_callbacks; callbacks; callbacks = callbacks->parentCallbacks) { 105 if (JSGetPropertyCallback getPropertyCallback = callbacks->getProperty) { 90 slot.setCustom(this, callbackGetter); 91 return true; 92 } 93 } else if (JSGetPropertyCallback getPropertyCallback = jsClass->callbacks.getProperty) { 106 94 JSValueRef returnValue; 107 if (getPropertyCallback(thisRef, propertyNameRef, &returnValue)) { 108 slot.setCustom(reinterpret_cast<JSObject*>(returnValue), cachedValueGetter); // cache the value so we don't have to compute it again 109 return true; 110 } 111 } 112 } 95 if (getPropertyCallback(toRef(exec), thisRef, propertyNameRef, &returnValue)) { 96 // cache the value so we don't have to compute it again 97 // FIXME: This violates the PropertySlot design a little bit. 98 // We should either use this optimization everywhere, or nowhere. 99 slot.setCustom(reinterpret_cast<JSObject*>(returnValue), cachedValueGetter); 100 return true; 101 } 102 } 103 104 if (__JSClass::StaticValuesTable* staticValues = jsClass->staticValues) { 105 if (StaticValueEntry* entry = staticValues->get(propertyName.ustring().rep())) { 106 if (entry->getProperty) { 107 slot.setCustom(this, staticValueGetter); 108 return true; 109 } 110 } 111 } 112 113 if (__JSClass::StaticFunctionsTable* staticFunctions = jsClass->staticFunctions) { 114 if (staticFunctions->contains(propertyName.ustring().rep())) { 115 slot.setCustom(this, staticFunctionGetter); 116 return true; 117 } 118 } 119 } 120 113 121 return JSObject::getOwnPropertySlot(exec, propertyName, slot); 114 122 } … … 124 132 JSCharBufferRef propertyNameRef = toRef(propertyName.ustring().rep()); 125 133 126 for ( const JSObjectCallbacks* callbacks = &m_callbacks; callbacks; callbacks = callbacks->parentCallbacks) {127 if (JSSetPropertyCallback setPropertyCallback = callbacks->setProperty) {134 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) { 135 if (JSSetPropertyCallback setPropertyCallback = jsClass->callbacks.setProperty) { 128 136 if (setPropertyCallback(thisRef, propertyNameRef, value)) 129 137 return; 130 138 } 139 140 if (__JSClass::StaticValuesTable* staticValues = jsClass->staticValues) { 141 if (StaticValueEntry* entry = staticValues->get(propertyName.ustring().rep())) { 142 if (entry->attributes & kJSPropertyAttributeReadOnly) 143 return; 144 if (JSSetPropertyCallback setPropertyCallback = entry->setProperty) { 145 if (setPropertyCallback(thisRef, propertyNameRef, value)) 146 return; 147 } 148 } 149 } 150 151 if (__JSClass::StaticFunctionsTable* staticFunctions = jsClass->staticFunctions) { 152 if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.ustring().rep())) { 153 if (entry->attributes & kJSPropertyAttributeReadOnly) 154 return; 155 putDirect(propertyName, value, attr); // put as override property 156 return; 157 } 158 } 131 159 } 132 160 return JSObject::put(exec, propertyName, value, attr); … … 143 171 JSCharBufferRef propertyNameRef = toRef(propertyName.ustring().rep()); 144 172 145 for ( const JSObjectCallbacks* callbacks = &m_callbacks; callbacks; callbacks = callbacks->parentCallbacks) {146 if (JSDeletePropertyCallback deletePropertyCallback = callbacks->deleteProperty) {173 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) { 174 if (JSDeletePropertyCallback deletePropertyCallback = jsClass->callbacks.deleteProperty) { 147 175 if (deletePropertyCallback(thisRef, propertyNameRef)) 148 176 return true; 149 177 } 178 179 if (__JSClass::StaticValuesTable* staticValues = jsClass->staticValues) { 180 if (StaticValueEntry* entry = staticValues->get(propertyName.ustring().rep())) { 181 if (entry->attributes & kJSPropertyAttributeDontDelete) 182 return false; 183 return true; 184 } 185 } 186 187 if (__JSClass::StaticFunctionsTable* staticFunctions = jsClass->staticFunctions) { 188 if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.ustring().rep())) { 189 if (entry->attributes & kJSPropertyAttributeDontDelete) 190 return false; 191 return true; 192 } 193 } 150 194 } 151 195 return JSObject::deleteProperty(exec, propertyName); … … 159 203 bool JSCallbackObject::implementsConstruct() const 160 204 { 161 for ( const JSObjectCallbacks* callbacks = &m_callbacks; callbacks; callbacks = callbacks->parentCallbacks)162 if ( callbacks->callAsConstructor)205 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) 206 if (jsClass->callbacks.callAsConstructor) 163 207 return true; 164 208 … … 171 215 JSObjectRef thisRef = toRef(this); 172 216 173 for ( const JSObjectCallbacks* callbacks = &m_callbacks; callbacks; callbacks = callbacks->parentCallbacks) {174 if (JSCallAsConstructorCallback callAsConstructorCallback = callbacks->callAsConstructor) {217 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) { 218 if (JSCallAsConstructorCallback callAsConstructorCallback = jsClass->callbacks.callAsConstructor) { 175 219 size_t argc = args.size(); 176 220 JSValueRef argv[argc]; … … 181 225 } 182 226 183 ASSERT( false);227 ASSERT(0); // implementsConstruct should prevent us from reaching here 184 228 return 0; 185 229 } … … 187 231 bool JSCallbackObject::implementsCall() const 188 232 { 189 for ( const JSObjectCallbacks* callbacks = &m_callbacks; callbacks; callbacks = callbacks->parentCallbacks)190 if ( callbacks->callAsFunction)233 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) 234 if (jsClass->callbacks.callAsFunction) 191 235 return true; 192 236 … … 200 244 JSObjectRef thisObjRef = toRef(thisObj); 201 245 202 for ( const JSObjectCallbacks* callbacks = &m_callbacks; callbacks; callbacks = callbacks->parentCallbacks) {203 if (JSCallAsFunctionCallback callAsFunctionCallback = callbacks->callAsFunction) {246 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) { 247 if (JSCallAsFunctionCallback callAsFunctionCallback = jsClass->callbacks.callAsFunction) { 204 248 size_t argc = args.size(); 205 249 JSValueRef argv[argc]; … … 210 254 } 211 255 212 ASSERT( false);256 ASSERT(0); // implementsCall should prevent us from reaching here 213 257 return 0; 214 258 } … … 218 262 JSObjectRef thisRef = toRef(this); 219 263 220 for ( const JSObjectCallbacks* callbacks = &m_callbacks; callbacks; callbacks = callbacks->parentCallbacks)221 if (JSGetPropertyListCallback getPropertyListCallback = callbacks->getPropertyList)264 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) { 265 if (JSGetPropertyListCallback getPropertyListCallback = jsClass->callbacks.getPropertyList) 222 266 getPropertyListCallback(thisRef, toRef(&propertyList)); 223 267 268 if (__JSClass::StaticValuesTable* staticValues = jsClass->staticValues) { 269 typedef __JSClass::StaticValuesTable::const_iterator iterator; 270 iterator end = staticValues->end(); 271 for (iterator it = staticValues->begin(); it != end; ++it) { 272 UString::Rep* name = it->first.get(); 273 StaticValueEntry* entry = it->second; 274 if (entry->getProperty && !(entry->attributes & kJSPropertyAttributeDontEnum)) 275 propertyList.append(Reference(this, Identifier(name))); 276 } 277 } 278 279 if (__JSClass::StaticFunctionsTable* staticFunctions = jsClass->staticFunctions) { 280 typedef __JSClass::StaticFunctionsTable::const_iterator iterator; 281 iterator end = staticFunctions->end(); 282 for (iterator it = staticFunctions->begin(); it != end; ++it) { 283 UString::Rep* name = it->first.get(); 284 StaticFunctionEntry* entry = it->second; 285 if (!(entry->attributes & kJSPropertyAttributeDontEnum)) 286 propertyList.append(Reference(this, Identifier(name))); 287 } 288 } 289 } 290 224 291 JSObject::getPropertyList(exec, propertyList, recursive); 225 292 } … … 229 296 JSObjectRef thisRef = toRef(this); 230 297 231 for ( const JSObjectCallbacks* callbacks = &m_callbacks; callbacks; callbacks = callbacks->parentCallbacks) {232 if (JSConvertToTypeCallback convertToTypeCallback = callbacks->convertToType) {298 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) { 299 if (JSConvertToTypeCallback convertToTypeCallback = jsClass->callbacks.convertToType) { 233 300 JSValueRef returnValue; 234 301 if (convertToTypeCallback(thisRef, kJSTypeBoolean, &returnValue)) … … 243 310 JSObjectRef thisRef = toRef(this); 244 311 245 for ( const JSObjectCallbacks* callbacks = &m_callbacks; callbacks; callbacks = callbacks->parentCallbacks) {246 if (JSConvertToTypeCallback convertToTypeCallback = callbacks->convertToType) {312 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) { 313 if (JSConvertToTypeCallback convertToTypeCallback = jsClass->callbacks.convertToType) { 247 314 JSValueRef returnValue; 248 315 if (convertToTypeCallback(thisRef, kJSTypeNumber, &returnValue)) … … 257 324 JSObjectRef thisRef = toRef(this); 258 325 259 for ( const JSObjectCallbacks* callbacks = &m_callbacks; callbacks; callbacks = callbacks->parentCallbacks) {260 if (JSConvertToTypeCallback convertToTypeCallback = callbacks->convertToType) {326 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) { 327 if (JSConvertToTypeCallback convertToTypeCallback = jsClass->callbacks.convertToType) { 261 328 JSValueRef returnValue; 262 329 if (convertToTypeCallback(thisRef, kJSTypeString, &returnValue)) … … 277 344 } 278 345 346 bool JSCallbackObject::inherits(JSClassRef c) const 347 { 348 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) 349 if (jsClass == c) 350 return true; 351 return false; 352 } 353 279 354 JSValue* JSCallbackObject::cachedValueGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot& slot) 280 355 { … … 284 359 } 285 360 286 JSValue* JSCallbackObject::callbackGetter(ExecState*, JSObject* originalObject, const Identifier& propertyName, const PropertySlot&) 287 { 288 ASSERT(originalObject->inherits(&JSCallbackObject::info)); 289 JSObjectRef thisRef = toRef(originalObject); 290 JSCharBufferRef propertyNameRef= toRef(propertyName.ustring().rep()); 291 292 for (const JSObjectCallbacks* callbacks = &static_cast<JSCallbackObject*>(originalObject)->m_callbacks; callbacks; callbacks = callbacks->parentCallbacks) { 293 if (JSGetPropertyCallback getPropertyCallback = callbacks->getProperty) { 294 JSValueRef returnValue; 295 if (getPropertyCallback(thisRef, propertyNameRef, &returnValue)) { 361 JSValue* JSCallbackObject::staticValueGetter(ExecState* exec, JSObject*, const Identifier& propertyName, const PropertySlot& slot) 362 { 363 ASSERT(slot.slotBase()->inherits(&JSCallbackObject::info)); 364 JSCallbackObject* thisObj = static_cast<JSCallbackObject*>(slot.slotBase()); 365 366 JSObjectRef thisRef = toRef(thisObj); 367 JSCharBufferRef propertyNameRef = toRef(propertyName.ustring().rep()); 368 369 for (JSClassRef jsClass = thisObj->m_class; jsClass; jsClass = jsClass->parent) { 370 JSValueRef returnValue; 371 372 if (__JSClass::StaticValuesTable* staticValues = jsClass->staticValues) 373 if (StaticValueEntry* entry = staticValues->get(propertyName.ustring().rep())) 374 if (JSGetPropertyCallback getPropertyCallback = entry->getProperty) 375 if (getPropertyCallback(toRef(exec), thisRef, propertyNameRef, &returnValue)) 376 return toJS(returnValue); 377 } 378 379 return jsUndefined(); 380 } 381 382 JSValue* JSCallbackObject::staticFunctionGetter(ExecState* exec, JSObject*, const Identifier& propertyName, const PropertySlot& slot) 383 { 384 ASSERT(slot.slotBase()->inherits(&JSCallbackObject::info)); 385 JSCallbackObject* thisObj = static_cast<JSCallbackObject*>(slot.slotBase()); 386 387 if (JSValue* cachedOrOverrideValue = thisObj->getDirect(propertyName)) 388 return toJS(cachedOrOverrideValue); 389 390 for (JSClassRef jsClass = thisObj->m_class; jsClass; jsClass = jsClass->parent) { 391 if (__JSClass::StaticFunctionsTable* staticFunctions = jsClass->staticFunctions) { 392 if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.ustring().rep())) { 393 JSValue* v = toJS(JSFunctionMake(toRef(exec), entry->callAsFunction)); 394 thisObj->putDirect(propertyName, v, entry->attributes); 395 return v; 396 } 397 } 398 } 399 400 return jsUndefined(); 401 } 402 403 JSValue* JSCallbackObject::callbackGetter(ExecState* exec, JSObject*, const Identifier& propertyName, const PropertySlot& slot) 404 { 405 ASSERT(slot.slotBase()->inherits(&JSCallbackObject::info)); 406 JSCallbackObject* thisObj = static_cast<JSCallbackObject*>(slot.slotBase()); 407 408 JSObjectRef thisRef = toRef(thisObj); 409 JSCharBufferRef propertyNameRef = toRef(propertyName.ustring().rep()); 410 411 for (JSClassRef jsClass = thisObj->m_class; jsClass; jsClass = jsClass->parent) { 412 JSValueRef returnValue; 413 414 if (JSGetPropertyCallback getPropertyCallback = jsClass->callbacks.getProperty) 415 if (getPropertyCallback(toRef(exec), thisRef, propertyNameRef, &returnValue)) 296 416 return toJS(returnValue); 297 }298 }299 417 } 300 418 -
trunk/JavaScriptCore/API/JSCallbackObject.h
r14951 r15133 37 37 { 38 38 public: 39 JSCallbackObject( const JSObjectCallbacks* callbacks);40 JSCallbackObject( const JSObjectCallbacks* callbacks, JSObject* prototype);39 JSCallbackObject(JSClassRef globalObjectClass); 40 JSCallbackObject(JSClassRef globalObjectClass, JSObject* prototype); 41 41 virtual ~JSCallbackObject(); 42 42 … … 69 69 virtual const ClassInfo *classInfo() const { return &info; } 70 70 static const ClassInfo info; 71 72 bool inherits(JSClassRef) const; 71 73 72 74 private: … … 74 76 JSCallbackObject(const JSCallbackObject&); 75 77 78 void init(JSClassRef jsClass); 79 76 80 static JSValue* cachedValueGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&); 81 static JSValue* staticValueGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot& slot); 82 static JSValue* staticFunctionGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot& slot); 77 83 static JSValue* callbackGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&); 84 78 85 void* m_privateData; 79 JS ObjectCallbacks m_callbacks;86 JSClassRef m_class; 80 87 }; 81 88 -
trunk/JavaScriptCore/API/JSCharBufferRef.cpp
r14951 r15133 28 28 #include "JSCharBufferRef.h" 29 29 30 #include < JavaScriptCore/JSLock.h>31 #include < JavaScriptCore/JSType.h>32 #include < JavaScriptCore/internal.h>33 #include < JavaScriptCore/operations.h>34 #include < JavaScriptCore/ustring.h>35 #include < JavaScriptCore/value.h>30 #include <kjs/JSLock.h> 31 #include <kjs/JSType.h> 32 #include <kjs/internal.h> 33 #include <kjs/operations.h> 34 #include <kjs/ustring.h> 35 #include <kjs/value.h> 36 36 37 37 using namespace KJS; -
trunk/JavaScriptCore/API/JSContextRef.cpp
r14951 r15133 35 35 using namespace KJS; 36 36 37 JSContextRef JSContextCreate( const JSObjectCallbacks* globalObjectCallbacks, JSObjectRef globalObjectPrototype)37 JSContextRef JSContextCreate(JSClassRef globalObjectClass, JSObjectRef globalObjectPrototype) 38 38 { 39 39 JSLock lock; … … 42 42 43 43 JSObject* globalObject; 44 if (globalObjectCallbacks == &kJSObjectCallbacksNone) // slightly more efficient 44 if (globalObjectClass) { 45 if (jsPrototype) 46 globalObject = new JSCallbackObject(globalObjectClass, jsPrototype); 47 else 48 globalObject = new JSCallbackObject(globalObjectClass); 49 } else { 50 // creates a slightly more efficient object 45 51 if (jsPrototype) 46 52 globalObject = new JSObject(jsPrototype); 47 53 else 48 54 globalObject = new JSObject(); 49 else if (jsPrototype) 50 globalObject = new JSCallbackObject(globalObjectCallbacks, jsPrototype); 51 else 52 globalObject = new JSCallbackObject(globalObjectCallbacks); 55 } 53 56 54 57 Interpreter* interpreter = new Interpreter(globalObject); // adds the built-in object prototype to the global object … … 78 81 Completion completion = exec->dynamicInterpreter()->evaluate(UString(sourceURLRep), startingLineNumber, UString(scriptRep), jsThisValue); 79 82 80 *returnValue = toRef(completion.value()); 83 if (returnValue) 84 *returnValue = completion.value() ? toRef(completion.value()) : toRef(jsUndefined()); 85 81 86 return completion.complType() != Throw; 82 87 } -
trunk/JavaScriptCore/API/JSContextRef.h
r14951 r15133 35 35 #endif 36 36 37 JSContextRef JSContextCreate( const JSObjectCallbacks* globalObjectCallbacks, JSObjectRef globalObjectPrototype);37 JSContextRef JSContextCreate(JSClassRef globalObjectClass, JSObjectRef globalObjectPrototype); 38 38 void JSContextDestroy(JSContextRef context); 39 39 -
trunk/JavaScriptCore/API/JSObjectRef.cpp
r15043 r15133 28 28 #include "JSValueRef.h" 29 29 #include "JSObjectRef.h" 30 #include "JSCallbackConstructor.h" 31 #include "JSCallbackFunction.h" 30 32 #include "JSCallbackObject.h" 31 33 … … 36 38 37 39 using namespace KJS; 38 39 const JSObjectCallbacks kJSObjectCallbacksNone = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };40 40 41 41 JSObjectRef JSValueToObject(JSContextRef context, JSValueRef value) … … 52 52 } 53 53 54 JSObjectRef JSObjectMake(JSContextRef context, const JSObjectCallbacks* callbacks, JSObjectRef prototype)54 JSObjectRef JSObjectMake(JSContextRef context, JSClassRef jsClass, JSObjectRef prototype) 55 55 { 56 56 JSLock lock; … … 62 62 jsPrototype = exec->lexicalInterpreter()->builtinObjectPrototype(); 63 63 64 if ( callbacks == &kJSObjectCallbacksNone)64 if (!jsClass) 65 65 return toRef(new JSObject(jsPrototype)); // slightly more efficient 66 66 else 67 return toRef(new JSCallbackObject( callbacks, jsPrototype));67 return toRef(new JSCallbackObject(jsClass, jsPrototype)); 68 68 } 69 69 70 70 JSObjectRef JSFunctionMake(JSContextRef context, JSCallAsFunctionCallback callback) 71 71 { 72 ExecState* exec = toJS(context); 73 JSObjectCallbacks callbacks = kJSObjectCallbacksNone; 74 callbacks.callAsFunction = callback; 75 76 return JSObjectMake(context, &callbacks, toRef(exec->lexicalInterpreter()->builtinFunctionPrototype())); 72 JSLock lock; 73 ExecState* exec = toJS(context); 74 return toRef(new JSCallbackFunction(exec, callback)); 77 75 } 78 76 79 77 JSObjectRef JSConstructorMake(JSContextRef context, JSCallAsConstructorCallback callback) 80 78 { 81 ExecState* exec = toJS(context); 82 JSObjectCallbacks callbacks = kJSObjectCallbacksNone; 83 callbacks.callAsConstructor = callback; 84 85 return JSObjectMake(context, &callbacks, toRef(exec->lexicalInterpreter()->builtinObjectPrototype())); 79 JSLock lock; 80 ExecState* exec = toJS(context); 81 return toRef(new JSCallbackConstructor(exec, callback)); 86 82 } 87 83 … … 224 220 } 225 221 226 struct __JSProperty ListEnumerator227 { 228 __JSProperty ListEnumerator() : refCount(0), iterator(list.end())222 struct __JSPropertyEnumerator 223 { 224 __JSPropertyEnumerator() : refCount(0), iterator(list.end()) 229 225 { 230 226 } … … 235 231 }; 236 232 237 JSProperty ListEnumeratorRef JSObjectCreatePropertyEnumerator(JSContextRef context, JSObjectRef object)238 { 239 JSLock lock; 240 ExecState* exec = toJS(context); 241 JSObject* jsObject = toJS(object); 242 243 JSProperty ListEnumeratorRef enumerator = new __JSPropertyListEnumerator();233 JSPropertyEnumeratorRef JSObjectCreatePropertyEnumerator(JSContextRef context, JSObjectRef object) 234 { 235 JSLock lock; 236 ExecState* exec = toJS(context); 237 JSObject* jsObject = toJS(object); 238 239 JSPropertyEnumeratorRef enumerator = new __JSPropertyEnumerator(); 244 240 jsObject->getPropertyList(exec, enumerator->list); 245 241 enumerator->iterator = enumerator->list.begin(); 246 242 247 return enumerator;248 } 249 250 JSCharBufferRef JSPropertyEnumeratorGetNext(JSContextRef context, JSProperty ListEnumeratorRef enumerator)243 return JSPropertyEnumeratorRetain(enumerator); 244 } 245 246 JSCharBufferRef JSPropertyEnumeratorGetNext(JSContextRef context, JSPropertyEnumeratorRef enumerator) 251 247 { 252 248 ExecState* exec = toJS(context); … … 259 255 } 260 256 261 JSProperty ListEnumeratorRef JSPropertyEnumeratorRetain(JSPropertyListEnumeratorRef enumerator)257 JSPropertyEnumeratorRef JSPropertyEnumeratorRetain(JSPropertyEnumeratorRef enumerator) 262 258 { 263 259 ++enumerator->refCount; … … 265 261 } 266 262 267 void JSPropertyEnumeratorRelease(JSProperty ListEnumeratorRef enumerator)263 void JSPropertyEnumeratorRelease(JSPropertyEnumeratorRef enumerator) 268 264 { 269 265 if (--enumerator->refCount == 0) -
trunk/JavaScriptCore/API/JSObjectRef.h
r15043 r15133 29 29 30 30 #include "JSBase.h" 31 #include "JSValueRef.h" 31 32 32 33 #ifdef __cplusplus … … 48 49 (*JSFinalizeCallback) (JSObjectRef object); 49 50 50 typedef JSCharBufferRef51 (*JSCopyDescriptionCallback) (JSObjectRef object);52 53 51 typedef bool 54 52 (*JSHasPropertyCallback) (JSObjectRef object, JSCharBufferRef propertyName); 55 53 56 54 typedef bool 57 (*JSGetPropertyCallback) (JS ObjectRef object, JSCharBufferRef propertyName, JSValueRef* returnValue);55 (*JSGetPropertyCallback) (JSContextRef context, JSObjectRef object, JSCharBufferRef propertyName, JSValueRef* returnValue); 58 56 59 57 typedef bool … … 77 75 typedef struct __JSObjectCallbacks { 78 76 int version; // current (and only) version is 0 79 struct __JSObjectCallbacks* parentCallbacks; // pass NULL for the default object callbacks80 77 JSInitializeCallback initialize; 81 78 JSFinalizeCallback finalize; 82 JSCopyDescriptionCallback copyDescription;83 79 JSHasPropertyCallback hasProperty; 84 80 JSGetPropertyCallback getProperty; … … 93 89 extern const JSObjectCallbacks kJSObjectCallbacksNone; 94 90 91 typedef struct { 92 const char* const name; // FIXME: convert UTF8 93 JSGetPropertyCallback getProperty; 94 JSSetPropertyCallback setProperty; 95 JSPropertyAttributes attributes; 96 } JSStaticValue; 97 98 typedef struct { 99 const char* const name; // FIXME: convert UTF8 100 JSCallAsFunctionCallback callAsFunction; 101 JSPropertyAttributes attributes; 102 } JSStaticFunction; 103 104 JSClassRef JSClassCreate(JSContextRef context, JSStaticValue* staticValues, JSStaticFunction* staticFunctions, const JSObjectCallbacks* callbacks, JSClassRef parentClass); 105 void JSClassRelease(JSClassRef jsClass); 106 JSClassRef JSClassRetain(JSClassRef jsClass); 107 95 108 // pass NULL as prototype to get the built-in object prototype 96 JSObjectRef JSObjectMake(JSContextRef context, const JSObjectCallbacks* callbacks, JSObjectRef prototype);109 JSObjectRef JSObjectMake(JSContextRef context, JSClassRef jsClass, JSObjectRef prototype); 97 110 98 111 // Will be assigned the built-in function prototype … … 120 133 121 134 // Used for enumerating the names of an object's properties like a for...in loop would 122 JSProperty ListEnumeratorRef JSObjectCreatePropertyEnumerator(JSContextRef context, JSObjectRef object);123 JSProperty ListEnumeratorRef JSPropertyEnumeratorRetain(JSPropertyListEnumeratorRef enumerator);124 void JSPropertyEnumeratorRelease(JSProperty ListEnumeratorRef enumerator);125 JSCharBufferRef JSPropertyEnumeratorGetNext(JSContextRef context, JSProperty ListEnumeratorRef enumerator);135 JSPropertyEnumeratorRef JSObjectCreatePropertyEnumerator(JSContextRef context, JSObjectRef object); 136 JSPropertyEnumeratorRef JSPropertyEnumeratorRetain(JSPropertyEnumeratorRef enumerator); 137 void JSPropertyEnumeratorRelease(JSPropertyEnumeratorRef enumerator); 138 JSCharBufferRef JSPropertyEnumeratorGetNext(JSContextRef context, JSPropertyEnumeratorRef enumerator); 126 139 127 140 // Used for adding property names to a for...in enumeration -
trunk/JavaScriptCore/API/JSValueRef.cpp
r14951 r15133 25 25 */ 26 26 27 #include "APICast.h" 28 #include "JSCallbackObject.h" 27 29 #include "JSValueRef.h" 28 #include "APICast.h" 29 #include < JavaScriptCore/JSType.h>30 #include < JavaScriptCore/internal.h>31 #include < JavaScriptCore/operations.h>32 #include < JavaScriptCore/protect.h>33 #include < JavaScriptCore/ustring.h>34 #include < JavaScriptCore/value.h>30 31 #include <kjs/JSType.h> 32 #include <kjs/internal.h> 33 #include <kjs/operations.h> 34 #include <kjs/protect.h> 35 #include <kjs/ustring.h> 36 #include <kjs/value.h> 35 37 36 38 #include <wtf/Assertions.h> … … 98 100 } 99 101 102 bool JSValueIsObjectOfClass(JSValueRef value, JSClassRef jsClass) 103 { 104 JSValue* jsValue = toJS(value); 105 106 if (JSObject* o = jsValue->getObject()) 107 if (o->inherits(&JSCallbackObject::info)) 108 return static_cast<JSCallbackObject*>(o)->inherits(jsClass); 109 return false; 110 } 111 100 112 bool JSValueIsEqual(JSContextRef context, JSValueRef a, JSValueRef b) 101 113 { … … 124 136 } 125 137 138 bool JSValueIsInstanceOf(JSContextRef context, JSValueRef value, JSObjectRef object) 139 { 140 ExecState* exec = toJS(context); 141 JSValue* jsValue = toJS(value); 142 JSObject* jsObject = toJS(object); 143 if (!jsObject->implementsHasInstance()) 144 return false; 145 bool result = jsObject->hasInstance(exec, jsValue); 146 if (exec->hadException()) 147 exec->clearException(); 148 return result; 149 } 150 126 151 JSValueRef JSUndefinedMake() 127 152 { -
trunk/JavaScriptCore/API/JSValueRef.h
r15096 r15133 108 108 */ 109 109 bool JSValueIsObject(JSValueRef value); 110 bool JSValueIsObjectOfClass(JSValueRef value, JSClassRef jsClass); 110 111 111 112 // Comparing values … … 140 141 @result true if value is an instance of object 141 142 */ 142 bool JSValueIsInstanceOf(JS ValueRef value, JSObjectRef object);143 bool JSValueIsInstanceOf(JSContextRef context, JSValueRef value, JSObjectRef object); 143 144 144 145 // Creating values -
trunk/JavaScriptCore/API/minidom.c
r14951 r15133 26 26 27 27 #include "JavaScriptCore.h" 28 #include "JSNode.h" 28 29 #include <wtf/UnusedParam.h> 30 31 static char* createStringWithContentsOfFile(const char* fileName); 32 static JSValueRef print(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argc, JSValueRef argv[]); 29 33 30 34 int main(int argc, char* argv[]) … … 33 37 UNUSED_PARAM(argv); 34 38 39 JSContextRef context = JSContextCreate(NULL, NULL); 40 JSObjectRef globalObject = JSContextGetGlobalObject(context); 41 42 JSCharBufferRef printBuf = JSCharBufferCreateUTF8("print"); 43 JSObjectSetProperty(context, globalObject, printBuf, JSFunctionMake(context, print), kJSPropertyAttributeNone); 44 JSCharBufferRelease(printBuf); 45 46 JSCharBufferRef nodeBuf = JSCharBufferCreateUTF8("Node"); 47 JSObjectSetProperty(context, globalObject, nodeBuf, JSConstructorMake(context, JSNode_construct), kJSPropertyAttributeNone); 48 JSCharBufferRelease(nodeBuf); 49 50 char* script = createStringWithContentsOfFile("minidom.js"); 51 JSCharBufferRef scriptBuf = JSCharBufferCreateUTF8(script); 52 JSValueRef result; 53 JSEvaluate(context, globalObject, scriptBuf, NULL, 0, &result); 54 55 if (JSValueIsUndefined(result)) 56 printf("PASS: Test script executed successfully.\n"); 57 else { 58 printf("FAIL: Test script returned unexcpected value:\n"); 59 JSCharBufferRef resultBuf = JSValueCopyStringValue(context, result); 60 CFStringRef resultCF = CFStringCreateWithJSCharBuffer(kCFAllocatorDefault, resultBuf); 61 CFShow(resultCF); 62 CFRelease(resultCF); 63 JSCharBufferRelease(resultBuf); 64 } 65 JSCharBufferRelease(scriptBuf); 66 free(script); 67 68 #if 0 // used for leak/finalize debugging 69 int i; 70 for (i = 0; i < 1000; i++) { 71 JSObjectRef o = JSObjectMake(context, NULL, NULL); 72 (void)o; 73 } 74 JSGCCollect(); 75 #endif 76 77 JSContextDestroy(context); 78 printf("PASS: Program exited normally.\n"); 35 79 return 0; 36 80 } 81 82 static JSValueRef print(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argc, JSValueRef argv[]) 83 { 84 if (argc > 0) { 85 JSCharBufferRef stringBuf = JSValueCopyStringValue(context, argv[0]); 86 size_t numChars = JSCharBufferGetMaxLengthUTF8(stringBuf); 87 char string[numChars]; 88 JSCharBufferGetCharactersUTF8(stringBuf, string, numChars); 89 printf("%s\n", string); 90 } 91 92 return JSUndefinedMake(); 93 } 94 95 static char* createStringWithContentsOfFile(const char* fileName) 96 { 97 char* buffer; 98 99 int buffer_size = 0; 100 int buffer_capacity = 1024; 101 buffer = (char*)malloc(buffer_capacity); 102 103 FILE* f = fopen(fileName, "r"); 104 if (!f) { 105 fprintf(stderr, "Could not open file: %s\n", fileName); 106 return 0; 107 } 108 109 while (!feof(f) && !ferror(f)) { 110 buffer_size += fread(buffer + buffer_size, 1, buffer_capacity - buffer_size, f); 111 if (buffer_size == buffer_capacity) { // guarantees space for trailing '\0' 112 buffer_capacity *= 2; 113 buffer = (char*)realloc(buffer, buffer_capacity); 114 assert(buffer); 115 } 116 117 assert(buffer_size < buffer_capacity); 118 } 119 fclose(f); 120 buffer[buffer_size] = '\0'; 121 122 return buffer; 123 } -
trunk/JavaScriptCore/API/minidom.js
r14951 r15133 26 26 27 27 // For browser-based testing 28 if ( window) {28 if (typeof window != 'undefined') { 29 29 /* 30 30 The methods and constructors below approximate what that the native host should provide … … 60 60 } 61 61 62 Node.prototype. tag= "Node";62 Node.prototype.nodeType = "Node"; 63 63 64 64 Node.prototype.appendChild = function(child) { … … 74 74 75 75 printSpaces(numSpaces); 76 print('<' + this. tag+ '>' + '\n');76 print('<' + this.nodeType + '>' + '\n'); 77 77 78 78 var childNodesLength = this.childNodes.length; … … 81 81 82 82 printSpaces(numSpaces); 83 print('</' + this. tag+ '>\n');83 print('</' + this.nodeType + '>\n'); 84 84 } 85 85 … … 91 91 TextNode.prototype = new Node(); 92 92 93 TextNode.prototype. tag= "Text";93 TextNode.prototype.nodeType = "Text"; 94 94 95 95 TextNode.prototype.serialize = function(numSpaces) { … … 105 105 Element.prototype = new Node(); 106 106 107 Element.prototype. tag= "Element";107 Element.prototype.nodeType = "Element"; 108 108 109 109 RootElement = function() … … 113 113 RootElement.prototype = new Element(); 114 114 115 RootElement.prototype. tag= "Root";115 RootElement.prototype.nodeType = "Root"; 116 116 117 117 HeroElement = function() … … 121 121 HeroElement.prototype = new Element(); 122 122 123 HeroElement.prototype. tag= "Hero";123 HeroElement.prototype.nodeType = "Hero"; 124 124 125 125 VillainElement = function() … … 129 129 VillainElement.prototype = new Element(); 130 130 131 VillainElement.prototype. tag= "Villain";131 VillainElement.prototype.nodeType = "Villain"; 132 132 133 133 NameElement = function() … … 137 137 NameElement.prototype = new Element(); 138 138 139 NameElement.prototype. tag= "Name";139 NameElement.prototype.nodeType = "Name"; 140 140 141 141 WeaponElement = function() … … 145 145 WeaponElement.prototype = new Element(); 146 146 147 WeaponElement.prototype. tag= "Weapon";147 WeaponElement.prototype.nodeType = "Weapon"; 148 148 149 149 Document = function() … … 168 168 function test() 169 169 { 170 print("Node is " + Node); 171 for (var p in Node) 172 print(p + ": " + Node[p]); 173 174 node = new Node(); 175 print("node is " + node); 176 for (var p in node) 177 print(p + ": " + node[p]); 178 179 child1 = new Node(); 180 child2 = new Node(); 181 child3 = new Node(); 182 183 node.appendChild(child1); 184 node.appendChild(child2); 185 186 for (var i = 0; i < node.childNodes.length + 1; i++) { 187 print("item " + i + ": " + node.childNodes.item(i)); 188 } 189 190 for (var i = 0; i < node.childNodes.length + 1; i++) { 191 print(i + ": " + node.childNodes[i]); 192 } 193 194 node.removeChild(child1); 195 node.replaceChild(child3, child2); 196 197 for (var i = 0; i < node.childNodes.length + 1; i++) { 198 print("item " + i + ": " + node.childNodes.item(i)); 199 } 200 201 for (var i = 0; i < node.childNodes.length + 1; i++) { 202 print(i + ": " + node.childNodes[i]); 203 } 204 205 try { 206 node.appendChild(null); 207 } catch(e) { 208 print("caught: " + e); 209 } 210 211 try { 212 var o = new Object(); 213 o.appendChild = node.appendChild; 214 o.appendChild(node); 215 } catch(e) { 216 print("caught: " + e); 217 } 218 219 try { 220 node.appendChild(); 221 } catch(e) { 222 print("caught: " + e); 223 } 224 225 /* 170 226 var element, name, weapon; 171 227 … … 173 229 document.appendChild(document.createElement('Root')); 174 230 175 / * Tank Girl */231 // Tank Girl 176 232 element = document.createElement('Hero'); 177 233 … … 195 251 196 252 197 / * Skeletor */253 // Skeletor 198 254 element = document.createElement('Villain'); 199 255 … … 212 268 document.firstChild.appendChild(element); 213 269 214 / * Serialize */270 // Serialize 215 271 document.serialize(); 272 */ 216 273 } 274 275 test(); -
trunk/JavaScriptCore/API/testapi.c
r15043 r15133 108 108 CFRelease(expectedValueAsCFString); 109 109 110 assert(memcmp(jsBuffer, cfBuffer, cfLength * sizeof(UniChar)) == 0); 111 assert(jsLength == (size_t)cfLength); 110 if (memcmp(jsBuffer, cfBuffer, cfLength * sizeof(UniChar)) != 0) 111 fprintf(stderr, "assertEqualsAsCharacters failed: jsBuffer != cfBuffer\n"); 112 113 if (jsLength != (size_t)cfLength) 114 fprintf(stderr, "assertEqualsAsCharacters failed: jsLength(%ld) != cfLength(%ld)\n", jsLength, cfLength); 112 115 113 116 JSCharBufferRelease(valueAsString); … … 125 128 UNUSED_PARAM(object); 126 129 didInitialize = true; 127 }128 129 static JSCharBufferRef MyObject_copyDescription(JSObjectRef object)130 {131 UNUSED_PARAM(object);132 return JSCharBufferCreateUTF8("MyObject");133 130 } 134 131 … … 146 143 } 147 144 148 static bool MyObject_getProperty(JSObjectRef object, JSCharBufferRef propertyName, JSValueRef* returnValue) 149 { 145 static bool MyObject_getProperty(JSContextRef context, JSObjectRef object, JSCharBufferRef propertyName, JSValueRef* returnValue) 146 { 147 UNUSED_PARAM(context); 150 148 UNUSED_PARAM(object); 151 149 … … 252 250 } 253 251 254 JSObjectCallbacks MyObjectCallbacks = { 255 0, 252 JSObjectCallbacks MyObject_callbacks = { 256 253 0, 257 254 &MyObject_initialize, 258 255 &MyObject_finalize, 259 &MyObject_copyDescription,260 256 &MyObject_hasProperty, 261 257 &MyObject_getProperty, … … 268 264 }; 269 265 266 static JSClassRef MyObject_class(JSContextRef context) 267 { 268 static JSClassRef jsClass; 269 if (!jsClass) { 270 jsClass = JSClassCreate(context, NULL, NULL, &MyObject_callbacks, NULL); 271 } 272 273 return jsClass; 274 } 275 270 276 static JSValueRef print_callAsFunction(JSContextRef context, JSObjectRef functionObject, JSObjectRef thisObject, size_t argc, JSValueRef argv[]) 271 277 { … … 289 295 UNUSED_PARAM(constructorObject); 290 296 291 JSObjectRef result = JSObjectMake(context, &kJSObjectCallbacksNone, 0);297 JSObjectRef result = JSObjectMake(context, NULL, 0); 292 298 if (argc > 0) { 293 299 JSCharBufferRef valueBuffer = JSCharBufferCreateUTF8("value"); … … 306 312 UNUSED_PARAM(argv); 307 313 308 context = JSContextCreate( &kJSObjectCallbacksNone, 0);314 context = JSContextCreate(NULL, NULL); 309 315 310 316 JSValueRef jsUndefined = JSUndefinedMake(); … … 468 474 // GDB says jsGlobalValue actually ends up being marked by the stack crawl, so this 469 475 // exercise is a bit academic. Not sure why that happens, or how to avoid it. 470 jsGlobalValue = JSObjectMake(context, &kJSObjectCallbacksNone, 0);476 jsGlobalValue = JSObjectMake(context, NULL, 0); 471 477 JSGCCollect(); 472 478 assert(JSValueIsObject(jsGlobalValue)); … … 507 513 JSCharBufferRelease(badSyntaxBuf); 508 514 509 JSObjectRef myObject = JSObjectMake(context, &MyObjectCallbacks, 0); 515 JSCharBufferRef arrayBuf = JSCharBufferCreateUTF8("Array"); 516 JSValueRef v; 517 assert(JSObjectGetProperty(context, globalObject, arrayBuf, &v)); 518 JSObjectRef arrayConstructor = JSValueToObject(context, v); 519 JSCharBufferRelease(arrayBuf); 520 JSValueRef arrayObject; 521 assert(JSObjectCallAsConstructor(context, arrayConstructor, 0, NULL, &arrayObject)); 522 assert(JSValueIsInstanceOf(context, arrayObject, arrayConstructor)); 523 assert(!JSValueIsInstanceOf(context, JSNullMake(), arrayConstructor)); 524 525 JSObjectRef myObject = JSObjectMake(context, MyObject_class(context), NULL); 510 526 assert(didInitialize); 511 527 JSCharBufferRef myObjectBuf = JSCharBufferCreateUTF8("MyObject"); … … 538 554 539 555 // Allocate a few dummies so that at least one will be collected 540 JSObjectMake(context, &MyObjectCallbacks, 0);541 JSObjectMake(context, &MyObjectCallbacks, 0);556 JSObjectMake(context, MyObject_class(context), 0); 557 JSObjectMake(context, MyObject_class(context), 0); 542 558 JSGCCollect(); 543 559 assert(didFinalize); 544 560 545 561 JSContextDestroy(context); 546 printf("PASS: All assertions passed.\n");562 printf("PASS: Program exited normally.\n"); 547 563 return 0; 548 564 } -
trunk/JavaScriptCore/API/testapi.js
r15043 r15133 34 34 } 35 35 36 if (evalA == b || isNaN(evalA) && isNaN(b))36 if (evalA == b || isNaN(evalA) && typeof evalA == 'number' && isNaN(b) && typeof b == 'number') 37 37 print("PASS: " + a + " should be " + b + " and is.", "green"); 38 38 else … … 75 75 shouldBe("MyObject ? 1 : 0", 0); // toBoolean 76 76 shouldBe("+MyObject", 1); // toNumber 77 shouldBe("(MyObject + '').indexOf('MyObject') != -1", true); // toString77 shouldBe("(MyObject.toString())", "[object CallbackObject]"); // toString 78 78 shouldBe("MyObject - 0", NaN); // toPrimitive 79 79 -
trunk/JavaScriptCore/ChangeLog
r15125 r15133 1 2006-06-29 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Maciej. 4 5 - Phase 2 in the JS API. 6 7 - Added support for specifying static tables of values -- this should 8 obviate the need for using complicated callbacks for most lookups. 9 10 - API objects are now created with classes (JSClassRef) -- in order to support 11 static values, and in order to prevent API objects from storing their 12 data inline, and thus falling into the oversized (read: slow and prone to 13 giving Maciej the frowny face) heap. 14 15 - Added two specialized JSObject subclasses -- JSCallbackFunction and JSCallbackConstructor -- 16 to allow JSFunctionMake and JSConstructorMake to continue to work with 17 the new class model. Another solution to this problem would be to create 18 a custom class object for each function and constructor you make. This 19 solution is more code but also more efficient. 20 21 - Substantially beefed up the minidom example to demonstrate and test a 22 lot of these techniques. Its output is still pretty haphazard, though. 23 24 - Gave the <kjs/ preface to some includes -- I'm told this matters to 25 building on some versions of Linux. 26 27 - Implemented JSValueIsInstanceOf and JSValueIsObjectOfClass 28 29 - Removed GetDescription callback. Something in the class datastructure 30 should take care of this. 31 32 * API/JSBase.h: 33 * API/JSCallbackConstructor.cpp: Added. 34 (KJS::): 35 (KJS::JSCallbackConstructor::JSCallbackConstructor): 36 (KJS::JSCallbackConstructor::implementsConstruct): 37 (KJS::JSCallbackConstructor::construct): 38 (KJS::JSCallbackConstructor::setPrivate): 39 (KJS::JSCallbackConstructor::getPrivate): 40 * API/JSCallbackConstructor.h: Added. 41 (KJS::JSCallbackConstructor::classInfo): 42 * API/JSCallbackFunction.cpp: Added. 43 (KJS::): 44 (KJS::JSCallbackFunction::JSCallbackFunction): 45 (KJS::JSCallbackFunction::implementsCall): 46 (KJS::JSCallbackFunction::callAsFunction): 47 (KJS::JSCallbackFunction::setPrivate): 48 (KJS::JSCallbackFunction::getPrivate): 49 * API/JSCallbackFunction.h: Added. 50 (KJS::JSCallbackFunction::classInfo): 51 * API/JSCallbackObject.cpp: 52 (KJS::): 53 (KJS::JSCallbackObject::JSCallbackObject): 54 (KJS::JSCallbackObject::init): 55 (KJS::JSCallbackObject::~JSCallbackObject): 56 (KJS::JSCallbackObject::className): 57 (KJS::JSCallbackObject::getOwnPropertySlot): 58 (KJS::JSCallbackObject::put): 59 (KJS::JSCallbackObject::deleteProperty): 60 (KJS::JSCallbackObject::implementsConstruct): 61 (KJS::JSCallbackObject::construct): 62 (KJS::JSCallbackObject::implementsCall): 63 (KJS::JSCallbackObject::callAsFunction): 64 (KJS::JSCallbackObject::getPropertyList): 65 (KJS::JSCallbackObject::toBoolean): 66 (KJS::JSCallbackObject::toNumber): 67 (KJS::JSCallbackObject::toString): 68 (KJS::JSCallbackObject::inherits): 69 (KJS::JSCallbackObject::staticValueGetter): 70 (KJS::JSCallbackObject::staticFunctionGetter): 71 (KJS::JSCallbackObject::callbackGetter): 72 * API/JSCallbackObject.h: 73 * API/JSCharBufferRef.cpp: 74 * API/JSClassRef.cpp: Added. 75 (JSClassCreate): 76 (JSClassRetain): 77 (JSClassRelease): 78 * API/JSClassRef.h: Added. 79 (StaticValueEntry::StaticValueEntry): 80 (StaticFunctionEntry::StaticFunctionEntry): 81 (__JSClass::__JSClass): 82 * API/JSContextRef.cpp: 83 (JSContextCreate): 84 (JSEvaluate): 85 * API/JSContextRef.h: 86 * API/JSNode.c: Added. 87 (JSNodePrototype_appendChild): 88 (JSNodePrototype_removeChild): 89 (JSNodePrototype_replaceChild): 90 (JSNodePrototype_class): 91 (JSNode_getNodeType): 92 (JSNode_getChildNodes): 93 (JSNode_getFirstChild): 94 (JSNode_finalize): 95 (JSNode_class): 96 (JSNode_prototype): 97 (JSNode_new): 98 (JSNode_construct): 99 * API/JSNode.h: Added. 100 * API/JSNodeList.c: Added. 101 (JSNodeListPrototype_item): 102 (JSNodeListPrototype_class): 103 (JSNodeList_length): 104 (JSNodeList_getProperty): 105 (JSNodeList_finalize): 106 (JSNodeList_class): 107 (JSNodeList_prototype): 108 (JSNodeList_new): 109 * API/JSNodeList.h: Added. 110 * API/JSObjectRef.cpp: 111 (JSObjectMake): 112 (JSFunctionMake): 113 (JSConstructorMake): 114 (__JSPropertyEnumerator::__JSPropertyEnumerator): 115 (JSObjectCreatePropertyEnumerator): 116 (JSPropertyEnumeratorGetNext): 117 (JSPropertyEnumeratorRetain): 118 (JSPropertyEnumeratorRelease): 119 * API/JSObjectRef.h: 120 (__JSObjectCallbacks::): 121 * API/JSValueRef.cpp: 122 (JSValueIsObjectOfClass): 123 (JSValueIsInstanceOf): 124 * API/JSValueRef.h: 125 * API/Node.c: Added. 126 (Node_new): 127 (Node_appendChild): 128 (Node_removeChild): 129 (Node_replaceChild): 130 (Node_ref): 131 (Node_deref): 132 * API/Node.h: Added. 133 * API/NodeList.c: Added. 134 (NodeList_new): 135 (NodeList_length): 136 (NodeList_item): 137 (NodeList_ref): 138 (NodeList_deref): 139 * API/NodeList.h: Added. 140 * API/minidom.c: 141 (main): 142 (print): 143 (createStringWithContentsOfFile): 144 * API/minidom.js: 145 * API/testapi.c: 146 (assertEqualsAsCharacters): 147 (MyObject_getProperty): 148 (MyObject_class): 149 (myConstructor_callAsConstructor): 150 (main): 151 * API/testapi.js: 152 * JavaScriptCore.xcodeproj/project.pbxproj: 153 1 154 2006-06-26 Kevin Ollivier <kevino@theolliviers.com> 2 155 -
trunk/JavaScriptCore/JavaScriptCore.exp
r15064 r15133 15 15 _JSCharBufferRelease 16 16 _JSCheckSyntax 17 _JSClassCreate 17 18 _JSConstructorMake 18 19 _JSContextClearException … … 26 27 _JSFunctionMake 27 28 _JSGCCollect 29 _JSGCProtect 28 30 _JSGCUnprotect 29 31 _JSNullMake 30 32 _JSNumberMake 33 _JSObjectCallAsConstructor 34 _JSObjectGetPrivate 35 _JSObjectGetProperty 31 36 _JSObjectMake 37 _JSObjectSetPrivate 32 38 _JSObjectSetProperty 33 39 _JSPropertyListAdd … … 37 43 _JSValueGetType 38 44 _JSValueIsEqual 45 _JSValueIsInstanceOf 39 46 _JSValueIsObject 47 _JSValueIsObjectOfClass 40 48 _JSValueIsStrictEqual 41 49 _JSValueIsUndefined -
trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r15085 r15133 38 38 142711390A460BBB0080EEEA /* JSBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 142711380A460BBB0080EEEA /* JSBase.h */; settings = {ATTRIBUTES = (Private, ); }; }; 39 39 143A97E60A4A06E200456B66 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6560A4CF04B3B3E7008AE952 /* CoreFoundation.framework */; }; 40 1440057F0A5335640005F061 /* JSNode.c in Sources */ = {isa = PBXBuildFile; fileRef = 1440F6420A4F8B6A0005F061 /* JSNode.c */; }; 41 144005CB0A5338D10005F061 /* JSNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1440F6410A4F8B6A0005F061 /* JSNode.h */; }; 42 144005CC0A5338F80005F061 /* Node.h in Headers */ = {isa = PBXBuildFile; fileRef = 1440051F0A531D3B0005F061 /* Node.h */; }; 43 1440063F0A53598A0005F061 /* Node.c in Sources */ = {isa = PBXBuildFile; fileRef = 144005200A531D3B0005F061 /* Node.c */; }; 44 1440074A0A536CC20005F061 /* NodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = 144007480A536CC20005F061 /* NodeList.h */; }; 45 1440074B0A536CC20005F061 /* NodeList.c in Sources */ = {isa = PBXBuildFile; fileRef = 144007490A536CC20005F061 /* NodeList.c */; }; 46 144007570A5370D20005F061 /* JSNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = 144007550A5370D20005F061 /* JSNodeList.h */; }; 47 144007580A5370D20005F061 /* JSNodeList.c in Sources */ = {isa = PBXBuildFile; fileRef = 144007560A5370D20005F061 /* JSNodeList.c */; }; 40 48 1440F6100A4F85670005F061 /* testapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 14BD5A2D0A3E91F600BAF59C /* testapi.c */; }; 49 1440F8910A508B100005F061 /* JSCallbackFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 1440F88F0A508B100005F061 /* JSCallbackFunction.h */; }; 50 1440F8920A508B100005F061 /* JSCallbackFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1440F8900A508B100005F061 /* JSCallbackFunction.cpp */; }; 51 1440F8AE0A508D200005F061 /* JSCallbackConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 1440F8AC0A508D200005F061 /* JSCallbackConstructor.h */; }; 52 1440F8AF0A508D200005F061 /* JSCallbackConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1440F8AD0A508D200005F061 /* JSCallbackConstructor.cpp */; }; 53 1440FCE30A51E46B0005F061 /* JSClassRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1440FCE10A51E46B0005F061 /* JSClassRef.h */; }; 54 1440FCE40A51E46B0005F061 /* JSClassRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1440FCE20A51E46B0005F061 /* JSClassRef.cpp */; }; 41 55 14760864099C633800437128 /* JSImmediate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14760863099C633800437128 /* JSImmediate.cpp */; }; 42 56 1482B6EB0A4300B300517CFC /* JSValueRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482B6EA0A4300B300517CFC /* JSValueRef.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 52 66 14ABDF5F0A437FEF00ECCA01 /* JSCallbackObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 14ABDF5D0A437FEF00ECCA01 /* JSCallbackObject.h */; }; 53 67 14ABDF600A437FEF00ECCA01 /* JSCallbackObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14ABDF5E0A437FEF00ECCA01 /* JSCallbackObject.cpp */; }; 68 14B8EC720A5652090062BE54 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6560A4CF04B3B3E7008AE952 /* CoreFoundation.framework */; }; 54 69 14BD534C0A3E0AEA00BAF59C /* SavedBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 14BD534A0A3E0AEA00BAF59C /* SavedBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; }; 55 70 14BD53F50A3E12D800BAF59C /* ExecState.h in Headers */ = {isa = PBXBuildFile; fileRef = 14BD53F30A3E12D800BAF59C /* ExecState.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 254 269 /* End PBXBuildFile section */ 255 270 271 /* Begin PBXBuildStyle section */ 272 14C137130A560E70006CA9AF /* Development */ = { 273 isa = PBXBuildStyle; 274 buildSettings = { 275 COPY_PHASE_STRIP = NO; 276 }; 277 name = Development; 278 }; 279 14C137140A560E70006CA9AF /* Deployment */ = { 280 isa = PBXBuildStyle; 281 buildSettings = { 282 COPY_PHASE_STRIP = YES; 283 }; 284 name = Deployment; 285 }; 286 /* End PBXBuildStyle section */ 287 256 288 /* Begin PBXContainerItemProxy section */ 257 289 141211350A48796100480255 /* PBXContainerItemProxy */ = { … … 325 357 141211200A48793C00480255 /* minidom */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = minidom; sourceTree = BUILT_PRODUCTS_DIR; }; 326 358 142711380A460BBB0080EEEA /* JSBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBase.h; sourceTree = "<group>"; }; 359 1440051F0A531D3B0005F061 /* Node.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Node.h; sourceTree = "<group>"; }; 360 144005200A531D3B0005F061 /* Node.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Node.c; sourceTree = "<group>"; }; 361 144007480A536CC20005F061 /* NodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeList.h; sourceTree = "<group>"; }; 362 144007490A536CC20005F061 /* NodeList.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = NodeList.c; sourceTree = "<group>"; }; 363 144007550A5370D20005F061 /* JSNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNodeList.h; sourceTree = "<group>"; }; 364 144007560A5370D20005F061 /* JSNodeList.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = JSNodeList.c; sourceTree = "<group>"; }; 365 1440F6410A4F8B6A0005F061 /* JSNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNode.h; sourceTree = "<group>"; }; 366 1440F6420A4F8B6A0005F061 /* JSNode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = JSNode.c; sourceTree = "<group>"; }; 367 1440F88F0A508B100005F061 /* JSCallbackFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackFunction.h; sourceTree = "<group>"; }; 368 1440F8900A508B100005F061 /* JSCallbackFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCallbackFunction.cpp; sourceTree = "<group>"; }; 369 1440F8AC0A508D200005F061 /* JSCallbackConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackConstructor.h; sourceTree = "<group>"; }; 370 1440F8AD0A508D200005F061 /* JSCallbackConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCallbackConstructor.cpp; sourceTree = "<group>"; }; 371 1440FCE10A51E46B0005F061 /* JSClassRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSClassRef.h; sourceTree = "<group>"; }; 372 1440FCE20A51E46B0005F061 /* JSClassRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSClassRef.cpp; sourceTree = "<group>"; }; 327 373 14760863099C633800437128 /* JSImmediate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSImmediate.cpp; sourceTree = "<group>"; }; 328 374 1482B6EA0A4300B300517CFC /* JSValueRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSValueRef.h; sourceTree = "<group>"; }; … … 338 384 14ABDF5D0A437FEF00ECCA01 /* JSCallbackObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackObject.h; sourceTree = "<group>"; }; 339 385 14ABDF5E0A437FEF00ECCA01 /* JSCallbackObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCallbackObject.cpp; sourceTree = "<group>"; }; 386 14B8ECA60A5653980062BE54 /* JavaScriptCore.exp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.exp; sourceTree = "<group>"; }; 340 387 14BD534A0A3E0AEA00BAF59C /* SavedBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SavedBuiltins.h; sourceTree = "<group>"; }; 341 388 14BD53F30A3E12D800BAF59C /* ExecState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExecState.h; sourceTree = "<group>"; }; … … 350 397 14F137580A3A727E00F26F90 /* Context.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Context.cpp; sourceTree = "<group>"; }; 351 398 14F137820A3A765B00F26F90 /* context.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = context.h; sourceTree = "<group>"; }; 352 45E12D8806A49B0F00E9DF84 /* testkjs.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; path =testkjs.cpp; sourceTree = "<group>"; tabWidth = 8; };399 45E12D8806A49B0F00E9DF84 /* testkjs.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = testkjs.cpp; path = ../kjs/testkjs.cpp; sourceTree = "<group>"; tabWidth = 8; }; 353 400 5114F47B05E4426200D1BBBD /* runtime_root.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; name = runtime_root.cpp; path = bindings/runtime_root.cpp; sourceTree = "<group>"; tabWidth = 8; }; 354 401 5114F47C05E4426200D1BBBD /* runtime_root.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; name = runtime_root.h; path = bindings/runtime_root.h; sourceTree = "<group>"; tabWidth = 8; }; … … 554 601 buildActionMask = 2147483647; 555 602 files = ( 603 14B8EC720A5652090062BE54 /* CoreFoundation.framework in Frameworks */, 556 604 141211310A48794D00480255 /* JavaScriptCore.framework in Frameworks */, 557 605 ); … … 612 660 children = ( 613 661 937B63CC09E766D200A671DD /* DerivedSources.make */, 662 14B8ECA60A5653980062BE54 /* JavaScriptCore.exp */, 663 141211000A48772600480255 /* tests */, 614 664 1432EBD70A34CAD400717B9F /* API */, 615 665 65417200039E01BA0058BFEB /* kjs */, … … 641 691 isa = PBXGroup; 642 692 children = ( 693 144005170A531CB50005F061 /* minidom */, 643 694 14BD5A2D0A3E91F600BAF59C /* testapi.c */, 644 695 14D857740A4696C80032146C /* testapi.js */, 645 141211020A48780900480255 /* minidom.c */, 646 1412110D0A48788700480255 /* minidom.js */, 696 45E12D8806A49B0F00E9DF84 /* testkjs.cpp */, 647 697 ); 648 698 name = tests; 699 path = API; 649 700 sourceTree = "<group>"; 650 701 }; … … 655 706 14BD5A2F0A3E91F600BAF59C /* JavaScriptCore.h */, 656 707 142711380A460BBB0080EEEA /* JSBase.h */, 708 1440F8AD0A508D200005F061 /* JSCallbackConstructor.cpp */, 709 1440F8AC0A508D200005F061 /* JSCallbackConstructor.h */, 710 1440F8900A508B100005F061 /* JSCallbackFunction.cpp */, 711 1440F88F0A508B100005F061 /* JSCallbackFunction.h */, 657 712 14ABDF5E0A437FEF00ECCA01 /* JSCallbackObject.cpp */, 658 713 14ABDF5D0A437FEF00ECCA01 /* JSCallbackObject.h */, 659 714 1482B74C0A43032800517CFC /* JSCharBufferRef.cpp */, 660 715 1482B74B0A43032800517CFC /* JSCharBufferRef.h */, 716 1440FCE20A51E46B0005F061 /* JSClassRef.cpp */, 717 1440FCE10A51E46B0005F061 /* JSClassRef.h */, 661 718 14BD5A290A3E91F600BAF59C /* JSContextRef.cpp */, 662 719 14BD5A2A0A3E91F600BAF59C /* JSContextRef.h */, … … 665 722 14BD5A2B0A3E91F600BAF59C /* JSValueRef.cpp */, 666 723 1482B6EA0A4300B300517CFC /* JSValueRef.h */, 667 141211000A48772600480255 /* tests */,668 724 ); 669 725 path = API; 726 sourceTree = "<group>"; 727 }; 728 144005170A531CB50005F061 /* minidom */ = { 729 isa = PBXGroup; 730 children = ( 731 1440F6420A4F8B6A0005F061 /* JSNode.c */, 732 1440F6410A4F8B6A0005F061 /* JSNode.h */, 733 144007560A5370D20005F061 /* JSNodeList.c */, 734 144007550A5370D20005F061 /* JSNodeList.h */, 735 141211020A48780900480255 /* minidom.c */, 736 1412110D0A48788700480255 /* minidom.js */, 737 144005200A531D3B0005F061 /* Node.c */, 738 1440051F0A531D3B0005F061 /* Node.h */, 739 144007490A536CC20005F061 /* NodeList.c */, 740 144007480A536CC20005F061 /* NodeList.h */, 741 ); 742 name = minidom; 670 743 sourceTree = "<group>"; 671 744 }; … … 863 936 F692A87F0255597D01FF60F7 /* string_object.cpp */, 864 937 F692A8800255597D01FF60F7 /* string_object.h */, 865 45E12D8806A49B0F00E9DF84 /* testkjs.cpp */,866 938 F692A8840255597D01FF60F7 /* types.h */, 867 939 F692A8850255597D01FF60F7 /* ustring.cpp */, … … 938 1010 939 1011 /* Begin PBXHeadersBuildPhase section */ 1012 144005C70A5338C60005F061 /* Headers */ = { 1013 isa = PBXHeadersBuildPhase; 1014 buildActionMask = 2147483647; 1015 files = ( 1016 144005CB0A5338D10005F061 /* JSNode.h in Headers */, 1017 144005CC0A5338F80005F061 /* Node.h in Headers */, 1018 1440074A0A536CC20005F061 /* NodeList.h in Headers */, 1019 144007570A5370D20005F061 /* JSNodeList.h in Headers */, 1020 ); 1021 runOnlyForDeploymentPostprocessing = 0; 1022 }; 940 1023 932F5B3F0822A1C700736975 /* Headers */ = { 941 1024 isa = PBXHeadersBuildPhase; … … 1065 1148 14ABDF5F0A437FEF00ECCA01 /* JSCallbackObject.h in Headers */, 1066 1149 142711390A460BBB0080EEEA /* JSBase.h in Headers */, 1150 1440F8910A508B100005F061 /* JSCallbackFunction.h in Headers */, 1151 1440F8AE0A508D200005F061 /* JSCallbackConstructor.h in Headers */, 1152 1440FCE30A51E46B0005F061 /* JSClassRef.h in Headers */, 1067 1153 ); 1068 1154 runOnlyForDeploymentPostprocessing = 0; … … 1076 1162 buildPhases = ( 1077 1163 1412111D0A48793C00480255 /* Sources */, 1164 1440025E0A52563F0005F061 /* ShellScript */, 1078 1165 1412111E0A48793C00480255 /* Frameworks */, 1166 144005C70A5338C60005F061 /* Headers */, 1079 1167 ); 1080 1168 buildRules = ( … … 1167 1255 isa = PBXProject; 1168 1256 buildConfigurationList = 149C277108902AFE008A9EFC /* Build configuration list for PBXProject "JavaScriptCore" */; 1257 buildSettings = { 1258 }; 1259 buildStyles = ( 1260 14C137130A560E70006CA9AF /* Development */, 1261 14C137140A560E70006CA9AF /* Deployment */, 1262 ); 1169 1263 hasScannedForEncodings = 1; 1170 1264 mainGroup = 0867D691FE84028FC02AAC07 /* JavaScriptCore */; … … 1184 1278 1185 1279 /* Begin PBXShellScriptBuildPhase section */ 1280 1440025E0A52563F0005F061 /* ShellScript */ = { 1281 isa = PBXShellScriptBuildPhase; 1282 buildActionMask = 2147483647; 1283 files = ( 1284 ); 1285 inputPaths = ( 1286 ); 1287 outputPaths = ( 1288 ); 1289 runOnlyForDeploymentPostprocessing = 0; 1290 shellPath = /bin/sh; 1291 shellScript = "cp \"${SRCROOT}/API/minidom.js\" \"${BUILT_PRODUCTS_DIR}\""; 1292 }; 1186 1293 14D857B50A469C100032146C /* ShellScript */ = { 1187 1294 isa = PBXShellScriptBuildPhase; … … 1232 1339 buildActionMask = 2147483647; 1233 1340 files = ( 1341 1440063F0A53598A0005F061 /* Node.c in Sources */, 1342 1440057F0A5335640005F061 /* JSNode.c in Sources */, 1234 1343 141211340A48795800480255 /* minidom.c in Sources */, 1344 1440074B0A536CC20005F061 /* NodeList.c in Sources */, 1345 144007580A5370D20005F061 /* JSNodeList.c in Sources */, 1235 1346 ); 1236 1347 runOnlyForDeploymentPostprocessing = 0; … … 1330 1441 1482B7E40A43076000517CFC /* JSObjectRef.cpp in Sources */, 1331 1442 14ABDF600A437FEF00ECCA01 /* JSCallbackObject.cpp in Sources */, 1443 1440F8920A508B100005F061 /* JSCallbackFunction.cpp in Sources */, 1444 1440F8AF0A508D200005F061 /* JSCallbackConstructor.cpp in Sources */, 1445 1440FCE40A51E46B0005F061 /* JSClassRef.cpp in Sources */, 1332 1446 ); 1333 1447 runOnlyForDeploymentPostprocessing = 0; … … 1485 1599 buildSettings = { 1486 1600 DEBUG_DEFINES = ""; 1487 DEBUG_INFORMATION_FORMAT = dwarf;1601 DEBUG_INFORMATION_FORMAT = stabs; 1488 1602 DYLIB_COMPATIBILITY_VERSION = 1; 1489 1603 DYLIB_CURRENT_VERSION = 1;
Note: See TracChangeset
for help on using the changeset viewer.