May be reference count issue? Try to increase the reference count of the
cached function using JSValueProtect. While cleanup the cached object
use JSValueUnprotect.

On 18 February 2013 11:18, Spencer Kohan <[email protected]> wrote:

> 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.
>
> _______________________________________________
> webkit-help mailing list
> [email protected]
> https://lists.webkit.org/mailman/listinfo/webkit-help
>
>


-- 
*Arunprasad Rajkumar*
http://in.linkedin.com/in/ararunprasad
_______________________________________________
webkit-help mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-help

Reply via email to