Hi,
I am creating a JS function with JSObjectMakeFunctionWithCallback().
Callback signature will be
JSValueRef my_func(JSContextRef ctx, JSObjectRef function, JSObjectRef
thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef
*exception)
Now instead of serving the request, i want to send a message to windows
message loop (I am working on windows). Here, I need to save the stack of
the argumets[] which is of type JSValueRef, const.
Approach I:
I tried to protect all elements from arguments array, by looping through,
didn't work.
//Protect the each memeber of the JSValueRef array, Not working
for(i = 0; i < argumentCount; i++){
JSValueProtect(ctx, arguments[i]);
}
jsObject->arguments = (JSValueRef *) arguments;*/
Approach II:
I simply created a deep copy of the array using memcpy, which worked.
//Alternate Approach
//Copy the entire array here
jsObject->arguments = (JSValueRef
*)malloc(sizeof(JSValueRef)*argumentCount);
memcpy(jsObject->arguments, arguments,
sizeof(JSValueRef)*argumentCount);
NOTE: jsObject is object of my stack struct.
Is it correct? Is there any other approach to do this?
Dhanyawaad (Thanks)
--
Namaskar,
Sumedh S Bhogle
Mumbai | Mob. 09969085122
_______________________________________________
webkit-help mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-help