[webkit-dev] KJS::JSObject question
jackwootton at gmail.com
Thu May 21 03:49:49 PDT 2009
It seems that the method:
object). However looking at the source code, it is not implemented on
On Sun, May 17, 2009 at 6:30 PM, Darin Adler <darin at apple.com> wrote:
> On May 15, 2009, at 7:35 AM, Jack Wootton wrote:
>> 4. Create the context:
>> JSGlobalContextRef context = JSGlobalContextCreate(globalObjectClass);
> you want to do this in conjunction with WebKit you’ll need to get the
> context from WebKit APIs. On Mac OS X the relevant API is -[WebFrame
>> 1. Who should share the context? Is a single context used for a single
>> webpage / frame?
> See my answer above.
>> 2. Where do I define the class that will actually handle the
>> implementation of any methods on my new object?
> I don’t understand the “where” question. Do it wherever makes sense in your
> program, and call JSClassCreate. Then when it's time to make an object, pass
> the JSClassRef to JSObjectMake.
>> 3. The object has been made using "JSObjectMake", but how is it added to
> A common thing to do is to create an object and then put it in a property of
> the window object, which is the global object inside the web browser. That’s
> done on Mac OS X by implementing the webView:windowScriptObjectAvailable:
> method of the frame load delegate. The window script object is a
> WebScriptObject, and you can get the JSObject version of it by calling the
> JSObject method on it. Then you can set your object as a property of the
> window object with the JSObjectSetProperty function.
> -- Darin
More information about the webkit-dev