Bug 219483 - [WTF] Avoid JSONValue::create with raw string falling to bool overload
Summary: [WTF] Avoid JSONValue::create with raw string falling to bool overload
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Lauro Moura
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-12-02 22:03 PST by Lauro Moura
Modified: 2020-12-03 02:31 PST (History)
15 users (show)

See Also:


Attachments
Patch (6.77 KB, patch)
2020-12-02 22:05 PST, Lauro Moura
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lauro Moura 2020-12-02 22:03:40 PST
[WTF] Avoid JSONValue::create with raw string falling to bool overload
Comment 1 Lauro Moura 2020-12-02 22:05:11 PST
Created attachment 415278 [details]
Patch
Comment 2 Lauro Moura 2020-12-02 22:22:26 PST
Comment on attachment 415278 [details]
Patch

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

> Source/WTF/wtf/JSONValues.h:81
> +    static Ref<Value> create(T) = delete;

If `create(T)` is too strict, it could use `create(T*)` instead, to avoid only the pointer conversions.
Comment 3 Adrian Perez 2020-12-03 02:09:38 PST
Comment on attachment 415278 [details]
Patch

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

>> Source/WTF/wtf/JSONValues.h:81
>> +    static Ref<Value> create(T) = delete;
> 
> If `create(T)` is too strict, it could use `create(T*)` instead, to avoid only the pointer conversions.

I think this is fine, and forbidding all possible implicit conversions is
probably even a good thing, thus ensuring that only the provided create()
factory functions are ever used.
Comment 4 EWS 2020-12-03 02:30:42 PST
Committed r270391: <https://trac.webkit.org/changeset/270391>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 415278 [details].
Comment 5 Radar WebKit Bug Importer 2020-12-03 02:31:41 PST
<rdar://problem/71930497>