Fixed <rdar://problem/
3821215> NPN hasMethod and hasProperty functions should take NPObjects, not NPClass
Also changed dashboard regions dictionary to use "control"
for scroller region label, instead of "scroller, per
request from ouch.
Reviewed by Chris.
* Plugins.subproj/npruntime.h:
* WebView.subproj/WebView.m:
(-[WebView _addScrollerDashboardRegions:from:]):
JavaScriptCore:
Fixed <rdar://problem/
3821215> NPN hasMethod and hasProperty functions should take NPObjects, not NPClass
Reviewed by Chris.
* bindings/NP_jsobject.cpp:
(_NPN_GetProperty):
(_NPN_HasProperty):
(_NPN_HasMethod):
* bindings/c/c_class.cpp:
(CClass::methodsNamed):
(CClass::fieldNamed):
* bindings/c/c_class.h:
* bindings/c/c_instance.cpp:
(CInstance::invokeMethod):
* bindings/jni/jni_class.cpp:
(JavaClass::methodsNamed):
* bindings/jni/jni_class.h:
* bindings/npruntime.h:
* bindings/objc/objc_class.h:
* bindings/objc/objc_class.mm:
(ObjcClass::methodsNamed):
* bindings/runtime.h:
* bindings/runtime_object.cpp:
(RuntimeObjectImp::get):
(RuntimeObjectImp::hasProperty):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7742
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2004-09-30 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3821215> NPN hasMethod and hasProperty functions should take NPObjects, not NPClass
+
+ Reviewed by Chris.
+
+ * bindings/NP_jsobject.cpp:
+ (_NPN_GetProperty):
+ (_NPN_HasProperty):
+ (_NPN_HasMethod):
+ * bindings/c/c_class.cpp:
+ (CClass::methodsNamed):
+ (CClass::fieldNamed):
+ * bindings/c/c_class.h:
+ * bindings/c/c_instance.cpp:
+ (CInstance::invokeMethod):
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::methodsNamed):
+ * bindings/jni/jni_class.h:
+ * bindings/npruntime.h:
+ * bindings/objc/objc_class.h:
+ * bindings/objc/objc_class.mm:
+ (ObjcClass::methodsNamed):
+ * bindings/runtime.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::get):
+ (RuntimeObjectImp::hasProperty):
+
2004-09-29 Chris Blumenberg <cblu@apple.com>
Prepended underscores to NPN methods so that when the QT plug-in loads these symbols, it uses the non-underscore versions in WebKit. Without this, the QT plug-in was failing to load when launching Safari from the command-line.
return true;
}
else if (o->_class->hasProperty && o->_class->getProperty) {
- if (o->_class->hasProperty (o->_class, propertyName)) {
+ if (o->_class->hasProperty (o, propertyName)) {
return o->_class->getProperty (o, propertyName, variant);
}
else {
return result;
}
else if (o->_class->hasProperty) {
- return o->_class->hasProperty (o->_class, propertyName);
+ return o->_class->hasProperty (o, propertyName);
}
return false;
}
else if (o->_class->hasMethod) {
- return o->_class->hasMethod (o->_class, methodName);
+ return o->_class->hasMethod (o, methodName);
}
return false;
return "";
}
-MethodList CClass::methodsNamed(const char *_name) const
+MethodList CClass::methodsNamed(const char *_name, Instance *instance) const
{
MethodList methodList;
}
NPIdentifier ident = _NPN_GetStringIdentifier (_name);
- if (_isa->hasMethod && _isa->hasMethod (_isa, ident)){
+ const CInstance *inst = static_cast<const CInstance*>(instance);
+ NPObject *obj = inst->getObject();
+ if (_isa->hasMethod && _isa->hasMethod (obj, ident)){
Method *aMethod = new CMethod (ident);
CFDictionaryAddValue ((CFMutableDictionaryRef)_methods, methodName, aMethod);
methodList.addMethod (aMethod);
}
NPIdentifier ident = _NPN_GetStringIdentifier (name);
- if (_isa->hasProperty && _isa->hasProperty (_isa, ident)){
+ const CInstance *inst = static_cast<const CInstance*>(instance);
+ NPObject *obj = inst->getObject();
+ if (_isa->hasProperty && _isa->hasProperty (obj, ident)){
aField = new CField (ident);
CFDictionaryAddValue ((CFMutableDictionaryRef)_fields, fieldName, aField);
}
virtual const char *name() const;
- virtual MethodList methodsNamed(const char *name) const;
+ virtual MethodList methodsNamed(const char *name, Instance *instance) const;
virtual Field *fieldNamed(const char *name, Instance *instance) const;
method = static_cast<CMethod*>(methodList.methodAt(0));
NPIdentifier ident = _NPN_GetStringIdentifier (method->name());
- if (!_object->_class->hasMethod (_object->_class, ident)) {
+ if (!_object->_class->hasMethod (_object, ident)) {
return Undefined();
}
return aClass;
}
-MethodList JavaClass::methodsNamed(const char *name) const
+MethodList JavaClass::methodsNamed(const char *name, Instance *instance) const
{
CFStringRef methodName = CFStringCreateWithCString(NULL, name, kCFStringEncodingASCII);
MethodList *methodList = (MethodList *)CFDictionaryGetValue(_methods, methodName);
virtual const char *name() const { return _name; };
- virtual MethodList methodsNamed(const char *name) const;
+ virtual MethodList methodsNamed(const char *name, Instance *instance) const;
virtual Field *fieldNamed(const char *name, Instance *instance) const;
typedef NPObject *(*NPAllocateFunctionPtr)(NPP npp, NPClass *aClass);
typedef void (*NPDeallocateFunctionPtr)(NPObject *obj);
typedef void (*NPInvalidateFunctionPtr)(NPObject *obj);
-typedef bool (*NPHasMethodFunctionPtr)(NPClass *theClass, NPIdentifier name);
+typedef bool (*NPHasMethodFunctionPtr)(NPObject *obj, NPIdentifier name);
typedef bool (*NPInvokeFunctionPtr)(NPObject *obj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result);
typedef bool (*NPInvokeDefaultFunctionPtr)(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result);
-typedef bool (*NPHasPropertyFunctionPtr)(NPClass *theClass, NPIdentifier name);
+typedef bool (*NPHasPropertyFunctionPtr)(NPObject *obj, NPIdentifier name);
typedef bool (*NPGetPropertyFunctionPtr)(NPObject *obj, NPIdentifier name, NPVariant *result);
typedef bool (*NPSetPropertyFunctionPtr)(NPObject *obj, NPIdentifier name, const NPVariant *value);
typedef bool (*NPRemovePropertyFunctionPtr)(NPObject *npobj, NPIdentifier name);
virtual const char *name() const;
- virtual MethodList methodsNamed(const char *name) const;
+ virtual MethodList methodsNamed(const char *name, Instance *instance) const;
virtual Field *fieldNamed(const char *name, Instance *instance) const;
return _isa->name;
}
-MethodList ObjcClass::methodsNamed(const char *_name) const
+MethodList ObjcClass::methodsNamed(const char *_name, Instance *instance) const
{
MethodList methodList;
char name[4096];
public:
virtual const char *name() const = 0;
- virtual MethodList methodsNamed(const char *name) const = 0;
+ virtual MethodList methodsNamed(const char *name, Instance *instance) const = 0;
virtual Constructor *constructorAt(long i) const = 0;
virtual long numConstructors() const = 0;
else {
// Now check if a method with specified name exists, if so return a function object for
// that method.
- MethodList methodList = aClass->methodsNamed(propertyName.ascii());
+ MethodList methodList = aClass->methodsNamed(propertyName.ascii(), instance);
if (methodList.length() > 0) {
result = Object (new RuntimeMethodImp(exec, propertyName, methodList));
}
return true;
}
- MethodList methodList = instance->getClass()->methodsNamed(propertyName.ascii());
+ MethodList methodList = instance->getClass()->methodsNamed(propertyName.ascii(), instance);
instance->end();
+2004-09-30 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3821215> NPN hasMethod and hasProperty functions should take NPObjects, not NPClass
+
+ Also changed dashboard regions dictionary to use "control"
+ for scroller region label, instead of "scroller, per
+ request from ouch.
+
+ Reviewed by Chris.
+
+ * Plugins.subproj/npruntime.h:
+ * WebView.subproj/WebView.m:
+ (-[WebView _addScrollerDashboardRegions:from:]):
+
2004-09-30 Chris Blumenberg <cblu@apple.com>
Fixed: <rdar://problem/3498680> switching back and forth between tabs stops calling anything in a plug-in
typedef NPObject *(*NPAllocateFunctionPtr)(NPP npp, NPClass *aClass);
typedef void (*NPDeallocateFunctionPtr)(NPObject *obj);
typedef void (*NPInvalidateFunctionPtr)(NPObject *obj);
-typedef bool (*NPHasMethodFunctionPtr)(NPClass *theClass, NPIdentifier name);
+typedef bool (*NPHasMethodFunctionPtr)(NPObject *obj, NPIdentifier name);
typedef bool (*NPInvokeFunctionPtr)(NPObject *obj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result);
typedef bool (*NPInvokeDefaultFunctionPtr)(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result);
-typedef bool (*NPHasPropertyFunctionPtr)(NPClass *theClass, NPIdentifier name);
+typedef bool (*NPHasPropertyFunctionPtr)(NPObject *obj, NPIdentifier name);
typedef bool (*NPGetPropertyFunctionPtr)(NPObject *obj, NPIdentifier name, NPVariant *result);
typedef bool (*NPSetPropertyFunctionPtr)(NPObject *obj, NPIdentifier name, const NPVariant *value);
typedef bool (*NPRemovePropertyFunctionPtr)(NPObject *npobj, NPIdentifier name);
_private->initiatedDrag = initiatedDrag;
}
+#define DASHBOARD_CONTROL_LABEL @"control"
- (void)_addScrollerDashboardRegions:(NSMutableDictionary *)regions from:(NSArray *)views
{
[[[WebDashboardRegion alloc] initWithRect:adjustedBounds
clip:adjustedClip type:WebDashboardRegionTypeScrollerRectangle] autorelease];
NSMutableArray *scrollerRegions;
- scrollerRegions = [regions objectForKey:@"scroller"];
+ scrollerRegions = [regions objectForKey:DASHBOARD_CONTROL_LABEL];
if (!scrollerRegions) {
scrollerRegions = [NSMutableArray array];
- [regions setObject:scrollerRegions forKey:@"scroller"];
+ [regions setObject:scrollerRegions forKey:DASHBOARD_CONTROL_LABEL];
}
[scrollerRegions addObject:aRegion];
}