Bug 66544

Summary: Web Inspector: getAttributes should work on a single node, not array.
Product: WebKit Reporter: Pavel Feldman <pfeldman>
Component: Web Inspector (Deprecated)Assignee: Pavel Feldman <pfeldman>
Status: RESOLVED FIXED    
Severity: Normal CC: apavlov, bweinstein, joepeck, keishi, loislo, pfeldman, pmuellr, rik, timothy, webkit.review.bot, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch aroben: review+

Description Pavel Feldman 2011-08-19 03:15:54 PDT
Patch to follow.
Comment 1 Pavel Feldman 2011-08-19 03:17:21 PDT
Created attachment 104483 [details]
Patch
Comment 2 WebKit Review Bot 2011-08-19 03:20:10 PDT
Attachment 104483 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebCore/inspector/InspectorDOMAgent.cpp:1083:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Source/WebCore/inspector/InspectorDOMAgent.h:131:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Total errors found: 2 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Alexander Pavlov (apavlov) 2011-08-19 04:39:01 PDT
Comment on attachment 104483 [details]
Patch

One comment, otherwise looks good.

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

> Source/WebCore/inspector/Inspector.json:1064
> +                    { "name": "nodeId", "type": "integer", "description": "Ids of the nodes to retrieve attibutes for." }

Ids of the nodes -> Id of the node
Comment 4 Adam Roben (:aroben) 2011-08-19 05:23:10 PDT
Comment on attachment 104483 [details]
Patch

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

>> Source/WebCore/inspector/InspectorDOMAgent.cpp:1083
>> +void InspectorDOMAgent::getAttributes(ErrorString* errorString, int nodeId, RefPtr<InspectorArray>* result)
> 
> The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]

We should file a bug about check-webkit-style not understanding RefPtr out-parameters.

> Source/WebCore/inspector/front-end/DOMAgent.js:463
> -        var nodeIds = [];
>          for (var nodeId in this._attributeLoadNodeIds)
> -            nodeIds.push(Number(nodeId));
> -        DOMAgent.getAttributes(nodeIds, this._wrapClientCallback(callback.bind(this)));
> +            DOMAgent.getAttributes(parseInt(nodeId), this._wrapClientCallback(callback.bind(this, nodeId)));

Presumably this is worse from an efficiency standpoint. Hopefully it won't matter in practice.
Comment 5 Pavel Feldman 2011-08-19 05:50:44 PDT
Committed r93398: <http://trac.webkit.org/changeset/93398>