[webkit-dev] Issue with calling javascript function from a external thread

Julien Chaffraix julien.chaffraix at gmail.com
Fri Aug 10 03:00:43 PDT 2007


Hi all,

I am trying to make a wrapper in C++ for the Ivy protocol for OWB (I think
it could work on Webkit even though I have not tested) that could world
entirely in javascript. Ivy is a light-weigh publish/subscribe protocol. It
is based on callback functions that you call  when a regExp is seen on the
bus.

My main problem is that the thread that calls back functions is the thread
that handles incoming transmissions, that is not one of Webkit threads.

As my problem seems close to what is done in XMLHttpRequest, I have tried
mecanisms used by that class and particularly reusing the code from
JSAbstractEventListener::handleEvent to call my object. The callback seems
to work but developing  a javascript application on top of that lead me to
discover that some part of javascript are not working : for example,
accessing some (not all) element with document.getElementById("...") does
return "null" in the callback (but works in the Webkit threads) even though
I could access it directly in C++ through Document::getElementById.

I do not know much about what I have done wrong but I am eager to do the
necessary debugging and testing.

Maybe also my method is not the best so if someone has a better idea, he is
more than welcome.

Thanks,

Julien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/webkit-dev/attachments/20070810/bfefecf4/attachment.html


More information about the webkit-dev mailing list