RESOLVED FIXED 30337
Web Inspector: Should be able to delete nodes from the Elements Tree
https://bugs.webkit.org/show_bug.cgi?id=30337
Summary Web Inspector: Should be able to delete nodes from the Elements Tree
Brian Weinstein
Reported 2009-10-13 10:49:41 PDT
If you are trying to create a reduced test case, or figure out which element is causing layout bugs, it would be nice to be able to delete nodes from the Web Inspector Elements Tree by pressing delete when a node is selected.
Attachments
Fix (6.90 KB, patch)
2009-10-13 11:00 PDT, Brian Weinstein
timothy: review-
bweinstein: commit-queue-
Addresses Tim's comments (6.83 KB, patch)
2009-10-13 11:45 PDT, Brian Weinstein
timothy: review+
bweinstein: commit-queue-
Fixes Leak (2.54 KB, patch)
2009-10-13 12:55 PDT, Brian Weinstein
pfeldman: review+
bweinstein: commit-queue-
Brian Weinstein
Comment 1 2009-10-13 11:00:58 PDT
Timothy Hatcher
Comment 2 2009-10-13 11:05:52 PDT
Comment on attachment 41113 [details] Fix Feedback given in person.
Brian Weinstein
Comment 3 2009-10-13 11:45:34 PDT
Created attachment 41116 [details] Addresses Tim's comments
Timothy Hatcher
Comment 4 2009-10-13 11:55:04 PDT
Comment on attachment 41116 [details] Addresses Tim's comments > + if (code != 0) No need for "!= 0" here. > + var self = this; Move this line closer to the removeNodeCallback function. > + function removeNodeCallback(removedNodeId) { Put the brace on the next line.
Pavel Feldman
Comment 5 2009-10-13 12:08:47 PDT
> +void InspectorBackend::removeNode(long callId, long nodeId) > +{ > + Node* node = nodeForId(nodeId); > + if (!node) > + return; > + > + Node* parentNode = node->parentNode(); > + if (!parentNode) > + return; > + > + ExceptionCode code; > + parentNode->removeChild(node, code); > + > + if (code != 0) > + return; Returns above prevent you from calling didRemoveNode callback. This results in memory leaks on the frontend side. All callbacks should be actually called so that all functions are released in the frontend. You can add success/result code parameter there if you need code to behave differently depending on the operation outcome. > - if (!updateBreadcrumbs && (this.focusedDOMNode === parent || isAncestor(this.focusedDOMNode, parent))) > + if (!updateBreadcrumbs && (this.focusedDOMNode === parent || isAncestorNode(this.focusedDOMNode, parent))) Thanks for fixing it. My git branch for that got lost... > + function removeNodeCallback(removedNodeId) { { should be on the next line.
Brian Weinstein
Comment 6 2009-10-13 12:55:57 PDT
Created attachment 41118 [details] Fixes Leak
Pavel Feldman
Comment 7 2009-10-13 13:01:55 PDT
Comment on attachment 41118 [details] Fixes Leak > + if (removedNodeId == -1) > + return; Use removedNodeId === -1 instead.
Brian Weinstein
Comment 8 2009-10-15 14:32:43 PDT
Note You need to log in before you can comment on or make changes to this bug.