Asko - 2011-10-24


I have a JS function, which contains a JS callback function, like here:
function foo() {
        console.log("inside foo"); {
                console.log("inside callback window_id "+ window_id);

So when I call 'foo()' from NPAPI with NPN_Invoke(), I get the first log in the console, but not the second (from the callback).  The callback is not being executed as the JS function returns after executing 'foo()' and the callback is queued to be executed after.

So the question is - how to execute a function and all it's consecutive callbacks from NPAPI.

Some additional info: When I put alert() in the end of 'foo()', the callback is being executed, as the 'foo()' function does not return while the alert dialog is open and the callbacks manage to execute, but that's not the intended behavior.

Google Chrome version: 14.0.835.163 beta, 12.0.742.112 (90304) Ubuntu 10.04
Operating System: Ubuntu 10.04.3 LTS