[webkit-qt] Adding Javascript Bindings

Benjamin Poulain benjamin.poulain at nokia.com
Sat Dec 18 08:25:39 PST 2010


On 12/17/2010 04:38 PM, ext Michael Ditum wrote:
> 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.

Unfortunatelly, throwing exception is at lot harder to handle than 
proxying objects.

Kent recently looked at the problem. Here are two bugs related to the 
problem:
https://bugs.webkit.org/show_bug.cgi?id=49725
https://bugs.webkit.org/show_bug.cgi?id=49720

There is also the problem of passing exception from C++->JS or 
C++->JS->C++. This is unlikely to be solved anytime soon.

cheers,
Benjamin


More information about the webkit-qt mailing list