Bug 91607 - Web Inspector: Protocol Extension: add getNamedFlowCollection command
Summary: Web Inspector: Protocol Extension: add getNamedFlowCollection command
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 91967
Blocks: 90786
  Show dependency treegraph
 
Reported: 2012-07-18 02:45 PDT by Andrei Poenaru
Modified: 2012-07-31 01:19 PDT (History)
12 users (show)

See Also:


Attachments
Patch (10.26 KB, patch)
2012-07-18 08:08 PDT, Andrei Poenaru
no flags Details | Formatted Diff | Diff
Patch (11.33 KB, patch)
2012-07-19 06:47 PDT, Andrei Poenaru
pfeldman: review-
Details | Formatted Diff | Diff
Patch (12.43 KB, patch)
2012-07-20 01:18 PDT, Andrei Poenaru
pfeldman: review-
Details | Formatted Diff | Diff
Patch (12.54 KB, patch)
2012-07-20 03:54 PDT, Andrei Poenaru
webkit-ews: commit-queue-
Details | Formatted Diff | Diff
Patch (12.54 KB, patch)
2012-07-20 05:07 PDT, Andrei Poenaru
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Poenaru 2012-07-18 02:45:44 PDT
Implement the getNamedFlowCollection command from this proposed protocol extension:

https://bug-90789-attachments.webkit.org/attachment.cgi?id=152527
Comment 1 Vivek Galatage 2012-07-18 04:13:08 PDT
Are these all proposed APIs belong to public inspector protocol APIs? Or can some of them be private APIs?
Comment 2 Andrei Poenaru 2012-07-18 04:58:51 PDT
(In reply to comment #1)
> Are these all proposed APIs belong to public inspector protocol APIs? Or can some of them be private APIs?

Does this mean if they will have "hidden": true?  If yes, then they will be marked as "hidden".
Comment 3 Vivek Galatage 2012-07-18 05:07:04 PDT
(In reply to comment #2)
> (In reply to comment #1)
> > Are these all proposed APIs belong to public inspector protocol APIs? Or can some of them be private APIs?
> 
> Does this mean if they will have "hidden": true?  If yes, then they will be marked as "hidden".

Yes that's exactly my question was. Thank you.
Comment 4 Andrei Poenaru 2012-07-18 08:08:02 PDT
Created attachment 153016 [details]
Patch
Comment 5 Pavel Feldman 2012-07-18 08:19:50 PDT
Comment on attachment 153016 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=153016&action=review

> Source/WebCore/inspector/InspectorCSSAgent.cpp:794
> +    Document* document = m_domAgent->document();

You are currently getting flows from the main frame only. What if the page uses iframes or frame sets? You probably should pass context node id (from DOMAgent terms) into this method to get the flows for a given document.
Comment 6 Andrei Poenaru 2012-07-19 06:47:57 PDT
Created attachment 153250 [details]
Patch
Comment 7 Pavel Feldman 2012-07-19 07:24:03 PDT
Comment on attachment 153250 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=153250&action=review

> LayoutTests/ChangeLog:3
> +        Deleted tab space

Please remove git comments from here.

> LayoutTests/ChangeLog:16
> +        Additional information of the change such as approach, rationale. Please add per-function descriptions below (OOPS!).

Nuke this line

> LayoutTests/inspector/styles/protocol-getNamedFlowCollection-command.html:25
> +    function test() {

You probably should pick another name in order to not reuse "test"

> LayoutTests/inspector/styles/protocol-getNamedFlowCollection-command.html:26
> +        function namedFlowCallback(namedFlows) {

Please place { on the next line

> LayoutTests/inspector/styles/protocol-getNamedFlowCollection-command.html:31
> +                InspectorTest.completeTest();

missing return; below.

> LayoutTests/inspector/styles/protocol-getNamedFlowCollection-command.html:42
> +        function documentCallback(document) {

{ on the next line.

> Source/WebCore/ChangeLog:2
> +        Web Inspector: Protocol Extension: add getNamedFlowCollection command

missing blank line above

> Source/WebCore/dom/WebKitNamedFlowCollection.cpp:48
> +    return m_namedFlows;

Exposing private member for read-write does not sound good.

> Source/WebCore/inspector/Inspector.json:2294
> +                    { "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id for which to get the Named Flow Collection."}

we typically call node ids "nodeId"

> Source/WebCore/inspector/InspectorCSSAgent.cpp:796
> +    if (!node || !(node->isDocumentNode())) {

You should add InspectorDOMNode::assertDocumentNode instead.

> Source/WebCore/inspector/InspectorCSSAgent.cpp:804
> +    WebKitNamedFlowCollection::NamedFlowSet& namedFlowSet = document->namedFlows()->namedFlows();

So you could make flow collection return array of strings instead of exposing the private object.

> Source/WebCore/inspector/InspectorCSSAgent.cpp:807
> +        if ((*it)->flowState() == WebKitNamedFlow::FlowStateNull)

This check could also be a part of the collection itself.
Comment 8 Andrei Poenaru 2012-07-19 07:44:12 PDT
(In reply to comment #7)
> > Source/WebCore/inspector/InspectorCSSAgent.cpp:796
> > +    if (!node || !(node->isDocumentNode())) {
> 
> You should add InspectorDOMNode::assertDocumentNode instead.

I can't find "InspectorDOMNode". Did you meant "Node"?
Comment 9 Pavel Feldman 2012-07-19 08:20:23 PDT
(In reply to comment #8)
> (In reply to comment #7)
> > > Source/WebCore/inspector/InspectorCSSAgent.cpp:796
> > > +    if (!node || !(node->isDocumentNode())) {
> > 
> > You should add InspectorDOMNode::assertDocumentNode instead.
> 
> I can't find "InspectorDOMNode". Did you meant "Node"?

Sorry, I meant introduce InspectorDOMAgent::assertDocument as in InspectorDOMAgent::assertNode / InspectorDOMAgent::assertElement.
Comment 10 Andrei Poenaru 2012-07-20 01:18:19 PDT
Created attachment 153444 [details]
Patch
Comment 11 Pavel Feldman 2012-07-20 01:49:07 PDT
Comment on attachment 153444 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=153444&action=review

> Source/WebCore/dom/WebKitNamedFlowCollection.h:33
> +#include <InspectorBackendDispatcher.h>

You should not make arbitrary component depend on the inspector guts. Also, these are not visible in case of !ENABLED(INSPECTOR). You should return a Vector<String> instead.
Comment 12 Andrei Poenaru 2012-07-20 03:54:34 PDT
Created attachment 153473 [details]
Patch
Comment 13 Early Warning System Bot 2012-07-20 04:11:29 PDT
Comment on attachment 153473 [details]
Patch

Attachment 153473 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/13309224
Comment 14 Early Warning System Bot 2012-07-20 04:34:36 PDT
Comment on attachment 153473 [details]
Patch

Attachment 153473 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/13313174
Comment 15 Andrei Poenaru 2012-07-20 05:07:23 PDT
Created attachment 153480 [details]
Patch
Comment 16 WebKit Review Bot 2012-07-20 05:35:12 PDT
Comment on attachment 153480 [details]
Patch

Clearing flags on attachment: 153480

Committed r123205: <http://trac.webkit.org/changeset/123205>
Comment 17 WebKit Review Bot 2012-07-20 05:35:17 PDT
All reviewed patches have been landed.  Closing bug.