RESOLVED FIXED 219231
Web Inspector: implement Multimap.prototype.take()
https://bugs.webkit.org/show_bug.cgi?id=219231
Summary Web Inspector: implement Multimap.prototype.take()
Blaze Burg
Reported 2020-11-20 17:34:13 PST
Splitting off from some other work.
Attachments
Patch (8.94 KB, patch)
2020-11-20 17:36 PST, Blaze Burg
no flags
Revised fix (8.72 KB, patch)
2020-11-21 09:59 PST, Blaze Burg
no flags
Blaze Burg
Comment 1 2020-11-20 17:36:33 PST
Devin Rousso
Comment 2 2020-11-20 17:44:55 PST
Comment on attachment 414746 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=414746&action=review r=me, with some behavior changes > Source/WebInspectorUI/UserInterface/Base/Multimap.js:94 > + return new Set; this should be `undefined` to match what `get` does when the `key` is not in `_map` > Source/WebInspectorUI/UserInterface/Base/Multimap.js:101 > + let taken = valueSet.take(value); > + > + if (!valueSet.size) > + this._map.delete(key); > + > + return new Set([taken]); this should match `Set.prototype.take` ``` let result = valueSet.take(value); if (!valueSet.size) this._map.delete(key); return result; ```
Joseph Pecoraro
Comment 3 2020-11-20 17:50:08 PST
Comment on attachment 414746 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=414746&action=review > Source/WebInspectorUI/UserInterface/Base/Utilities.js:187 > - let exists = this.has(key); > - if (exists) > + if (this.has(key)) { > this.delete(key); > - return exists; > + return key; > + } > + > + return undefined; > } We should remove `Set.prototype.take`, it serves no purpose. The way this was originally written seems to be identical to `Set.prototype.delete`. The way this is no written is weird for falsey values (E.g. `if (set.take(0)) { ... }`). Lets just remove it and use `Set.prototype.delete` as appropriate?
Blaze Burg
Comment 4 2020-11-21 09:59:39 PST
Created attachment 414763 [details] Revised fix
EWS
Comment 5 2020-11-21 11:09:14 PST
Committed r270149: <https://trac.webkit.org/changeset/270149> All reviewed patches have been landed. Closing bug and clearing flags on attachment 414763 [details].
Radar WebKit Bug Importer
Comment 6 2020-11-21 11:10:21 PST
Note You need to log in before you can comment on or make changes to this bug.