[Webkit-unassigned] [Bug 193530] New: [webkit2gtk][JavaScriptCore glib] typeof "API created function" == "string"

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 17 00:05:17 PST 2019


https://bugs.webkit.org/show_bug.cgi?id=193530

            Bug ID: 193530
           Summary: [webkit2gtk][JavaScriptCore glib] typeof "API created
                    function" == "string"
           Product: WebKit
           Version: WebKit Local Build
          Hardware: PC
                OS: Linux
            Status: NEW
          Keywords: Gtk
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: crispyfrog at 163.com

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] } */

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190117/849bd833/attachment.html>


More information about the webkit-unassigned mailing list