[Webkit-unassigned] [Bug 32283] New: It seems that Exceptions aren't handled properly in C callback functions when embedding Javascriptcore.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Dec 8 12:50:02 PST 2009


https://bugs.webkit.org/show_bug.cgi?id=32283

           Summary: It seems that Exceptions aren't handled properly in C
                    callback functions when embedding Javascriptcore.
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Macintosh
        OS/Version: Mac OS X 10.5
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: martin at cheetah3d.de


Throwing exceptions in a C callback function when embedding the Javascript core
doesn't seem to work properly. When an exception is thrown in a C callback
function the execution of the script is stopped and an exception is generated
in

     JSEvaluateScript()

with the line number where the exception was caused. But the exception message
gets lost.  Below is an example how I generate my exception messages. But I've
also attached a small example app which shows the problem.

Many thanks for your help.

Bye,
Martin

static JSValueRef JSVec3D_add(JSContextRef ctx, JSObjectRef function,
JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
JSValueRef* exception)
{
    if(argumentCount==1){
    JSObjectRef    newobj=JSObjectMake(ctx,vec3D_class,NULL);
    Vec3f        *erg = (Vec3f*)JSObjectGetPrivate(newobj);
    Vec3f        *vec = (Vec3f*)JSObjectGetPrivate(thisObject);
    Vec3f        *vec0 =
(Vec3f*)JSObjectGetPrivate(JSValueToObject(ctx,arguments[0],NULL));

    *erg=(*vec)+(*vec0);
    return newobj;
    }
    else{
    // Throw an exception
    JSStringRef string = JSStringCreateWithUTF8CString("Wrong number of
arguments");
    JSValueRef exceptionString =JSValueMakeString(ctx, string);
    JSStringRelease(string);

    *exception = JSValueToObject(ctx, exceptionString, NULL);
    return NULL;
    }
}

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list