Bug 188484 - [GLIB] Add symbol types
Summary: [GLIB] Add symbol types
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-11 12:46 PDT by Yusuke Suzuki
Modified: 2021-11-01 12:50 PDT (History)
8 users (show)

See Also:


Attachments
Patch (6.68 KB, patch)
2018-08-11 12:48 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (7.37 KB, patch)
2018-08-11 13:39 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.