Cannot call javascript code from native client

I’m using Unity 4, and I’m trying to create a simple Google Native Client game. I need to call some javascript code from the NaCl module. According to :

“To call browser JavaScript code from NaCl, you can call Application.ExternalCall or Application.ExternalEval. However, Google has removed support for Eval functionality for Chrome Apps, so this will not work when publishing to the Chrome Web Store. To work around this, you can either use Application.ExternalEval to send a string, which you then intercept in your moduleMessage method in unity_nacl.js, or…”

I’m trying to send a string with Application.ExternalEval and decode it in moduleMessage(), but moduleMessage is never receiving the string. I’ve tried:

Application.ExternalEval("window.postMessage(\"MyFunc();\", \"*\");");

But moduleMessage() never receives any new messages. Has anyone gotten this working?


The problem was that my native client module was crashing elsewhere before it could receive the message, the Application.ExternalEval() does send the text string correctly after I fixed the crash.