[webkit-dev] JSC: Callback functions returning exception, what should be the JSValueRef return?

Darin Adler darin at apple.com
Tue Aug 11 11:22:31 PDT 2009

On Aug 11, 2009, at 11:13 AM, Brian Barnes wrote:

> when the class based SET property or a STATIC FUNCTION is called, it  
> detects when an exception is thrown by my replacement of the  
> JSValueRef *exception, correct?


> Also, when an exception I create reaches the top (where I originally  
> called into the script with JSObjectCallAsFunction) how can I  
> determine the line number where the exception happened?

Someone more familiar with it may be able to confirm or deny this, but  
I’m pretty sure that the public API does not give you a way to find  
out the URLs and line numbers involved in an exception.

The URL, line number, and other data about the call stack is  
communicated to the debugger for example, but while the API gives you  
a way to pass these in, it doesn’t give you a way to see them when an  
exception comes out.

That’s something we could add in a future version of the API.

Of course, if the exception is happening inside your C or C++ code,  
then there’s no real JavaScript line number for that, so I presume  
you’re asking for the URL and line number of the first bit of  
JavaScript that was on the call stack at the time the exception was  
created. Maybe the entire call stack would be useful too.

     -- Darin

More information about the webkit-dev mailing list