RESOLVED FIXED 237141
Web Inspector: add `IterableWeakSet`
https://bugs.webkit.org/show_bug.cgi?id=237141
Summary Web Inspector: add `IterableWeakSet`
Devin Rousso
Reported 2022-02-24 09:10:02 PST
this allows clients to have a way to have an iterable collection (which btw `WeakSet`/`WeakMap` are not) that doesn't keep the objects in the collection alive (which btw `Set`/`Map`/`Array` do)
Attachments
[fast-cq] Patch (22.53 KB, patch)
2022-02-24 09:22 PST, Devin Rousso
no flags
[fast-cq] Patch (23.95 KB, patch)
2022-02-24 16:31 PST, Devin Rousso
pangle: review+
[fast-cq] Patch (24.01 KB, patch)
2022-02-27 22:28 PST, Devin Rousso
no flags
Devin Rousso
Comment 1 2022-02-24 09:22:02 PST
Created attachment 453107 [details] [fast-cq] Patch
Devin Rousso
Comment 2 2022-02-24 16:31:17 PST
Created attachment 453154 [details] [fast-cq] Patch
Patrick Angle
Comment 3 2022-02-25 13:35:25 PST
Comment on attachment 453154 [details] [fast-cq] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=453154&action=review rs=me Nice! > Source/WebInspectorUI/UserInterface/Base/IterableWeakSet.js:130 > + return Array.from(this); It seems a bit strange to me that it should be possible to mutate the result of `toJSON` as an array (even if those mutations won't affect the underlying backing). Any reason not to call `toJSON` on the created array to avoid that side effect? (`copy()` would need to change slightly if this does, though) > LayoutTests/inspector/unit-tests/iterableweakset-expected.txt:13 > +PASS: has should return true if a key exists. Nit: can we enclose `has` inside back-ticks or some other quote-like character. I read this sentence several times before I realized `has` was a function name, despite the test case header hinting at that 😅. Same throughout below.
Devin Rousso
Comment 4 2022-02-25 16:16:14 PST
Comment on attachment 453154 [details] [fast-cq] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=453154&action=review >> Source/WebInspectorUI/UserInterface/Base/IterableWeakSet.js:130 >> + return Array.from(this); > > It seems a bit strange to me that it should be possible to mutate the result of `toJSON` as an array (even if those mutations won't affect the underlying backing). Any reason not to call `toJSON` on the created array to avoid that side effect? (`copy()` would need to change slightly if this does, though) As discussed offline, this is intended to support `JSON.stringify` <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#tojson_behavior> and is not required to return a `String`. >> LayoutTests/inspector/unit-tests/iterableweakset-expected.txt:13 >> +PASS: has should return true if a key exists. > > Nit: can we enclose `has` inside back-ticks or some other quote-like character. I read this sentence several times before I realized `has` was a function name, despite the test case header hinting at that 😅. Same throughout below. Good idea. Will change.
Devin Rousso
Comment 5 2022-02-27 22:28:11 PST
Created attachment 453367 [details] [fast-cq] Patch
EWS
Comment 6 2022-02-28 13:02:09 PST
Committed r290612 (247885@main): <https://commits.webkit.org/247885@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 453367 [details].
Radar WebKit Bug Importer
Comment 7 2022-02-28 13:03:19 PST
Note You need to log in before you can comment on or make changes to this bug.