CommonAPI: JS: fix crash with JS callback