On May 26, 2009, at 8:32 AM, Jack Wootton wrote:
1. I'm attempting to use the JavaScriptCore API to add new JSObjects
to the JavaScript environment. In order to use the API I include
"JavaScriptCore.h". However in doing so, JSStringRefCF.h contains
errors. The system include CoreFoundation/CoreFoundation.h cannot be
opened. Has anyone had this problem before?
The JavaScriptCore.h header is a Mac OS X Framework header, and
intended for use only on Mac OS X.
On other platforms it shouldn't even be installed. You can include the
individual header, or if you want a similar "includes it all" header
on some other platform or for cross-platform code, use JavaScript.h.
2. After a JSObject has been successfully created using the
JavaScriptCore API, is it correct to use the following method to add
it to the JavaScript environment:
void Window::put(ExecState* exec, const Identifier& propertyName,
JSValue* value, int attr)
No. That is only for internal use within WebCore. You’ll need to get a
JSObjectRef for the window object. How you do that depends on the
platform you're on. Since you don't say what platform you're working
on I can't tell you how to do it. On Mac OS X you would implement the
frame load delegate webView:windowScriptObjectAvailable: method and
then call the JSObjectRef method on the Objective-C object from that
method.
-- Darin
_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev