[webkit-help] JavascriptCore: functions executing on a native timer
Arunprasad Rajkumar
ararunprasad at gmail.com
Sun Feb 17 23:20:20 PST 2013
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 <spencerkohan at gmail.com> 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
> webkit-help at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-help
>
>
--
*Arunprasad Rajkumar*
http://in.linkedin.com/in/ararunprasad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20130218/ce70b5e7/attachment.html>
More information about the webkit-help
mailing list