[webkit-dev] Extending webkit javascript

Nilesh Patil vniles at gmail.com
Sun Jan 18 21:42:23 PST 2009

OK Thank you for information ..... and correcting me :)

Thanks & Regards

On Mon, Jan 19, 2009 at 10:34 AM, Mark Rowe <mrowe at apple.com> wrote:
> On 2009-01-17, at 07:57, webkitdev at aol.com wrote:
> Hi,
> I am trying to extend the javascript to invoke custom C code in webkit.
> Basically my requirement is to load a webpage that contains the UI built in
> Java script and on some user actions, I need to call C library functions on
> Linux. I looked at the testapi.c in API directory and added similar
> functions in GtkLauncher program(main.c) to add "MyObject". But when a I
> load a webpage containing "MyObject" I am getting error "ReferenceError:
> Can't find variable: MyObject". Then I copied the entire testapi.c into
> GtkLauncher main.c, replaced main() with test_main() and invoked the
> test_api() (along with a few tweaks for the header files .). This way I am
> able to get all the tests (testapi.js) succeed, but I am still getting the
> "ReferenceError". Looking at the code, I see that there is a context that is
> passed, which I believe is not passed to the webview. Is there a way in
> which I can use the same context as the webview and add my object?
> The window-object-cleared signal is emitted when the global context of a
> frame is initialized.  One of the arguments that is passed to this signal
> handler is the JSGlobalContextRef corresponding to the frame's execution
> environment.  You can set your properties on the global object of this
> context to expose them to JavaScript that executes in the context of this
> frame.
> Hope this helps,
> - Mark
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

More information about the webkit-dev mailing list