1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
// This test checks whether attempting to call a proxied JS function (one with __proxy signature) will throw
// an exception.
#include <emscripten.h>
#include <emscripten/wasm_worker.h>
void proxied_js_function(void);
void test_finished()
{
REPORT_RESULT(0);
}
void run_in_worker()
{
int threw = EM_ASM_INT({
try {
_proxied_js_function();
} catch(e) {
console.error(e);
return 1;
}
return 0;
});
if (!threw) {
emscripten_wasm_worker_post_function_v(EMSCRIPTEN_WASM_WORKER_ID_PARENT, test_finished);
}
}
int main()
{
emscripten_wasm_worker_post_function_v(emscripten_malloc_wasm_worker(1024), run_in_worker);
proxied_js_function(); // Pin a dependency from C code to the JS function to avoid needing to mess with cmdline export directives
}
|