Bug 188484

Summary: [GLIB] Add symbol types
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: New BugsAssignee: Yusuke Suzuki <ysuzuki>
Status: NEW ---    
Severity: Normal CC: achristensen, cgarcia, ews-watchlist, keith_miller, mark.lam, mcatanzaro, msaboff, saam
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Yusuke Suzuki 2018-08-11 12:46:56 PDT
[GLIB] Add symbol types
Comment 1 Yusuke Suzuki 2018-08-11 12:48:35 PDT
Created attachment 346966 [details]
Patch
Comment 2 Yusuke Suzuki 2018-08-11 13:39:15 PDT
Created attachment 346969 [details]
Patch
Comment 3 Carlos Garcia Campos 2018-08-13 00:35:56 PDT
Comment on attachment 346969 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=346969&action=review

What about the new API to get/set/query/delete properties using a symbol as a key? I started this patch adding jsc_value_object_set_property_by_key_value, jsc_value_object_get_property_by_key_value, jsc_value_object_has_property_key_value and jsc_value_object_delete_property_by_key_value. But then I realized that JSCClassRef callbacks only work with string keys.

> Source/JavaScriptCore/API/glib/JSCValue.cpp:500
> +    auto string = String::fromUTF8(data, dataSize);

Since bytes is always going to be used as an UTF-8 string, I think it would be better to not use GBytes. We could allow null-bytes in string using a single function new_symbol() that receives a const char* and gssize length. When -1 is given as length, the string is considered a null terminated string. That's how jsc_context_evaluate works. I know we have new_string_from_bytes(), but in that case it's more obvious that the GBytes is going to be used as a string.
Comment 4 Alex Christensen 2021-11-01 12:50:37 PDT
Comment on attachment 346969 [details]
Patch

This has been requesting review for more than one year.  If this is still needed, please rebase and re-request review.