Bug 218686 - Web Inspector: ensure that `JSON::ArrayOf<T>` doesn't allow `addItem` to be called with a type other than `T`
Summary: Web Inspector: ensure that `JSON::ArrayOf<T>` doesn't allow `addItem` to be c...
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
Keywords: InRadar
Depends on:
Reported: 2020-11-07 11:16 PST by Devin Rousso
Modified: 2020-12-02 22:08 PST (History)
14 users (show)

See Also:

Patch (2.94 KB, patch)
2020-11-07 11:16 PST, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (60.43 KB, patch)
2020-11-08 23:58 PST, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2020-11-07 11:16:04 PST
Right now, `JSON::ArrayOf<T>` always has `addItem` overloads for `int`, `double`, `String`, and `Ref<T>` (even when `T` is not a `JSON::Value`).  This means that I could have a `JSON::ArrayOf<int>` and call `addItem(42.0)` or `addItem("foo"_s)` and it would work.  We should prevent that.
Comment 1 Devin Rousso 2020-11-07 11:16:36 PST
Created attachment 413529 [details]
Comment 2 Devin Rousso 2020-11-08 23:58:56 PST
Created attachment 413563 [details]
Comment 3 EWS Watchlist 2020-11-08 23:59:53 PST
This patch modifies the inspector protocol generator. Please ensure that you have rebaselined any generator test results (i.e., by running `Tools/Scripts/run-inspector-generator-tests --reset-results`)
Comment 4 BJ Burg 2020-11-12 14:32:08 PST
Comment on attachment 413563 [details]

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


> Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator_templates.py:142
> +    static NeverDestroyed<DispatchMap> dispatchMap = DispatchMap({


> Source/JavaScriptCore/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result:342
> +    static NeverDestroyed<DispatchMap> dispatchMap = DispatchMap({

Ugh, you are the best, Devin! This is so much nicer.
Comment 5 EWS 2020-11-12 14:54:41 PST
Committed r269757: <https://trac.webkit.org/changeset/269757>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 413563 [details].
Comment 6 Radar WebKit Bug Importer 2020-11-12 14:55:19 PST