Fixed <rdar://problem/3861469> Latest Real player crashes Safari on some...
authorrjw <rjw@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Nov 2004 23:46:31 +0000 (23:46 +0000)
committerrjw <rjw@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Nov 2004 23:46:31 +0000 (23:46 +0000)
        Reviewed by Ken.

        * bindings/c/c_instance.cpp:
        (CInstance::invokeMethod):
        (CInstance::invokeDefaultMethod):
        Initialize out parameters to void type.

        * bindings/c/c_runtime.cpp:
        (CField::valueFromInstance):
        (CField::setValueToInstance):
        Initialize out parameters to void type.
        Also added additional checks to protect against classes that
        don't implement all functions.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7927 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/bindings/c/c_instance.cpp
JavaScriptCore/bindings/c/c_runtime.cpp

index 1678473..23b62c9 100644 (file)
@@ -1,5 +1,23 @@
 2004-11-01  Richard Williamson   <rjw@apple.com>
 
+        Fixed <rdar://problem/3861469> Latest Real player crashes Safari on some sites.
+
+        Reviewed by Ken.
+
+        * bindings/c/c_instance.cpp:
+        (CInstance::invokeMethod):
+        (CInstance::invokeDefaultMethod):
+        Initialize out parameters to void type.
+
+        * bindings/c/c_runtime.cpp:
+        (CField::valueFromInstance):
+        (CField::setValueToInstance):
+        Initialize out parameters to void type.
+        Also added additional checks to protect against classes that 
+        don't implement all functions.
+
+2004-11-01  Richard Williamson   <rjw@apple.com>
+
         Fixed <rdar://problem/3861257> WebUndefined should be returned for undefined values
 
         Reviewed by John.
         (KJS::Bindings::convertObjcValueToValue):
        Added additional conversion WebUndefined -> Undefined.
 
-2004-11-01  Richard Williamson   <rjw@apple.com>
-
-
-        Reviewed by John.
-
-        * bindings/objc/WebScriptObject.mm:
-        (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
-
 2004-11-01  Darin Adler  <darin@apple.com>
 
         - fixed <rdar://problem/3855573> Remove reference to "WebScriptMethods" from WebScriptObject.h comments
index 8062ad1..6b0c188 100644 (file)
@@ -122,6 +122,7 @@ Value CInstance::invokeMethod (KJS::ExecState *exec, const MethodList &methodLis
 
     // Invoke the 'C' method.
     NPVariant resultVariant;
+    VOID_TO_NPVARIANT(resultVariant);
     _object->_class->invoke (_object, ident, cArgs, count, &resultVariant);
 
     for (i = 0; i < count; i++) {
@@ -162,6 +163,7 @@ Value CInstance::invokeDefaultMethod (KJS::ExecState *exec, const List &args)
 
         // Invoke the 'C' method.
         NPVariant resultVariant;
+        VOID_TO_NPVARIANT(resultVariant);
         _object->_class->invokeDefault (_object, cArgs, count, &resultVariant);
 
         for (i = 0; i < count; i++) {
index d431ffa..931c1d5 100644 (file)
@@ -45,9 +45,16 @@ Value CField::valueFromInstance(KJS::ExecState *exec, const Instance *inst) cons
 {
     const CInstance *instance = static_cast<const CInstance*>(inst);
     NPObject *obj = instance->getObject();
+    Value aValue;
     NPVariant property;
-    obj->_class->getProperty (obj, _fieldIdentifier, &property);
-    Value aValue = convertNPVariantToValue (exec, &property);
+    VOID_TO_NPVARIANT(property);
+    if (obj->_class->getProperty) {
+        obj->_class->getProperty (obj, _fieldIdentifier, &property);
+        aValue = convertNPVariantToValue (exec, &property);
+    }
+    else {
+        aValue = Undefined();
+    }
     return aValue;
 }
 
@@ -55,9 +62,11 @@ void CField::setValueToInstance(KJS::ExecState *exec, const Instance *inst, cons
 {
     const CInstance *instance = static_cast<const CInstance*>(inst);
     NPObject *obj = instance->getObject();
-    NPVariant variant;
-    convertValueToNPVariant (exec, aValue, &variant);
-    obj->_class->setProperty (obj, _fieldIdentifier, &variant);
+    if (obj->_class->setProperty) {
+        NPVariant variant;
+        convertValueToNPVariant (exec, aValue, &variant);
+        obj->_class->setProperty (obj, _fieldIdentifier, &variant);
+    }
 }
 
 // ---------------------- CArray ----------------------