template <class Parent>
JSCallbackObject<Parent>::JSCallbackObject(ExecState* exec, Structure* structure, JSClassRef jsClass, void* data)
- : Parent(exec->globalData(), structure)
+ : Parent(exec->vm(), structure)
, m_callbackObjectData(adoptPtr(new JSCallbackObjectData(data, jsClass)))
{
}
// Global object constructor.
// FIXME: Move this into a separate JSGlobalCallbackObject class derived from this one.
template <class Parent>
-JSCallbackObject<Parent>::JSCallbackObject(JSGlobalData& globalData, JSClassRef jsClass, Structure* structure)
- : Parent(globalData, structure)
+JSCallbackObject<Parent>::JSCallbackObject(VM& vm, JSClassRef jsClass, Structure* structure)
+ : Parent(vm, structure)
, m_callbackObjectData(adoptPtr(new JSCallbackObjectData(0, jsClass)))
{
}
template <class Parent>
void JSCallbackObject<Parent>::finishCreation(ExecState* exec)
{
- Base::finishCreation(exec->globalData());
+ Base::finishCreation(exec->vm());
ASSERT(Parent::inherits(&s_info));
init(exec);
}
// This is just for Global object, so we can assume that Base::finishCreation is JSGlobalObject::finishCreation.
template <class Parent>
-void JSCallbackObject<Parent>::finishCreation(JSGlobalData& globalData)
+void JSCallbackObject<Parent>::finishCreation(VM& vm)
{
ASSERT(Parent::inherits(&s_info));
ASSERT(Parent::isGlobalObject());
- Base::finishCreation(globalData);
+ Base::finishCreation(vm);
init(jsCast<JSGlobalObject*>(this)->globalExec());
}
}
template <class Parent>
-UString JSCallbackObject<Parent>::className(const JSObject* object)
+String JSCallbackObject<Parent>::className(const JSObject* object)
{
const JSCallbackObject* thisObject = jsCast<const JSCallbackObject*>(object);
- UString thisClassName = thisObject->classRef()->className();
+ String thisClassName = thisObject->classRef()->className();
if (!thisClassName.isEmpty())
return thisClassName;
}
template <class Parent>
-bool JSCallbackObject<Parent>::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+bool JSCallbackObject<Parent>::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(cell);
JSContextRef ctx = toRef(exec);
JSObjectRef thisRef = toRef(thisObject);
RefPtr<OpaqueJSString> propertyNameRef;
- for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) {
- // optional optimization to bypass getProperty in cases when we only need to know if the property exists
- if (JSObjectHasPropertyCallback hasProperty = jsClass->hasProperty) {
- if (!propertyNameRef)
- propertyNameRef = OpaqueJSString::create(propertyName.ustring());
- APICallbackShim callbackShim(exec);
- if (hasProperty(ctx, thisRef, propertyNameRef.get())) {
- slot.setCustom(thisObject, callbackGetter);
- return true;
- }
- } else if (JSObjectGetPropertyCallback getProperty = jsClass->getProperty) {
- if (!propertyNameRef)
- propertyNameRef = OpaqueJSString::create(propertyName.ustring());
- JSValueRef exception = 0;
- JSValueRef value;
- {
+ if (StringImpl* name = propertyName.publicName()) {
+ for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) {
+ // optional optimization to bypass getProperty in cases when we only need to know if the property exists
+ if (JSObjectHasPropertyCallback hasProperty = jsClass->hasProperty) {
+ if (!propertyNameRef)
+ propertyNameRef = OpaqueJSString::create(name);
APICallbackShim callbackShim(exec);
- value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception);
- }
- if (exception) {
- throwError(exec, toJS(exec, exception));
- slot.setValue(jsUndefined());
- return true;
- }
- if (value) {
- slot.setValue(toJS(exec, value));
- return true;
- }
- }
-
- if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) {
- if (staticValues->contains(propertyName.impl())) {
- JSValue value = thisObject->getStaticValue(exec, propertyName);
+ if (hasProperty(ctx, thisRef, propertyNameRef.get())) {
+ slot.setCustom(thisObject, callbackGetter);
+ return true;
+ }
+ } else if (JSObjectGetPropertyCallback getProperty = jsClass->getProperty) {
+ if (!propertyNameRef)
+ propertyNameRef = OpaqueJSString::create(name);
+ JSValueRef exception = 0;
+ JSValueRef value;
+ {
+ APICallbackShim callbackShim(exec);
+ value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception);
+ }
+ if (exception) {
+ throwError(exec, toJS(exec, exception));
+ slot.setValue(jsUndefined());
+ return true;
+ }
if (value) {
- slot.setValue(value);
+ slot.setValue(toJS(exec, value));
return true;
}
}
- }
-
- if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
- if (staticFunctions->contains(propertyName.impl())) {
- slot.setCustom(thisObject, staticFunctionGetter);
- return true;
+
+ if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) {
+ if (staticValues->contains(name)) {
+ JSValue value = thisObject->getStaticValue(exec, propertyName);
+ if (value) {
+ slot.setValue(value);
+ return true;
+ }
+ }
+ }
+
+ if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
+ if (staticFunctions->contains(name)) {
+ slot.setCustom(thisObject, staticFunctionGetter);
+ return true;
+ }
}
}
}
-
+
return Parent::getOwnPropertySlot(thisObject, exec, propertyName, slot);
}
+template <class Parent>
+bool JSCallbackObject<Parent>::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot)
+{
+ return cell->methodTable()->getOwnPropertySlot(cell, exec, Identifier::from(exec, propertyName), slot);
+}
+
template <class Parent>
JSValue JSCallbackObject<Parent>::defaultValue(const JSObject* object, ExecState* exec, PreferredPrimitiveType hint)
{
}
template <class Parent>
-bool JSCallbackObject<Parent>::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+bool JSCallbackObject<Parent>::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
{
JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(object);
- PropertySlot slot;
+ PropertySlot slot(thisObject);
if (thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, propertyName, slot)) {
// Ideally we should return an access descriptor, but returning a value descriptor is better than nothing.
JSValue value = slot.getValue(exec, propertyName);
}
template <class Parent>
-void JSCallbackObject<Parent>::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+void JSCallbackObject<Parent>::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
{
JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(cell);
JSContextRef ctx = toRef(exec);
RefPtr<OpaqueJSString> propertyNameRef;
JSValueRef valueRef = toRef(exec, value);
+ if (StringImpl* name = propertyName.publicName()) {
+ for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) {
+ if (JSObjectSetPropertyCallback setProperty = jsClass->setProperty) {
+ if (!propertyNameRef)
+ propertyNameRef = OpaqueJSString::create(name);
+ JSValueRef exception = 0;
+ bool result;
+ {
+ APICallbackShim callbackShim(exec);
+ result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception);
+ }
+ if (exception)
+ throwError(exec, toJS(exec, exception));
+ if (result || exception)
+ return;
+ }
+
+ if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) {
+ if (StaticValueEntry* entry = staticValues->get(name)) {
+ if (entry->attributes & kJSPropertyAttributeReadOnly)
+ return;
+ if (JSObjectSetPropertyCallback setProperty = entry->setProperty) {
+ if (!propertyNameRef)
+ propertyNameRef = OpaqueJSString::create(name);
+ JSValueRef exception = 0;
+ bool result;
+ {
+ APICallbackShim callbackShim(exec);
+ result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception);
+ }
+ if (exception)
+ throwError(exec, toJS(exec, exception));
+ if (result || exception)
+ return;
+ }
+ }
+ }
+
+ if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
+ if (StaticFunctionEntry* entry = staticFunctions->get(name)) {
+ if (entry->attributes & kJSPropertyAttributeReadOnly)
+ return;
+ thisObject->JSCallbackObject<Parent>::putDirect(exec->vm(), propertyName, value); // put as override property
+ return;
+ }
+ }
+ }
+ }
+
+ return Parent::put(thisObject, exec, propertyName, value, slot);
+}
+
+template <class Parent>
+void JSCallbackObject<Parent>::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyIndex, JSValue value, bool shouldThrow)
+{
+ JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(cell);
+ JSContextRef ctx = toRef(exec);
+ JSObjectRef thisRef = toRef(thisObject);
+ RefPtr<OpaqueJSString> propertyNameRef;
+ JSValueRef valueRef = toRef(exec, value);
+ Identifier propertyName = Identifier(exec, String::number(propertyIndex));
+
for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) {
if (JSObjectSetPropertyCallback setProperty = jsClass->setProperty) {
if (!propertyNameRef)
- propertyNameRef = OpaqueJSString::create(propertyName.ustring());
+ propertyNameRef = OpaqueJSString::create(propertyName.impl());
JSValueRef exception = 0;
bool result;
{
if (result || exception)
return;
}
-
+
if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) {
if (StaticValueEntry* entry = staticValues->get(propertyName.impl())) {
if (entry->attributes & kJSPropertyAttributeReadOnly)
return;
if (JSObjectSetPropertyCallback setProperty = entry->setProperty) {
if (!propertyNameRef)
- propertyNameRef = OpaqueJSString::create(propertyName.ustring());
+ propertyNameRef = OpaqueJSString::create(propertyName.impl());
JSValueRef exception = 0;
bool result;
{
}
}
}
-
+
if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.impl())) {
if (entry->attributes & kJSPropertyAttributeReadOnly)
return;
- thisObject->JSCallbackObject<Parent>::putDirect(exec->globalData(), propertyName, value); // put as override property
- return;
+ break;
}
}
}
-
- return Parent::put(thisObject, exec, propertyName, value, slot);
+
+ return Parent::putByIndex(thisObject, exec, propertyIndex, value, shouldThrow);
}
template <class Parent>
-bool JSCallbackObject<Parent>::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName)
+bool JSCallbackObject<Parent>::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
{
JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(cell);
JSContextRef ctx = toRef(exec);
JSObjectRef thisRef = toRef(thisObject);
RefPtr<OpaqueJSString> propertyNameRef;
- for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) {
- if (JSObjectDeletePropertyCallback deleteProperty = jsClass->deleteProperty) {
- if (!propertyNameRef)
- propertyNameRef = OpaqueJSString::create(propertyName.ustring());
- JSValueRef exception = 0;
- bool result;
- {
- APICallbackShim callbackShim(exec);
- result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &exception);
+ if (StringImpl* name = propertyName.publicName()) {
+ for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) {
+ if (JSObjectDeletePropertyCallback deleteProperty = jsClass->deleteProperty) {
+ if (!propertyNameRef)
+ propertyNameRef = OpaqueJSString::create(name);
+ JSValueRef exception = 0;
+ bool result;
+ {
+ APICallbackShim callbackShim(exec);
+ result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &exception);
+ }
+ if (exception)
+ throwError(exec, toJS(exec, exception));
+ if (result || exception)
+ return true;
}
- if (exception)
- throwError(exec, toJS(exec, exception));
- if (result || exception)
- return true;
- }
-
- if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) {
- if (StaticValueEntry* entry = staticValues->get(propertyName.impl())) {
- if (entry->attributes & kJSPropertyAttributeDontDelete)
- return false;
- return true;
+
+ if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) {
+ if (StaticValueEntry* entry = staticValues->get(name)) {
+ if (entry->attributes & kJSPropertyAttributeDontDelete)
+ return false;
+ return true;
+ }
}
- }
-
- if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
- if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.impl())) {
- if (entry->attributes & kJSPropertyAttributeDontDelete)
- return false;
- return true;
+
+ if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
+ if (StaticFunctionEntry* entry = staticFunctions->get(name)) {
+ if (entry->attributes & kJSPropertyAttributeDontDelete)
+ return false;
+ return true;
+ }
}
}
}
-
+
return Parent::deleteProperty(thisObject, exec, propertyName);
}
for (JSClassRef jsClass = jsCast<JSCallbackObject<Parent>*>(constructor)->classRef(); jsClass; jsClass = jsClass->parentClass) {
if (JSObjectCallAsConstructorCallback callAsConstructor = jsClass->callAsConstructor) {
- int argumentCount = static_cast<int>(exec->argumentCount());
- Vector<JSValueRef, 16> arguments(argumentCount);
- for (int i = 0; i < argumentCount; i++)
- arguments[i] = toRef(exec, exec->argument(i));
+ size_t argumentCount = exec->argumentCount();
+ Vector<JSValueRef, 16> arguments;
+ arguments.reserveInitialCapacity(argumentCount);
+ for (size_t i = 0; i < argumentCount; ++i)
+ arguments.uncheckedAppend(toRef(exec, exec->argument(i)));
JSValueRef exception = 0;
JSObject* result;
{
}
}
- ASSERT_NOT_REACHED(); // getConstructData should prevent us from reaching here
+ RELEASE_ASSERT_NOT_REACHED(); // getConstructData should prevent us from reaching here
return JSValue::encode(JSValue());
}
template <class Parent>
-bool JSCallbackObject<Parent>::hasInstance(JSObject* object, ExecState* exec, JSValue value, JSValue)
+bool JSCallbackObject<Parent>::customHasInstance(JSObject* object, ExecState* exec, JSValue value)
{
JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(object);
JSContextRef execRef = toRef(exec);
for (JSClassRef jsClass = jsCast<JSCallbackObject<Parent>*>(toJS(functionRef))->classRef(); jsClass; jsClass = jsClass->parentClass) {
if (JSObjectCallAsFunctionCallback callAsFunction = jsClass->callAsFunction) {
- int argumentCount = static_cast<int>(exec->argumentCount());
- Vector<JSValueRef, 16> arguments(argumentCount);
- for (int i = 0; i < argumentCount; i++)
- arguments[i] = toRef(exec, exec->argument(i));
+ size_t argumentCount = exec->argumentCount();
+ Vector<JSValueRef, 16> arguments;
+ arguments.reserveInitialCapacity(argumentCount);
+ for (size_t i = 0; i < argumentCount; ++i)
+ arguments.uncheckedAppend(toRef(exec, exec->argument(i)));
JSValueRef exception = 0;
JSValue result;
{
}
}
- ASSERT_NOT_REACHED(); // getCallData should prevent us from reaching here
+ RELEASE_ASSERT_NOT_REACHED(); // getCallData should prevent us from reaching here
return JSValue::encode(JSValue());
}
template <class Parent>
-void JSCallbackObject<Parent>::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
+void JSCallbackObject<Parent>::getOwnNonIndexPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(object);
JSContextRef execRef = toRef(exec);
typedef OpaqueJSClassStaticValuesTable::const_iterator iterator;
iterator end = staticValues->end();
for (iterator it = staticValues->begin(); it != end; ++it) {
- StringImpl* name = it->first.get();
- StaticValueEntry* entry = it->second.get();
+ StringImpl* name = it->key.get();
+ StaticValueEntry* entry = it->value.get();
if (entry->getProperty && (!(entry->attributes & kJSPropertyAttributeDontEnum) || (mode == IncludeDontEnumProperties)))
propertyNames.add(Identifier(exec, name));
}
typedef OpaqueJSClassStaticFunctionsTable::const_iterator iterator;
iterator end = staticFunctions->end();
for (iterator it = staticFunctions->begin(); it != end; ++it) {
- StringImpl* name = it->first.get();
- StaticFunctionEntry* entry = it->second.get();
+ StringImpl* name = it->key.get();
+ StaticFunctionEntry* entry = it->value.get();
if (!(entry->attributes & kJSPropertyAttributeDontEnum) || (mode == IncludeDontEnumProperties))
propertyNames.add(Identifier(exec, name));
}
}
}
- Parent::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
+ Parent::getOwnNonIndexPropertyNames(thisObject, exec, propertyNames, mode);
}
template <class Parent>
template <class Parent>
bool JSCallbackObject<Parent>::inherits(JSClassRef c) const
{
- for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass)
+ for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
if (jsClass == c)
return true;
-
+ }
return false;
}
template <class Parent>
-JSValue JSCallbackObject<Parent>::getStaticValue(ExecState* exec, const Identifier& propertyName)
+JSValue JSCallbackObject<Parent>::getStaticValue(ExecState* exec, PropertyName propertyName)
{
JSObjectRef thisRef = toRef(this);
RefPtr<OpaqueJSString> propertyNameRef;
- for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass)
- if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec))
- if (StaticValueEntry* entry = staticValues->get(propertyName.impl()))
- if (JSObjectGetPropertyCallback getProperty = entry->getProperty) {
- if (!propertyNameRef)
- propertyNameRef = OpaqueJSString::create(propertyName.ustring());
- JSValueRef exception = 0;
- JSValueRef value;
- {
- APICallbackShim callbackShim(exec);
- value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception);
+ if (StringImpl* name = propertyName.publicName()) {
+ for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
+ if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) {
+ if (StaticValueEntry* entry = staticValues->get(name)) {
+ if (JSObjectGetPropertyCallback getProperty = entry->getProperty) {
+ if (!propertyNameRef)
+ propertyNameRef = OpaqueJSString::create(name);
+ JSValueRef exception = 0;
+ JSValueRef value;
+ {
+ APICallbackShim callbackShim(exec);
+ value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception);
+ }
+ if (exception) {
+ throwError(exec, toJS(exec, exception));
+ return jsUndefined();
+ }
+ if (value)
+ return toJS(exec, value);
}
- if (exception) {
- throwError(exec, toJS(exec, exception));
- return jsUndefined();
- }
- if (value)
- return toJS(exec, value);
}
+ }
+ }
+ }
return JSValue();
}
template <class Parent>
-JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue slotParent, const Identifier& propertyName)
+JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue slotParent, PropertyName propertyName)
{
JSCallbackObject* thisObj = asCallbackObject(slotParent);
if (Parent::getOwnPropertySlot(thisObj, exec, propertyName, slot2))
return slot2.getValue(exec, propertyName);
- for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass) {
- if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
- if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.impl())) {
- if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) {
-
- JSObject* o = JSCallbackFunction::create(exec, thisObj->globalObject(), callAsFunction, propertyName);
- thisObj->putDirect(exec->globalData(), propertyName, o, entry->attributes);
- return o;
+ if (StringImpl* name = propertyName.publicName()) {
+ for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass) {
+ if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
+ if (StaticFunctionEntry* entry = staticFunctions->get(name)) {
+ if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) {
+
+ JSObject* o = JSCallbackFunction::create(exec, thisObj->globalObject(), callAsFunction, name);
+ thisObj->putDirect(exec->vm(), propertyName, o, entry->attributes);
+ return o;
+ }
}
}
}
}
-
- return throwError(exec, createReferenceError(exec, "Static function property defined with NULL callAsFunction callback."));
+
+ return throwError(exec, createReferenceError(exec, ASCIILiteral("Static function property defined with NULL callAsFunction callback.")));
}
template <class Parent>
-JSValue JSCallbackObject<Parent>::callbackGetter(ExecState* exec, JSValue slotParent, const Identifier& propertyName)
+JSValue JSCallbackObject<Parent>::callbackGetter(ExecState* exec, JSValue slotParent, PropertyName propertyName)
{
JSCallbackObject* thisObj = asCallbackObject(slotParent);
JSObjectRef thisRef = toRef(thisObj);
RefPtr<OpaqueJSString> propertyNameRef;
- for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass)
- if (JSObjectGetPropertyCallback getProperty = jsClass->getProperty) {
- if (!propertyNameRef)
- propertyNameRef = OpaqueJSString::create(propertyName.ustring());
- JSValueRef exception = 0;
- JSValueRef value;
- {
- APICallbackShim callbackShim(exec);
- value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception);
- }
- if (exception) {
- throwError(exec, toJS(exec, exception));
- return jsUndefined();
+ if (StringImpl* name = propertyName.publicName()) {
+ for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass) {
+ if (JSObjectGetPropertyCallback getProperty = jsClass->getProperty) {
+ if (!propertyNameRef)
+ propertyNameRef = OpaqueJSString::create(name);
+ JSValueRef exception = 0;
+ JSValueRef value;
+ {
+ APICallbackShim callbackShim(exec);
+ value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception);
+ }
+ if (exception) {
+ throwError(exec, toJS(exec, exception));
+ return jsUndefined();
+ }
+ if (value)
+ return toJS(exec, value);
}
- if (value)
- return toJS(exec, value);
}
-
- return throwError(exec, createReferenceError(exec, "hasProperty callback returned true for a property that doesn't exist."));
+ }
+
+ return throwError(exec, createReferenceError(exec, ASCIILiteral("hasProperty callback returned true for a property that doesn't exist.")));
}
} // namespace JSC