| Summary: | Web Inspector: ensure that `JSON::ArrayOf<T>` doesn't allow `addItem` to be called with a type other than `T` | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Devin Rousso <hi> | ||||||
| Component: | Web Inspector | Assignee: | Devin Rousso <hi> | ||||||
| Status: | RESOLVED FIXED | ||||||||
| Severity: | Normal | CC: | bburg, benjamin, cdumez, cmarcelo, ews-watchlist, hi, inspector-bugzilla-changes, joepeck, keith_miller, mark.lam, msaboff, saam, tzagallo, webkit-bug-importer | ||||||
| Priority: | P2 | Keywords: | InRadar | ||||||
| Version: | WebKit Nightly Build | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=219483 | ||||||||
| Attachments: |
|
||||||||
Created attachment 413529 [details]
Patch
Created attachment 413563 [details]
Patch
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 on attachment 413563 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=413563&action=review r=me > 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. Committed r269757: <https://trac.webkit.org/changeset/269757> All reviewed patches have been landed. Closing bug and clearing flags on attachment 413563 [details]. |
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.