[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:43:44 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 5e06d84bf818ea6b1cdc9951685e0b8e9a34a551
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jun 4 17:54:29 2004 +0000

            Fixed crash when attempting to access properties on nil
            object.
    
            Reviewed by John.
    
            * bindings/objc/objc_instance.mm:
            (ObjcInstance::getClass):
            * bindings/runtime_object.cpp:
            (RuntimeObjectImp::get):
            * bindings/testM.js:
            * bindings/testbindings.mm:
            (-[MyFirstInterface getString]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6763 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 519300b..cc20527 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,18 @@
+2004-06-04  Richard Williamson   <rjw at apple.com>
+
+        Fixed crash when attempting to access properties on nil
+        object.
+        
+        Reviewed by John.
+
+        * bindings/objc/objc_instance.mm:
+        (ObjcInstance::getClass):
+        * bindings/runtime_object.cpp:
+        (RuntimeObjectImp::get):
+        * bindings/testM.js:
+        * bindings/testbindings.mm:
+        (-[MyFirstInterface getString]):
+
 2004-05-27  Kevin Decker  <kdecker at apple.com>
 
         Reviewed by Ken.
diff --git a/JavaScriptCore/bindings/objc/objc_instance.mm b/JavaScriptCore/bindings/objc/objc_instance.mm
index afb88d0..7a24262 100644
--- a/JavaScriptCore/bindings/objc/objc_instance.mm
+++ b/JavaScriptCore/bindings/objc/objc_instance.mm
@@ -97,6 +97,9 @@ void ObjcInstance::end()
 
 Bindings::Class *ObjcInstance::getClass() const 
 {
+    if (_instance == 0)
+        return 0;
+        
     if (_class == 0) {
         _class = ObjcClass::classForIsA(_instance->isa);
     }
diff --git a/JavaScriptCore/bindings/runtime_object.cpp b/JavaScriptCore/bindings/runtime_object.cpp
index b8147fd..67738e7 100644
--- a/JavaScriptCore/bindings/runtime_object.cpp
+++ b/JavaScriptCore/bindings/runtime_object.cpp
@@ -63,18 +63,22 @@ Value RuntimeObjectImp::get(ExecState *exec, const Identifier &propertyName) con
 {
     instance->begin();
     
-    // See if the instance have a field with the specified name.
-    Field *aField = instance->getClass()->fieldNamed(propertyName.ascii());
-    if (aField) {
-        return instance->getValueOfField (exec, aField); 
-    }
+    Class *aClass = instance->getClass();
     
-    // Now check if a method with specified name exists, if so return a function object for
-    // that method.
-    MethodList methodList = instance->getClass()->methodsNamed(propertyName.ascii());
-    if (methodList.length() > 0) {
-        instance->end();
-        return Object (new RuntimeMethodImp(exec, propertyName, methodList));
+    if (aClass) {
+        // See if the instance have a field with the specified name.
+        Field *aField = aClass->fieldNamed(propertyName.ascii());
+        if (aField) {
+            return instance->getValueOfField (exec, aField); 
+        }
+        
+        // Now check if a method with specified name exists, if so return a function object for
+        // that method.
+        MethodList methodList = aClass->methodsNamed(propertyName.ascii());
+        if (methodList.length() > 0) {
+            instance->end();
+            return Object (new RuntimeMethodImp(exec, propertyName, methodList));
+        }
     }
     
     instance->end();
diff --git a/JavaScriptCore/bindings/testM.js b/JavaScriptCore/bindings/testM.js
index 6d17563..7985d21 100644
--- a/JavaScriptCore/bindings/testM.js
+++ b/JavaScriptCore/bindings/testM.js
@@ -14,7 +14,7 @@ myInterface.callJSObject__(8,9);
 
 myInterface.logMessage ("myInterface.setInt_(666) = " + myInterface.setInt_(666));
 myInterface.logMessage ("myInterface.getInt() = " + myInterface.getInt());
-myInterface.logMessage ("myInterface.getString() = " + myInterface.getString());
+myInterface.logMessage ("myInterface.getString().foo() = " + myInterface.getString().foo());
 myInterface.logMessage ("myInterface.myInt = " + myInterface.myInt);
 myInterface.logMessage ("setting myInterface.myInt = 777");
 myInterface.myInt = 777;
diff --git a/JavaScriptCore/bindings/testbindings.mm b/JavaScriptCore/bindings/testbindings.mm
index b6d8ed1..397514c 100644
--- a/JavaScriptCore/bindings/testbindings.mm
+++ b/JavaScriptCore/bindings/testbindings.mm
@@ -64,6 +64,7 @@
 	int myInt;
 	MySecondInterface *mySecondInterface;
 	id jsobject;
+	NSString *string;
 }
 
 - (int)getInt;
@@ -114,7 +115,7 @@
 
 - (NSString *)getString
 {
-	return @"This is a string from ObjC";
+	return string;
 }
 
 - (MySecondInterface *)getMySecondInterface 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list