RESOLVED FIXED230287
Web Inspector: `TreeOutline` should return early when failing to find an ancestor while populating the tree
https://bugs.webkit.org/show_bug.cgi?id=230287
Summary Web Inspector: `TreeOutline` should return early when failing to find an ance...
Patrick Angle
Reported 2021-09-14 18:21:47 PDT
.
Attachments
Patch v1.0 (1.79 KB, patch)
2021-09-14 18:31 PDT, Patrick Angle
no flags
Patch v1.1 (1.79 KB, patch)
2021-09-15 14:37 PDT, Patrick Angle
no flags
Radar WebKit Bug Importer
Comment 1 2021-09-14 18:22:02 PDT
Patrick Angle
Comment 2 2021-09-14 18:31:56 PDT
Created attachment 438201 [details] Patch v1.0
Devin Rousso
Comment 3 2021-09-15 11:20:02 PDT
Comment on attachment 438201 [details] Patch v1.0 View in context: https://bugs.webkit.org/attachment.cgi?id=438201&action=review r=me, good catch :) > Source/WebInspectorUI/UserInterface/Views/TreeOutline.js:518 > item = this.findTreeElement(ancestors[i], isAncestor, getParent); Aside: I wonder if maybe this should just be `this.getCachedTreeElement(ancestors[i])`, as there's really no point to walking up the `getParent` chain again since we've already done that. Tho you might need to duplicate the bit that iterates over `this.children`, but conceptually if we have an item inside `this.children` then it should already be cached. > Source/WebInspectorUI/UserInterface/Views/TreeOutline.js:520 > + return; this should be `return null;` to match the other `return`
Devin Rousso
Comment 4 2021-09-15 11:28:10 PDT
Comment on attachment 438201 [details] Patch v1.0 View in context: https://bugs.webkit.org/attachment.cgi?id=438201&action=review >> Source/WebInspectorUI/UserInterface/Views/TreeOutline.js:518 >> item = this.findTreeElement(ancestors[i], isAncestor, getParent); > > Aside: I wonder if maybe this should just be `this.getCachedTreeElement(ancestors[i])`, as there's really no point to walking up the `getParent` chain again since we've already done that. Tho you might need to duplicate the bit that iterates over `this.children`, but conceptually if we have an item inside `this.children` then it should already be cached. Aside: we may also wanna add an early-return above the `while` if `getParent` is NOT provided, as right now it's kinda this silent assumption 😅
Patrick Angle
Comment 5 2021-09-15 14:37:01 PDT
Created attachment 438291 [details] Patch v1.1
EWS
Comment 6 2021-09-15 15:12:08 PDT
Committed r282477 (241725@main): <https://commits.webkit.org/241725@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 438291 [details].
Note You need to log in before you can comment on or make changes to this bug.