Reviewed by Maciej.
authorggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Nov 2005 05:15:02 +0000 (05:15 +0000)
committerggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Nov 2005 05:15:02 +0000 (05:15 +0000)
        - Fixed <rdar://problem/4334445> installer crashed on my
          dual g4 450Mhz after clicking language

        - Reversed backwards NULL check.
        - Inserted guards against NULL fJSUserObject data member.
        - Cleaned up some style.

        * JSUtils.cpp:
        (KJSValueToCFTypeInternal):
        * UserObjectImp.cpp:
        (UserObjectImp::~UserObjectImp):
        (UserObjectImp::callAsFunction):
        (UserObjectImp::userObjectGetter):
        (UserObjectImp::getOwnPropertySlot):
        (UserObjectImp::put):
        (UserObjectImp::mark):

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

JavaScriptGlue/ChangeLog
JavaScriptGlue/JSUtils.cpp
JavaScriptGlue/UserObjectImp.cpp

index 7ed3784..01016e4 100644 (file)
@@ -1,3 +1,24 @@
+2005-11-10  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Maciej.
+
+        - Fixed <rdar://problem/4334445> installer crashed on my 
+          dual g4 450Mhz after clicking language
+
+        - Reversed backwards NULL check.
+        - Inserted guards against NULL fJSUserObject data member.
+        - Cleaned up some style.
+
+        * JSUtils.cpp:
+        (KJSValueToCFTypeInternal):
+        * UserObjectImp.cpp:
+        (UserObjectImp::~UserObjectImp):
+        (UserObjectImp::callAsFunction):
+        (UserObjectImp::userObjectGetter):
+        (UserObjectImp::getOwnPropertySlot):
+        (UserObjectImp::put):
+        (UserObjectImp::mark):
+
 2005-11-04  Timothy Hatcher  <timothy@apple.com>
 
         Reviewed by Darin.
index cd80f43..debfaa8 100644 (file)
@@ -190,12 +190,12 @@ ValueImp *JSObjectKJSValue(JSUserObject* ptr)
 // Caller is responsible for releasing the returned CFTypeRef
 CFTypeRef KJSValueToCFTypeInternal(ValueImp *inValue, ExecState *exec, ObjectImpList* inImps)
 {
-    if (inValue)
+    if (!inValue)
         return 0;
 
     CFTypeRef result = 0;
 
-        InterpreterLock lock;
+    InterpreterLock lock;
 
     switch (inValue->type())
     {
index 34517fa..d327f86 100644 (file)
@@ -42,9 +42,7 @@ UserObjectImp::UserObjectImp(JSUserObject* userObject) :
 UserObjectImp::~UserObjectImp()
 {
     if (fJSUserObject)
-    {
         fJSUserObject->Release();
-    }
 }
 
 const ClassInfo * UserObjectImp::classInfo() const
@@ -80,6 +78,8 @@ ValueImp *UserObjectImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, con
             Interpreter::unlock();
         }
 
+        // implementsCall should have guarded against a NULL fJSUserObject.
+        assert(fJSUserObject);
         JSUserObject* jsResult = fJSUserObject->CallFunction(jsThisObj, jsArgs);
 
         for (i = 0; i < lockCount; i++) {
@@ -120,6 +120,9 @@ ReferenceList UserObjectImp::propList(ExecState *exec, bool recursive)
 ValueImp *UserObjectImp::userObjectGetter(ExecState *, const Identifier& propertyName, const PropertySlot& slot)
 {
     UserObjectImp *thisObj = static_cast<UserObjectImp *>(slot.slotBase());
+    // getOwnPropertySlot should have guarded against a null fJSUserObject.
+    assert(thisObj->fJSUserObject);
+    
     CFStringRef cfPropName = IdentifierToCFString(propertyName);
     JSUserObject *jsResult = thisObj->fJSUserObject->CopyProperty(cfPropName);
     ReleaseCFType(cfPropName);
@@ -131,6 +134,9 @@ ValueImp *UserObjectImp::userObjectGetter(ExecState *, const Identifier& propert
 
 bool UserObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
 {
+    if (!fJSUserObject)
+        return false;
+
     CFStringRef cfPropName = IdentifierToCFString(propertyName);
     JSUserObject *jsResult = fJSUserObject->CopyProperty(cfPropName);
     ReleaseCFType(cfPropName);
@@ -151,6 +157,9 @@ bool UserObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& proper
 
 void UserObjectImp::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
 {
+    if (!fJSUserObject)
+        return;
+    
     CFStringRef cfPropName = IdentifierToCFString(propertyName);
     JSUserObject *jsValueObj = KJSValueToJSObject(value, exec);
 
@@ -413,8 +422,7 @@ UString UserObjectImp::toString(ExecState *exec) const
 
 void UserObjectImp::mark()
 {
-    ObjectImp::mark(); // call parent to mark self
-    if (fJSUserObject) {
-        fJSUserObject->Mark(); // mark child
-    }
+    ObjectImp::mark();
+    if (fJSUserObject)
+        fJSUserObject->Mark();
 }