RESOLVED DUPLICATE of bug 66868 106435
Web Inspector: add a new protocol method to InspectorDOMAgent to be able to request child nodes at a given depth
https://bugs.webkit.org/show_bug.cgi?id=106435
Summary Web Inspector: add a new protocol method to InspectorDOMAgent to be able to r...
Antoine Quint
Reported 2013-01-09 03:10:41 PST
In order to facilitate true deep expansion of nodes in the DOM tree (see https://bugs.webkit.org/show_bug.cgi?id=66868), we should be able to pass an extra parameter to InspectorDOMAgent::requestChildNodes(), and subsequently pushChildNodesToFrontend(), to specify the depth at which we want to gather children of a given node. This should be relatively easy since the method buildArrayForContainerChildren() already has support for specifying the depth and pushChildNodesToFrontend() relies on this method to gather the child nodes.
Attachments
Patch (5.62 KB, patch)
2013-01-09 14:18 PST, Antoine Quint
joepeck: review-
Radar WebKit Bug Importer
Comment 1 2013-01-09 03:11:09 PST
Antoine Quint
Comment 2 2013-01-09 03:21:53 PST
While it would be simpler to just add an extra parameter to existing methods, the fact that in the DOM API a node's .childNodes are always the immediate descendant might prompt us to actually introduce other method with naming that might more appropriate. I'd like to hear people's suggestions on the topic.
Joseph Pecoraro
Comment 3 2013-01-09 10:45:48 PST
Ahh, so you think it would be clearer to have a function requestChildNodesWithDepth instead of requestChildNodes(depth). That seems fine to me. I don't have a preference.
Antoine Quint
Comment 4 2013-01-09 14:18:06 PST
Joseph Pecoraro
Comment 5 2013-01-09 14:37:54 PST
View in context: https://bugs.webkit.org/attachment.cgi?id=181982&action=review > Source/WebCore/inspector/InspectorDOMAgent.cpp:488 > + pushChildNodesToFrontend(nodeId, depth); You should produce an error or handle the case of depth <= 0. Negative doesn't make sense, and it looks like 0 is a special case internally to only get the text node children. Also document this in the protocol file. An existing example would be setDeviceMetricsOverride. It documents its range in Inspector.json and produces an error for negative values. You could also add an ASSERT in buildArrayForContainerChildren that depth is >= 0.
Joseph Pecoraro
Comment 6 2013-01-09 14:38:38 PST
Comment on attachment 181982 [details] Patch r=me with handling <= 0
Joseph Pecoraro
Comment 7 2013-01-09 14:39:48 PST
You may also want to update the title of the bug + thus ChangeLog. Since now you're not adding a param, you're adding a new function.
Joseph Pecoraro
Comment 8 2013-01-09 14:43:30 PST
Comment on attachment 181982 [details] Patch Actually, this probably requires at least a basic test. r- for an updated patch containing a test.
Pavel Feldman
Comment 9 2013-01-10 05:41:09 PST
Comment on attachment 181982 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=181982&action=review You need a test and a corresponding front-end fix that would expand the entire branch. Exposing capabilities / fixing bugs for proprietary front-ends and not fixing it upstream is a no go. > Source/WebCore/inspector/Inspector.json:1715 > + "name": "requestChildNodesWithDepth", You should not add public methods unless you are committing to supporting them. > Source/WebCore/inspector/Inspector.json:1718 > + { "name": "depth", "type": "integer", "description": "The maximum depth at which children should be retrieved." } This should be an optional parameter of the requestChildNodes above.
Antoine Quint
Comment 10 2013-01-10 05:48:33 PST
(In reply to comment #9) > (From update of attachment 181982 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=181982&action=review > > You need a test and a corresponding front-end fix that would expand the entire branch. Exposing capabilities / fixing bugs for proprietary front-ends and not fixing it upstream is a no go. > > > Source/WebCore/inspector/Inspector.json:1715 > > + "name": "requestChildNodesWithDepth", > > You should not add public methods unless you are committing to supporting them. > > > Source/WebCore/inspector/Inspector.json:1718 > > + { "name": "depth", "type": "integer", "description": "The maximum depth at which children should be retrieved." } > > This should be an optional parameter of the requestChildNodes above. Yes, that's what I'm going to do. I may close this bug as a DUPLICATE and fix https://bugs.webkit.org/show_bug.cgi?id=66868 instead.
Antoine Quint
Comment 11 2013-01-10 06:56:02 PST
Making the discussed backend enhancement as well as front-end fixes in https://bugs.webkit.org/show_bug.cgi?id=66868. *** This bug has been marked as a duplicate of bug 66868 ***
Joseph Pecoraro
Comment 12 2013-01-10 09:34:04 PST
(In reply to comment #9) > (From update of attachment 181982 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=181982&action=review > > > Source/WebCore/inspector/Inspector.json:1718 > > + { "name": "depth", "type": "integer", "description": "The maximum depth at which children should be retrieved." } > > This should be an optional parameter of the requestChildNodes above. Yes, Antoine and I had an IRC discussion about this after the review and we came to the same conclusion. I forgot to comment here.
Note You need to log in before you can comment on or make changes to this bug.