Bug 205161 - [GLIB] Add GLib specific API for JSC JSValueRef.h's JSValueMakeFromJSONString and JSValueCreateJSONString methods
Summary: [GLIB] Add GLib specific API for JSC JSValueRef.h's JSValueMakeFromJSONString...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Enhancement
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-12-12 07:56 PST by Andres Gomez Garcia
Modified: 2020-01-10 02:54 PST (History)
12 users (show)

See Also:


Attachments
Patch (13.22 KB, patch)
2019-12-16 04:24 PST, Carlos Garcia Campos
aperez: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andres Gomez Garcia 2019-12-12 07:56:21 PST
JSC provides in its C API functions for JSValueMakeFromJSONString:
https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/API/JSValueRef.h#L300

and JSValueCreateJSONString:
https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/API/JSValueRef.h#L311

It would be great if we could have those exposed by specific new GLib API.
Comment 1 Carlos Garcia Campos 2019-12-16 04:24:32 PST
Created attachment 385749 [details]
Patch
Comment 2 Andres Gomez Garcia 2019-12-19 04:21:29 PST
The API proposed LGTM. Thanks a lot, Carlos!

I've not been able to try it yet, though.
Comment 3 Adrian Perez 2020-01-10 02:50:45 PST
Comment on attachment 385749 [details]
Patch

Patch LGTM. This looks very handy to get data in and out of a JSCContext,
nicer than manually lots of API calls to build complex values. Also if some
JSON comes from somewhere else and is to be loaded into a JSCContext, it
seems much better to have this functionality than loading it as a string
and having to use JSON.parse() later on in the JS side.
Comment 4 Carlos Garcia Campos 2020-01-10 02:53:36 PST
Committed r254331: <https://trac.webkit.org/changeset/254331>
Comment 5 Radar WebKit Bug Importer 2020-01-10 02:54:18 PST
<rdar://problem/58474734>