Reviewed by Darin.
authorggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 2 Apr 2006 08:55:58 +0000 (08:55 +0000)
committerggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 2 Apr 2006 08:55:58 +0000 (08:55 +0000)
commite9340c93493c1c13b4a755f9151c23d8864f7ee4
tree7f311d5fecf843d71bf28fb69d0b4b0b05d9e21a
parent57640e282233b3a22decf0f437881c0da18fa7db
    Reviewed by Darin.

        - Fixed <rdar://problem/4430836> JavaScript patch crashing Quartz
        Composer

        JSValueWrappers used to hold on to the ExecState that pertained at
        the time of their creation. Since ExecStates are transient, that
        design was totally bogus, and it would crash once the ExecState had
        been deallocated.

        Unfortunately, there's no clean solution to this problem, since
        the JSGlue API has no notion of state. The solution here is to use
        a shared, global ExecState for the purpose of JSGlue calls. Given
        the pre-existing limitations in the JSGlue API, this design
        shouldn't actually introduce any new limitations (see comments in
        JSValueWrapper.cpp).

        I tested with Quartz Composer and PAC files, neither of which are
        layout-testable.

        * JSUtils.cpp:
        (KJSValueToJSObject):
        * JSValueWrapper.cpp:
        (JSValueWrapper::JSValueWrapper):
        (JSValueWrapper::GetValue):
        (getProcessGlobalExecState):
        (JSValueWrapper::JSObjectCopyPropertyNames):
        (JSValueWrapper::JSObjectCopyProperty):
        (JSValueWrapper::JSObjectSetProperty):
        (JSValueWrapper::JSObjectCallFunction):
        (JSValueWrapper::JSObjectCopyCFValue):
        * JSValueWrapper.h:

        Also added a test harness file. It was helpful while I was testing,
        and may come in handy in the future:

        * JavaScriptGlue.xcodeproj/project.pbxproj:
        testjsglue.cpp: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@13635 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JavaScriptGlue/ChangeLog
JavaScriptGlue/JSUtils.cpp
JavaScriptGlue/JSValueWrapper.cpp
JavaScriptGlue/JSValueWrapper.h
JavaScriptGlue/JavaScriptGlue.xcodeproj/project.pbxproj
JavaScriptGlue/testjsglue.cpp [new file with mode: 0644]