I have this class
- Code: Select all
class SendTask : public CefTask{
public:
SendTask(V8Callback p, CefV8ValueList a, CefRefPtr<CefV8Value> r){
param = p;
args = a;
retval = r;
}
void Execute(){
try{
CefRefPtr<CefV8Value> ret = param.func->ExecuteFunctionWithContext(param.context, retval, args);
if (ret) {
debug(":)");
} else {
debug(":(");
}
} catch (std::exception& e){
debug( e.what() );
}
}
int AddRef(){}
int Release(){}
int GetRefCt(){}
private:
V8Callback param;
CefV8ValueList args;
CefRefPtr<CefV8Value> retval;
};
I'm seeing that 'ret' is NULL, so the function is failing.
I'm calling this from a function
- Code: Select all
void example_callback(V8Callback param){
CefV8ValueList args;
CefRefPtr<CefV8Exception> exception;
args.push_back(CefV8Value::CreateInt(1)); // <--- this fails
CefRefPtr<CefV8Value> retval = CefV8Value::CreateInt(99);
param.taskrunner->PostTask(new SendTask(param, args, retval));
}
Everything works well until i push a value into args, if i comment that line, i see the alert
The js is as simple as
- Code: Select all
function myFunc() {
for (var i = arguments.length - 1; i >= 0; i--) {
alert(arguments[i]);
};
alert('works');
return true;
}
window.register(myFunc);
I can't find good documentation about this function, what could be happening there?