KValueRef KKJSMethod::Call(KObjectRef thisObject, const ValueList& args) { JSValueRef thisObjectValue = KJSUtil::ToJSValue(Value::NewObject(thisObject), this->context); if (!JSValueIsObject(this->context, thisObjectValue)) { SharedString ss(thisObject->DisplayString()); throw ValueException::FromFormat("Could not convert %s to JSObjectRef for KKJSMethod::Call", ss->c_str()); } JSObjectRef jsThisObject = JSValueToObject(this->context, thisObjectValue, NULL); if (!jsThisObject) { SharedString ss(thisObject->DisplayString()); throw ValueException::FromFormat("Could not convert %s to JSObjectRef for KKJSMethod::Call", ss->c_str()); } return this->Call(jsThisObject, args); }