[webkit-qt] Adding Javascript Bindings

Michael Ditum mike at mikeditum.co.uk
Fri Dec 17 07:38:52 PST 2010

On Fri, Dec 17, 2010 at 1:03 AM, Benjamin Poulain <
benjamin.poulain at nokia.com> wrote:

> On 12/17/2010 01:20 AM, ext Michael Ditum wrote:
>> It would probably be a good idea to get the documentation
>> updated, should I raise this on http://bugreports.qt.nokia.com or
>> somewhere else?
> No'am (who is passioned about having addToJavaScriptWindowObject() works
> seemlessly) recently worked to get a better documentation:
> http://doc.qt.nokia.com/4.7-snapshot/qtwebkit-bridge.html (it quite very
> recent so maybe not well indexed by Google).
> He also made examples which are in review by the doc team. So hopefully the
> doc about the JavaScript binding will improve  :)


That document is a huge improvement and was very enlightening! After reading
it through and playing with implementing some of the features detailed I've
thought of one more question...

Is there any way of throwing errors that the javascript can handle?

The main reason I can see this being useful is if someone calls a function
and one of the parameters is incorrect or the internal state of the object
is invalid for that call it would be nice to throw an error so the
javascript user has an idea why it didn't work. For example I have a
function that returns an item based on it's index, if the supplied index
doesn't exist I want to be able to throw an error stating this.

This is currently done within qt-webkit if, for example, you pass in a
integer as the first parameter to the connect function. However looking at
the code in qt_runtime.cpp their doesn't seem to be a way of calling similar
code. I tried throwing an exeception but that behaves just like a normal
uncaught exception crashing my app.

Again thanks for your help!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20101217/4eaf1bc6/attachment.html>

More information about the webkit-qt mailing list