[webkit-dev] JavaJSObject vs JSObject

Darin Adler darin at apple.com
Mon Mar 21 15:17:37 PDT 2011


On Mar 21, 2011, at 3:03 PM, Per Bothner wrote:

> So I've implemented (a subclass of) netscape.javascript.JSObject to wrap JavaScript objects as java Objects. I've got the essentials working, helped by looking at code in jni_jsobject.mm and JNIUtilityPrivate.cpp.

New code to do this should not work the way the existing JNI code in the “bridge” directory does. That code was written a long time ago when there was no API for JavaScriptCore and the only option was to work with directly with its internals.

JavaScript bindings living outside WebKit that are written today should use the stable JavaScriptCore API, the functions in header files such as JSClassRef.h. Doing it that way you can make something that will continue to work for a long time. If you use the internals the code may constantly need revision.

    -- Darin



More information about the webkit-dev mailing list