I'm trying to use the JavaScriptCore glib API to define some native functions for use in user scripts, they work great so far, but somehow the js user script typeof doesn't recognize them as "function". For example: /* web-extension.c */ static void zzz(void) { printf("zzz\n"); } static void windowobjectcleared(WebKitScriptWorld *w, WebKitWebPage *wp, WebKitFrame *frame, gpointer unused) { JSCContext *ctx; ctx = webkit_frame_get_js_context_for_script_world(frame, w); jsc_context_set_value(ctx, "zzz", jsc_value_new_function( ctx, "zzz", (GCallback)zzz, NULL, NULL, G_TYPE_NONE, 0)); } /* user-script.js */ console.log(typeof 'zzz'); /* logs string instead of function */ console.log(zzz); /* function zzz() { [native code] } */
my bad, it's not a bug. I shouldn't have put quotes around the function name.