[webkit-help] JavascriptCore: functions executing on a native timer

Spencer Kohan spencerkohan at gmail.com
Sun Feb 17 21:48:39 PST 2013


I'm working on a simple application where a few JS functions are cached
during setup and then called repeatedly on a timer.  I'm getting a failed
assertion when the cached script is called, and I don't know how to debug
it.

So my C application looks something like this:

    static JSContextRef cachedFunctionContext;

    static JSObjectRef cachedFunction;

    //this callback caches the 'tick' function defined in the setup script

    JSValueRef setTickFunctionCallback(JSContextRef ctx, JSObjectRef
function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef
arguments[], JSValueRef *exception){

        cachedFunction = arguments[0];

        cachedFunctionContext = ctx;

        JSValueProtect(ctx, cachedFunction);

        return JSValueMakeNull(ctx);

    }

    //this function runs the setup script

    void setup(const char* setupScript){

        //setup context and native callbacks

        JSEvaluateScript(context, scriptJS, NULL, NULL, 0, NULL);

    }

    //this function is called on a timer

    void tick(){

         JSObjectCallAsFunction(cachedFunctionContext, cachedFunction,
NULL, 0, NULL, NULL);

    }

And my setup script looks something like this:

    var setup = function() {

        setTickFunction(function(){

            //do something

        });

    }

    setup();

But during execution, I get this assertion failure I don't know how to
interpret:

*ASSERTION FAILED: callFrame->frameExtent() <= oldEnd || callFrame ==
callFrame->scopeChain()->globalObject->globalExec()*

Any insight into what I might be doing wrong would be greatly appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20130218/8b88edc9/attachment.html>


More information about the webkit-help mailing list