[webkit-dev] JS event listener

Luka Napotnik luka.napotnik at gmail.com
Fri Apr 30 01:47:05 PDT 2010


Hello.

I'm trying to hook to JavaScript events so I could listen to events
and recognize when my action on a page has called a JavaScript
function. I've found the JSEventListener::handleEvent() method that
receives events and tries to execute the JS code with:

JSValue retval = handleEventFunction
    ? JSC::call(exec, handleEventFunction, callType, callData, jsFunction, args)
    : JSC::call(exec, jsFunction, callType, callData, toJS(exec,
globalObject, event->currentTarget()), args);

The problem is whenever I look at the type of JSValue it's always
"undefined or null" (retval.isUndefinedOrNull()).

I've binded my own JS callback functions outside the WebKit engine
from my C program which uses WebKit and the callbacks return booleans
(return JSValueMakeBoolean(ctx, true)). Then I binded my JS function
to a page element that calls the function when clicked.

Because the return value of retval should be boolean I don't know why
I'm getting different results. Maybe I don't fully understand the
retval JSValue. Is retval the right way to check return values of my
binded


More information about the webkit-dev mailing list