Changeset 15481 in webkit for trunk/JavaScriptCore/API/JSCallbackObject.cpp
- Timestamp:
- Jul 17, 2006, 1:14:39 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSCallbackObject.cpp
r15480 r15481 38 38 const ClassInfo JSCallbackObject::info = { "CallbackObject", 0, 0, 0 }; 39 39 40 JSCallbackObject::JSCallbackObject(JSContextRef c ontext, JSClassRef jsClass)40 JSCallbackObject::JSCallbackObject(JSContextRef ctx, JSClassRef jsClass) 41 41 : JSObject() 42 42 { 43 init(c ontext, jsClass);44 } 45 46 JSCallbackObject::JSCallbackObject(JSContextRef c ontext, JSClassRef jsClass, JSValue* prototype)43 init(ctx, jsClass); 44 } 45 46 JSCallbackObject::JSCallbackObject(JSContextRef ctx, JSClassRef jsClass, JSValue* prototype) 47 47 : JSObject(prototype) 48 48 { 49 init(c ontext, jsClass);50 } 51 52 void JSCallbackObject::init(JSContextRef c ontext, JSClassRef jsClass)53 { 54 ExecState* exec = toJS(c ontext);49 init(ctx, jsClass); 50 } 51 52 void JSCallbackObject::init(JSContextRef ctx, JSClassRef jsClass) 53 { 54 ExecState* exec = toJS(ctx); 55 55 56 56 m_privateData = 0; … … 61 61 do { 62 62 if (JSObjectInitializeCallback initialize = jsClass->initialize) 63 initialize(c ontext, thisRef, toRef(exec->exceptionSlot()));63 initialize(ctx, thisRef, toRef(exec->exceptionSlot())); 64 64 } while ((jsClass = jsClass->parentClass)); 65 65 } … … 86 86 bool JSCallbackObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 87 87 { 88 JSContextRef c ontext= toRef(exec);88 JSContextRef ctx = toRef(exec); 89 89 JSObjectRef thisRef = toRef(this); 90 90 JSStringRef propertyNameRef = toRef(propertyName.ustring().rep()); … … 93 93 // optional optimization to bypass getProperty in cases when we only need to know if the property exists 94 94 if (JSObjectHasPropertyCallback hasProperty = jsClass->hasProperty) { 95 if (hasProperty(c ontext, thisRef, propertyNameRef)) {95 if (hasProperty(ctx, thisRef, propertyNameRef)) { 96 96 slot.setCustom(this, callbackGetter); 97 97 return true; 98 98 } 99 99 } else if (JSObjectGetPropertyCallback getProperty = jsClass->getProperty) { 100 if (JSValueRef value = getProperty(c ontext, thisRef, propertyNameRef, toRef(exec->exceptionSlot()))) {100 if (JSValueRef value = getProperty(ctx, thisRef, propertyNameRef, toRef(exec->exceptionSlot()))) { 101 101 // cache the value so we don't have to compute it again 102 102 // FIXME: This violates the PropertySlot design a little bit. … … 132 132 void JSCallbackObject::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr) 133 133 { 134 JSContextRef c ontext= toRef(exec);134 JSContextRef ctx = toRef(exec); 135 135 JSObjectRef thisRef = toRef(this); 136 136 JSStringRef propertyNameRef = toRef(propertyName.ustring().rep()); … … 139 139 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parentClass) { 140 140 if (JSObjectSetPropertyCallback setProperty = jsClass->setProperty) { 141 if (setProperty(c ontext, thisRef, propertyNameRef, valueRef, toRef(exec->exceptionSlot())))141 if (setProperty(ctx, thisRef, propertyNameRef, valueRef, toRef(exec->exceptionSlot()))) 142 142 return; 143 143 } … … 148 148 return; 149 149 if (JSObjectSetPropertyCallback setProperty = entry->setProperty) 150 setProperty(c ontext, thisRef, propertyNameRef, valueRef, toRef(exec->exceptionSlot()));150 setProperty(ctx, thisRef, propertyNameRef, valueRef, toRef(exec->exceptionSlot())); 151 151 else 152 152 throwError(exec, ReferenceError, "Writable static value property defined with NULL setProperty callback."); … … 174 174 bool JSCallbackObject::deleteProperty(ExecState* exec, const Identifier& propertyName) 175 175 { 176 JSContextRef c ontext= toRef(exec);176 JSContextRef ctx = toRef(exec); 177 177 JSObjectRef thisRef = toRef(this); 178 178 JSStringRef propertyNameRef = toRef(propertyName.ustring().rep()); … … 180 180 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parentClass) { 181 181 if (JSObjectDeletePropertyCallback deleteProperty = jsClass->deleteProperty) { 182 if (deleteProperty(c ontext, thisRef, propertyNameRef, toRef(exec->exceptionSlot())))182 if (deleteProperty(ctx, thisRef, propertyNameRef, toRef(exec->exceptionSlot()))) 183 183 return true; 184 184 } … … 326 326 double JSCallbackObject::toNumber(ExecState* exec) const 327 327 { 328 JSContextRef c ontext= toRef(exec);328 JSContextRef ctx = toRef(exec); 329 329 JSObjectRef thisRef = toRef(this); 330 330 331 331 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parentClass) 332 332 if (JSObjectConvertToTypeCallback convertToType = jsClass->convertToType) 333 if (JSValueRef value = convertToType(c ontext, thisRef, kJSTypeNumber, toRef(exec->exceptionSlot())))333 if (JSValueRef value = convertToType(ctx, thisRef, kJSTypeNumber, toRef(exec->exceptionSlot()))) 334 334 return toJS(value)->getNumber(); 335 335 … … 339 339 UString JSCallbackObject::toString(ExecState* exec) const 340 340 { 341 JSContextRef c ontext= toRef(exec);341 JSContextRef ctx = toRef(exec); 342 342 JSObjectRef thisRef = toRef(this); 343 343 344 344 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parentClass) 345 345 if (JSObjectConvertToTypeCallback convertToType = jsClass->convertToType) 346 if (JSValueRef value = convertToType(c ontext, thisRef, kJSTypeString, toRef(exec->exceptionSlot())))346 if (JSValueRef value = convertToType(ctx, thisRef, kJSTypeString, toRef(exec->exceptionSlot()))) 347 347 return toJS(value)->getString(); 348 348
Note:
See TracChangeset
for help on using the changeset viewer.