diff options
Diffstat (limited to 'WebCore/bridge/objc')
-rw-r--r-- | WebCore/bridge/objc/WebScriptObject.h | 2 | ||||
-rw-r--r-- | WebCore/bridge/objc/objc_class.h | 4 | ||||
-rw-r--r-- | WebCore/bridge/objc/objc_class.mm | 9 | ||||
-rw-r--r-- | WebCore/bridge/objc/objc_instance.h | 22 | ||||
-rw-r--r-- | WebCore/bridge/objc/objc_instance.mm | 48 | ||||
-rw-r--r-- | WebCore/bridge/objc/objc_runtime.h | 32 | ||||
-rw-r--r-- | WebCore/bridge/objc/objc_runtime.mm | 76 | ||||
-rw-r--r-- | WebCore/bridge/objc/objc_utility.h | 6 | ||||
-rw-r--r-- | WebCore/bridge/objc/objc_utility.mm | 16 |
9 files changed, 87 insertions, 128 deletions
diff --git a/WebCore/bridge/objc/WebScriptObject.h b/WebCore/bridge/objc/WebScriptObject.h index 357d42a..7942635 100644 --- a/WebCore/bridge/objc/WebScriptObject.h +++ b/WebCore/bridge/objc/WebScriptObject.h @@ -34,7 +34,7 @@ + (NSString *)webScriptNameForKey:(const char *)name; + (BOOL)isKeyExcludedFromWebScript:(const char *)name; -+ (id)_convertValueToObjcValue:(JSC::JSValue*)value originRootObject:(JSC::Bindings::RootObject*)originRootObject rootObject:(JSC::Bindings::RootObject*)rootObject; ++ (id)_convertValueToObjcValue:(JSC::JSValuePtr)value originRootObject:(JSC::Bindings::RootObject*)originRootObject rootObject:(JSC::Bindings::RootObject*)rootObject; - _initWithJSObject:(JSC::JSObject*)imp originRootObject:(PassRefPtr<JSC::Bindings::RootObject>)originRootObject rootObject:(PassRefPtr<JSC::Bindings::RootObject>)rootObject; - (JSC::JSObject *)_imp; @end diff --git a/WebCore/bridge/objc/objc_class.h b/WebCore/bridge/objc/objc_class.h index d96c604..3735680 100644 --- a/WebCore/bridge/objc/objc_class.h +++ b/WebCore/bridge/objc/objc_class.h @@ -40,12 +40,10 @@ public: // Return the cached ObjC of the specified name. static ObjcClass *classForIsA(ClassStructPtr); - virtual const char *name() const; - virtual MethodList methodsNamed(const Identifier&, Instance *instance) const; virtual Field *fieldNamed(const Identifier&, Instance *instance) const; - virtual JSValue* fallbackObject(ExecState *exec, Instance *instance, const Identifier &propertyName); + virtual JSValuePtr fallbackObject(ExecState *exec, Instance *instance, const Identifier &propertyName); ClassStructPtr isa() { return _isa; } diff --git a/WebCore/bridge/objc/objc_class.mm b/WebCore/bridge/objc/objc_class.mm index 79991c2..e3bde0a 100644 --- a/WebCore/bridge/objc/objc_class.mm +++ b/WebCore/bridge/objc/objc_class.mm @@ -73,11 +73,6 @@ ObjcClass* ObjcClass::classForIsA(ClassStructPtr isa) return aClass; } -const char* ObjcClass::name() const -{ - return object_getClassName(_isa); -} - MethodList ObjcClass::methodsNamed(const Identifier& identifier, Instance*) const { MethodList methodList; @@ -133,7 +128,7 @@ MethodList ObjcClass::methodsNamed(const Identifier& identifier, Instance*) cons mappedName = [thisClass webScriptNameForSelector:objcMethodSelector]; if ((mappedName && [mappedName isEqual:(NSString*)methodName.get()]) || strcmp(objcMethodSelectorName, buffer) == 0) { - Method* aMethod = new ObjcMethod(thisClass, objcMethodSelectorName); // deleted when the dictionary is destroyed + Method* aMethod = new ObjcMethod(thisClass, objcMethodSelector); // deleted when the dictionary is destroyed CFDictionaryAddValue(_methods.get(), methodName.get(), aMethod); methodList.append(aMethod); break; @@ -244,7 +239,7 @@ Field* ObjcClass::fieldNamed(const Identifier& identifier, Instance* instance) c return aField; } -JSValue* ObjcClass::fallbackObject(ExecState* exec, Instance* instance, const Identifier &propertyName) +JSValuePtr ObjcClass::fallbackObject(ExecState* exec, Instance* instance, const Identifier &propertyName) { ObjcInstance* objcInstance = static_cast<ObjcInstance*>(instance); id targetObject = objcInstance->getObject(); diff --git a/WebCore/bridge/objc/objc_instance.h b/WebCore/bridge/objc/objc_instance.h index dc7a362..1b7e184 100644 --- a/WebCore/bridge/objc/objc_instance.h +++ b/WebCore/bridge/objc/objc_instance.h @@ -48,25 +48,21 @@ public: virtual Class *getClass() const; - virtual JSValue* valueOf(ExecState*) const; - virtual JSValue* defaultValue(ExecState*, PreferredPrimitiveType) const; + virtual JSValuePtr valueOf(ExecState*) const; + virtual JSValuePtr defaultValue(ExecState*, PreferredPrimitiveType) const; - virtual JSValue* invokeMethod(ExecState*, const MethodList&, const ArgList&); + virtual JSValuePtr invokeMethod(ExecState*, const MethodList&, const ArgList&); virtual bool supportsInvokeDefaultMethod() const; - virtual JSValue* invokeDefaultMethod(ExecState*, const ArgList&); + virtual JSValuePtr invokeDefaultMethod(ExecState*, const ArgList&); - virtual bool supportsSetValueOfUndefinedField(); - virtual void setValueOfUndefinedField(ExecState*, const Identifier&, JSValue*); - - virtual JSValue* getValueOfUndefinedField(ExecState*, const Identifier& property) const; + JSValuePtr getValueOfUndefinedField(ExecState*, const Identifier&) const; + virtual bool setValueOfUndefinedField(ExecState*, const Identifier&, JSValuePtr); ObjectStructPtr getObject() const { return _instance.get(); } - JSValue* stringValue(ExecState*) const; - JSValue* numberValue(ExecState*) const; - JSValue* booleanValue() const; - - virtual BindingLanguage getBindingLanguage() const { return ObjectiveCLanguage; } + JSValuePtr stringValue(ExecState*) const; + JSValuePtr numberValue(ExecState*) const; + JSValuePtr booleanValue() const; protected: virtual void virtualBegin(); diff --git a/WebCore/bridge/objc/objc_instance.mm b/WebCore/bridge/objc/objc_instance.mm index 6a714b9..54af18c 100644 --- a/WebCore/bridge/objc/objc_instance.mm +++ b/WebCore/bridge/objc/objc_instance.mm @@ -124,9 +124,9 @@ bool ObjcInstance::supportsInvokeDefaultMethod() const return [_instance.get() respondsToSelector:@selector(invokeDefaultMethodWithArguments:)]; } -JSValue* ObjcInstance::invokeMethod(ExecState* exec, const MethodList &methodList, const ArgList &args) +JSValuePtr ObjcInstance::invokeMethod(ExecState* exec, const MethodList &methodList, const ArgList &args) { - JSValue* result = jsUndefined(); + JSValuePtr result = jsUndefined(); JSLock::DropAllLocks dropAllLocks(false); // Can't put this inside the @try scope because it unwinds incorrectly. @@ -141,11 +141,7 @@ JSValue* ObjcInstance::invokeMethod(ExecState* exec, const MethodList &methodLis method = static_cast<ObjcMethod*>(methodList[0]); NSMethodSignature* signature = method->getMethodSignature(); NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:signature]; -#if defined(OBJC_API_VERSION) && OBJC_API_VERSION >= 2 - [invocation setSelector:sel_registerName(method->name())]; -#else - [invocation setSelector:(SEL)method->name()]; -#endif + [invocation setSelector:method->selector()]; [invocation setTarget:_instance.get()]; if (method->isFallbackMethod()) { @@ -246,12 +242,12 @@ JSValue* ObjcInstance::invokeMethod(ExecState* exec, const MethodList &methodLis // Work around problem in some versions of GCC where result gets marked volatile and // it can't handle copying from a volatile to non-volatile. - return const_cast<JSValue*&>(result); + return const_cast<JSValuePtr&>(result); } -JSValue* ObjcInstance::invokeDefaultMethod(ExecState* exec, const ArgList &args) +JSValuePtr ObjcInstance::invokeDefaultMethod(ExecState* exec, const ArgList &args) { - JSValue* result = jsUndefined(); + JSValuePtr result = jsUndefined(); JSLock::DropAllLocks dropAllLocks(false); // Can't put this inside the @try scope because it unwinds incorrectly. setGlobalException(nil); @@ -297,20 +293,14 @@ JSValue* ObjcInstance::invokeDefaultMethod(ExecState* exec, const ArgList &args) // Work around problem in some versions of GCC where result gets marked volatile and // it can't handle copying from a volatile to non-volatile. - return const_cast<JSValue*&>(result); + return const_cast<JSValuePtr&>(result); } -bool ObjcInstance::supportsSetValueOfUndefinedField() -{ - id targetObject = getObject(); - if ([targetObject respondsToSelector:@selector(setValue:forUndefinedKey:)]) - return true; - return false; -} - -void ObjcInstance::setValueOfUndefinedField(ExecState* exec, const Identifier &property, JSValue* aValue) +bool ObjcInstance::setValueOfUndefinedField(ExecState* exec, const Identifier& property, JSValuePtr aValue) { id targetObject = getObject(); + if (![targetObject respondsToSelector:@selector(setValue:forUndefinedKey:)]) + return false; JSLock::DropAllLocks dropAllLocks(false); // Can't put this inside the @try scope because it unwinds incorrectly. @@ -330,11 +320,13 @@ void ObjcInstance::setValueOfUndefinedField(ExecState* exec, const Identifier &p moveGlobalExceptionToExecState(exec); } + + return true; } -JSValue* ObjcInstance::getValueOfUndefinedField(ExecState* exec, const Identifier& property) const +JSValuePtr ObjcInstance::getValueOfUndefinedField(ExecState* exec, const Identifier& property) const { - JSValue* result = jsUndefined(); + JSValuePtr result = jsUndefined(); id targetObject = getObject(); @@ -358,10 +350,10 @@ JSValue* ObjcInstance::getValueOfUndefinedField(ExecState* exec, const Identifie // Work around problem in some versions of GCC where result gets marked volatile and // it can't handle copying from a volatile to non-volatile. - return const_cast<JSValue*&>(result); + return const_cast<JSValuePtr&>(result); } -JSValue* ObjcInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const +JSValuePtr ObjcInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const { if (hint == PreferString) return stringValue(exec); @@ -374,24 +366,24 @@ JSValue* ObjcInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hint return valueOf(exec); } -JSValue* ObjcInstance::stringValue(ExecState* exec) const +JSValuePtr ObjcInstance::stringValue(ExecState* exec) const { return convertNSStringToString(exec, [getObject() description]); } -JSValue* ObjcInstance::numberValue(ExecState* exec) const +JSValuePtr ObjcInstance::numberValue(ExecState* exec) const { // FIXME: Implement something sensible return jsNumber(exec, 0); } -JSValue* ObjcInstance::booleanValue() const +JSValuePtr ObjcInstance::booleanValue() const { // FIXME: Implement something sensible return jsBoolean(false); } -JSValue* ObjcInstance::valueOf(ExecState* exec) const +JSValuePtr ObjcInstance::valueOf(ExecState* exec) const { return stringValue(exec); } diff --git a/WebCore/bridge/objc/objc_runtime.h b/WebCore/bridge/objc/objc_runtime.h index 5f0d8e2..5ed6d2a 100644 --- a/WebCore/bridge/objc/objc_runtime.h +++ b/WebCore/bridge/objc/objc_runtime.h @@ -44,11 +44,9 @@ public: ObjcField(IvarStructPtr); ObjcField(CFStringRef name); - virtual JSValue* valueFromInstance(ExecState*, const Instance*) const; - virtual void setValueToInstance(ExecState*, const Instance*, JSValue*) const; - - virtual const char *name() const; - + virtual JSValuePtr valueFromInstance(ExecState*, const Instance*) const; + virtual void setValueToInstance(ExecState*, const Instance*, JSValuePtr) const; + private: IvarStructPtr _ivar; RetainPtr<CFStringRef> _name; @@ -57,21 +55,21 @@ private: class ObjcMethod : public Method { public: ObjcMethod() : _objcClass(0), _selector(0), _javaScriptName(0) {} - ObjcMethod(ClassStructPtr aClass, const char *_selector); - - virtual const char *name() const; + ObjcMethod(ClassStructPtr aClass, SEL _selector); virtual int numParameters() const; NSMethodSignature *getMethodSignature() const; - bool isFallbackMethod() const { return strcmp(_selector, "invokeUndefinedMethodFromWebScript:withArguments:") == 0; } + bool isFallbackMethod() const { return _selector == @selector(invokeUndefinedMethodFromWebScript:withArguments:); } void setJavaScriptName(CFStringRef n) { _javaScriptName = n; } CFStringRef javaScriptName() const { return _javaScriptName.get(); } + SEL selector() const { return _selector; } + private: ClassStructPtr _objcClass; - const char *_selector; + SEL _selector; RetainPtr<CFStringRef> _javaScriptName; }; @@ -79,13 +77,13 @@ class ObjcArray : public Array { public: ObjcArray(ObjectStructPtr, PassRefPtr<RootObject>); - virtual void setValueAt(ExecState *exec, unsigned int index, JSValue* aValue) const; - virtual JSValue* valueAt(ExecState *exec, unsigned int index) const; + virtual void setValueAt(ExecState *exec, unsigned int index, JSValuePtr aValue) const; + virtual JSValuePtr valueAt(ExecState *exec, unsigned int index) const; virtual unsigned int getLength() const; ObjectStructPtr getObjcArray() const { return _array.get(); } - static JSValue* convertObjcArrayToArray(ExecState *exec, ObjectStructPtr anObject); + static JSValuePtr convertObjcArrayToArray(ExecState *exec, ObjectStructPtr anObject); private: RetainPtr<ObjectStructPtr> _array; @@ -104,17 +102,17 @@ public: return exec->lexicalGlobalObject()->objectPrototype(); } - static PassRefPtr<StructureID> createStructureID(JSValue* prototype) + static PassRefPtr<Structure> createStructure(JSValuePtr prototype) { - return StructureID::create(prototype, TypeInfo(ObjectType)); + return Structure::create(prototype, TypeInfo(ObjectType)); } private: virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); - virtual void put(ExecState*, const Identifier& propertyName, JSValue*, PutPropertySlot&); + virtual void put(ExecState*, const Identifier& propertyName, JSValuePtr, PutPropertySlot&); virtual CallType getCallData(CallData&); virtual bool deleteProperty(ExecState*, const Identifier& propertyName); - virtual JSValue* defaultValue(ExecState*, PreferredPrimitiveType) const; + virtual JSValuePtr defaultValue(ExecState*, PreferredPrimitiveType) const; virtual bool toBoolean(ExecState*) const; diff --git a/WebCore/bridge/objc/objc_runtime.mm b/WebCore/bridge/objc/objc_runtime.mm index e6729a8..61ec6ed 100644 --- a/WebCore/bridge/objc/objc_runtime.mm +++ b/WebCore/bridge/objc/objc_runtime.mm @@ -56,16 +56,10 @@ ClassStructPtr webUndefinedClass() // ---------------------- ObjcMethod ---------------------- -ObjcMethod::ObjcMethod(ClassStructPtr aClass, const char* name) +ObjcMethod::ObjcMethod(ClassStructPtr aClass, SEL selector) + : _objcClass(aClass) + , _selector(selector) { - _objcClass = aClass; - _selector = name; // Assume ObjC runtime keeps these around forever. - _javaScriptName = 0; -} - -const char* ObjcMethod::name() const -{ - return _selector; } int ObjcMethod::numParameters() const @@ -75,50 +69,37 @@ int ObjcMethod::numParameters() const NSMethodSignature* ObjcMethod::getMethodSignature() const { -#if defined(OBJC_API_VERSION) && OBJC_API_VERSION >= 2 - return [_objcClass instanceMethodSignatureForSelector:sel_registerName(_selector)]; -#else - return [_objcClass instanceMethodSignatureForSelector:(SEL)_selector]; -#endif + return [_objcClass instanceMethodSignatureForSelector:_selector]; } // ---------------------- ObjcField ---------------------- ObjcField::ObjcField(Ivar ivar) + : _ivar(ivar) +#if defined(OBJC_API_VERSION) && OBJC_API_VERSION >= 2 + , _name(AdoptCF, CFStringCreateWithCString(0, ivar_getName(_ivar), kCFStringEncodingASCII)) +#else + , _name(AdoptCF, CFStringCreateWithCString(0, _ivar->ivar_name, kCFStringEncodingASCII)) +#endif { - _ivar = ivar; // Assume ObjectiveC runtime will keep this alive forever - _name = 0; -} - -ObjcField::ObjcField(CFStringRef name) -{ - _ivar = 0; - _name = (CFStringRef)CFRetain(name); } -const char* ObjcField::name() const +ObjcField::ObjcField(CFStringRef name) + : _ivar(0) + , _name(name) { -#if defined(OBJC_API_VERSION) && OBJC_API_VERSION >= 2 - if (_ivar) - return ivar_getName(_ivar); -#else - if (_ivar) - return _ivar->ivar_name; -#endif - return [(NSString*)_name.get() UTF8String]; } -JSValue* ObjcField::valueFromInstance(ExecState* exec, const Instance* instance) const +JSValuePtr ObjcField::valueFromInstance(ExecState* exec, const Instance* instance) const { - JSValue* result = jsUndefined(); + JSValuePtr result = jsUndefined(); id targetObject = (static_cast<const ObjcInstance*>(instance))->getObject(); JSLock::DropAllLocks dropAllLocks(false); // Can't put this inside the @try scope because it unwinds incorrectly. @try { - NSString* key = [NSString stringWithCString:name() encoding:NSASCIIStringEncoding]; - if (id objcValue = [targetObject valueForKey:key]) + if (id objcValue = [targetObject valueForKey:(NSString *)_name.get()]) result = convertObjcValueToValue(exec, &objcValue, ObjcObjectType, instance->rootObject()); } @catch(NSException* localException) { JSLock::lock(false); @@ -128,10 +109,10 @@ JSValue* ObjcField::valueFromInstance(ExecState* exec, const Instance* instance) // Work around problem in some versions of GCC where result gets marked volatile and // it can't handle copying from a volatile to non-volatile. - return const_cast<JSValue*&>(result); + return const_cast<JSValuePtr&>(result); } -static id convertValueToObjcObject(ExecState* exec, JSValue* value) +static id convertValueToObjcObject(ExecState* exec, JSValuePtr value) { RefPtr<RootObject> rootObject = findRootObject(exec->dynamicGlobalObject()); if (!rootObject) @@ -139,7 +120,7 @@ static id convertValueToObjcObject(ExecState* exec, JSValue* value) return [webScriptObjectClass() _convertValueToObjcValue:value originRootObject:rootObject.get() rootObject:rootObject.get()]; } -void ObjcField::setValueToInstance(ExecState* exec, const Instance* instance, JSValue* aValue) const +void ObjcField::setValueToInstance(ExecState* exec, const Instance* instance, JSValuePtr aValue) const { id targetObject = (static_cast<const ObjcInstance*>(instance))->getObject(); id value = convertValueToObjcObject(exec, aValue); @@ -147,8 +128,7 @@ void ObjcField::setValueToInstance(ExecState* exec, const Instance* instance, JS JSLock::DropAllLocks dropAllLocks(false); // Can't put this inside the @try scope because it unwinds incorrectly. @try { - NSString* key = [NSString stringWithCString:name() encoding:NSASCIIStringEncoding]; - [targetObject setValue:value forKey:key]; + [targetObject setValue:value forKey:(NSString *)_name.get()]; } @catch(NSException* localException) { JSLock::lock(false); throwError(exec, GeneralError, [localException reason]); @@ -164,7 +144,7 @@ ObjcArray::ObjcArray(ObjectStructPtr a, PassRefPtr<RootObject> rootObject) { } -void ObjcArray::setValueAt(ExecState* exec, unsigned int index, JSValue* aValue) const +void ObjcArray::setValueAt(ExecState* exec, unsigned int index, JSValuePtr aValue) const { if (![_array.get() respondsToSelector:@selector(insertObject:atIndex:)]) { throwError(exec, TypeError, "Array is not mutable."); @@ -187,7 +167,7 @@ void ObjcArray::setValueAt(ExecState* exec, unsigned int index, JSValue* aValue) } } -JSValue* ObjcArray::valueAt(ExecState* exec, unsigned int index) const +JSValuePtr ObjcArray::valueAt(ExecState* exec, unsigned int index) const { if (index > [_array.get() count]) return throwError(exec, RangeError, "Index exceeds array size."); @@ -222,16 +202,16 @@ bool ObjcFallbackObjectImp::getOwnPropertySlot(ExecState*, const Identifier&, Pr return true; } -void ObjcFallbackObjectImp::put(ExecState*, const Identifier&, JSValue*, PutPropertySlot&) +void ObjcFallbackObjectImp::put(ExecState*, const Identifier&, JSValuePtr, PutPropertySlot&) { } -static JSValue* callObjCFallbackObject(ExecState* exec, JSObject* function, JSValue* thisValue, const ArgList& args) +static JSValuePtr callObjCFallbackObject(ExecState* exec, JSObject* function, JSValuePtr thisValue, const ArgList& args) { - if (!thisValue->isObject(&RuntimeObjectImp::s_info)) + if (!thisValue.isObject(&RuntimeObjectImp::s_info)) return throwError(exec, TypeError); - JSValue* result = jsUndefined(); + JSValuePtr result = jsUndefined(); RuntimeObjectImp* imp = static_cast<RuntimeObjectImp*>(asObject(thisValue)); Instance* instance = imp->getInternalInstance(); @@ -246,7 +226,7 @@ static JSValue* callObjCFallbackObject(ExecState* exec, JSObject* function, JSVa if ([targetObject respondsToSelector:@selector(invokeUndefinedMethodFromWebScript:withArguments:)]){ ObjcClass* objcClass = static_cast<ObjcClass*>(instance->getClass()); - OwnPtr<ObjcMethod> fallbackMethod(new ObjcMethod(objcClass->isa(), sel_getName(@selector(invokeUndefinedMethodFromWebScript:withArguments:)))); + OwnPtr<ObjcMethod> fallbackMethod(new ObjcMethod(objcClass->isa(), @selector(invokeUndefinedMethodFromWebScript:withArguments:))); const Identifier& nameIdentifier = static_cast<ObjcFallbackObjectImp*>(function)->propertyName(); RetainPtr<CFStringRef> name(AdoptCF, CFStringCreateWithCharacters(0, nameIdentifier.data(), nameIdentifier.size())); fallbackMethod->setJavaScriptName(name.get()); @@ -274,7 +254,7 @@ bool ObjcFallbackObjectImp::deleteProperty(ExecState*, const Identifier&) return false; } -JSValue* ObjcFallbackObjectImp::defaultValue(ExecState* exec, PreferredPrimitiveType) const +JSValuePtr ObjcFallbackObjectImp::defaultValue(ExecState* exec, PreferredPrimitiveType) const { return _instance->getValueOfUndefinedField(exec, _item); } diff --git a/WebCore/bridge/objc/objc_utility.h b/WebCore/bridge/objc/objc_utility.h index 304b0a2..35787ea 100644 --- a/WebCore/bridge/objc/objc_utility.h +++ b/WebCore/bridge/objc/objc_utility.h @@ -73,9 +73,9 @@ typedef enum { class RootObject; -ObjcValue convertValueToObjcValue(ExecState*, JSValue*, ObjcValueType); -JSValue* convertNSStringToString(ExecState* exec, NSString *nsstring); -JSValue* convertObjcValueToValue(ExecState*, void* buffer, ObjcValueType, RootObject*); +ObjcValue convertValueToObjcValue(ExecState*, JSValuePtr, ObjcValueType); +JSValuePtr convertNSStringToString(ExecState* exec, NSString *nsstring); +JSValuePtr convertObjcValueToValue(ExecState*, void* buffer, ObjcValueType, RootObject*); ObjcValueType objcValueTypeForType(const char *type); bool convertJSMethodNameToObjc(const char *JSName, char *buffer, size_t bufferSize); diff --git a/WebCore/bridge/objc/objc_utility.mm b/WebCore/bridge/objc/objc_utility.mm index daab4fe..dbf8c56 100644 --- a/WebCore/bridge/objc/objc_utility.mm +++ b/WebCore/bridge/objc/objc_utility.mm @@ -126,13 +126,13 @@ bool convertJSMethodNameToObjc(const char *JSName, char *buffer, size_t bufferSi [], other exception */ -ObjcValue convertValueToObjcValue(ExecState* exec, JSValue* value, ObjcValueType type) +ObjcValue convertValueToObjcValue(ExecState* exec, JSValuePtr value, ObjcValueType type) { ObjcValue result; double d = 0; - if (value->isNumber() || value->isString() || value->isBoolean()) - d = value->toNumber(exec); + if (value.isNumber() || value.isString() || value.isBoolean()) + d = value.toNumber(exec); switch (type) { case ObjcObjectType: { @@ -142,7 +142,7 @@ ObjcValue convertValueToObjcValue(ExecState* exec, JSValue* value, ObjcValueType RootObject* originRootObject = findRootObject(originGlobalObject); JSGlobalObject* globalObject = 0; - if (value->isObject() && asObject(value)->isGlobalObject()) + if (value.isObject() && asObject(value)->isGlobalObject()) globalObject = static_cast<JSGlobalObject*>(asObject(value)); if (!globalObject) @@ -194,7 +194,7 @@ ObjcValue convertValueToObjcValue(ExecState* exec, JSValue* value, ObjcValueType return result; } -JSValue* convertNSStringToString(ExecState* exec, NSString *nsstring) +JSValuePtr convertNSStringToString(ExecState* exec, NSString *nsstring) { JSLock lock(false); @@ -203,7 +203,7 @@ JSValue* convertNSStringToString(ExecState* exec, NSString *nsstring) chars = (unichar *)malloc(sizeof(unichar)*length); [nsstring getCharacters:chars]; UString u((const UChar*)chars, length); - JSValue* aValue = jsString(exec, u); + JSValuePtr aValue = jsString(exec, u); free((void *)chars); return aValue; } @@ -226,7 +226,7 @@ JSValue* convertNSStringToString(ExecState* exec, NSString *nsstring) id object wrapper other should not happen */ -JSValue* convertObjcValueToValue(ExecState* exec, void* buffer, ObjcValueType type, RootObject* rootObject) +JSValuePtr convertObjcValueToValue(ExecState* exec, void* buffer, ObjcValueType type, RootObject* rootObject) { JSLock lock(false); @@ -253,7 +253,7 @@ JSValue* convertObjcValueToValue(ExecState* exec, void* buffer, ObjcValueType ty return jsNull(); if (obj == 0) return jsUndefined(); - return Instance::createRuntimeObject(exec, ObjcInstance::create(obj, rootObject)); + return ObjcInstance::create(obj, rootObject)->createRuntimeObject(exec); } case ObjcCharType: return jsNumber(exec, *(char*)buffer); |