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)
Created attachment 453107 [details] [fast-cq] Patch
Created attachment 453154 [details] [fast-cq] Patch
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.
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.
Created attachment 453367 [details] [fast-cq] Patch
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].
<rdar://problem/89576657>