Bug 45662 - Web Inspector: [Resources panel] Should be easy to copy data.
Summary: Web Inspector: [Resources panel] Should be easy to copy data.
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:
Blocks:
 
Reported: 2010-09-13 06:07 PDT by Pavel Feldman
Modified: 2011-04-25 09:39 PDT (History)
10 users (show)

See Also:


Attachments
Patch (4.36 KB, patch)
2011-04-15 17:39 PDT, Annie Sullivan
pfeldman: review-
Details | Formatted Diff | Diff
Patch: Addresses comments and adds localized strings. (4.65 KB, patch)
2011-04-21 18:30 PDT, Annie Sullivan
pfeldman: review-
pfeldman: commit-queue-
Details | Formatted Diff | Diff
New patch, merged with tip of tree (4.65 KB, patch)
2011-04-22 11:48 PDT, Annie Sullivan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Feldman 2010-09-13 06:07:03 PDT
In Firebug, when you right-click a URL, you get a context menu with options to copy the location, copy the request headers, or copy the response headers. HttpWatch is even better--it has separate panels for headers, cookies, query string, and postdata. You can go to any panel, and see the data split into a table of name/value pairs. Right click on any value and you get the option to copy the value, the name/value pair, or all the rows in the panel. This is extremely useful when someone asks you to send them the value of a certain header or post field, which happens to me a lot.
Comment 1 Annie Sullivan 2011-04-15 17:39:57 PDT
Created attachment 89893 [details]
Patch

To get the request/response headers as plain text, I implemented get requestHeadersText() and get responseHeadersText() for WebInspector.Resource, similar to the getters for sorted headers. Let me know if there's a better way to do this.
Comment 2 Yury Semikhatsky 2011-04-18 01:28:00 PDT
Comment on attachment 89893 [details]
Patch

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

> Source/WebCore/inspector/front-end/NetworkPanel.js:1003
> +                contextMenu.appendItem(WebInspector.UIString("Copy request headers"), this._exportRequestHeaders.bind(this, resource));

New UI strings should be added to Source/WebCore/English.lproj/localizedStrings.js.
Comment 3 Pavel Feldman 2011-04-18 02:18:31 PDT
Comment on attachment 89893 [details]
Patch

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

Overall looks good. You need an entry in localizedStrings.js as Yury suggests to land this.

> Source/WebCore/inspector/front-end/NetworkPanel.js:1023
>          InspectorFrontendHost.copyText(JSON.stringify(har));

It used to export values, now it copies them, so the name of the method is misleading. Do not reuse it.

> Source/WebCore/inspector/front-end/NetworkPanel.js:1026
> +    _exportLocation: function(resource)

I.e. should be _copyLocation, etc.

> Source/WebCore/inspector/front-end/Resource.js:429
> +            this._requestHeadersText += key + ": " + this.requestHeaders[key] + '\n'; 

Please use double quotes.

> Source/WebCore/inspector/front-end/Resource.js:510
> +            this._responseHeadersText += key + ": " + this.responseHeaders[key] + '\n'; 

ditto.
Comment 4 Annie Sullivan 2011-04-21 18:28:56 PDT
Comment on attachment 89893 [details]
Patch

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

>> Source/WebCore/inspector/front-end/NetworkPanel.js:1023
>>          InspectorFrontendHost.copyText(JSON.stringify(har));
> 
> It used to export values, now it copies them, so the name of the method is misleading. Do not reuse it.

Done.

>> Source/WebCore/inspector/front-end/NetworkPanel.js:1026
>> +    _exportLocation: function(resource)
> 
> I.e. should be _copyLocation, etc.

Done.

>> Source/WebCore/inspector/front-end/Resource.js:429
>> +            this._requestHeadersText += key + ": " + this.requestHeaders[key] + '\n'; 
> 
> Please use double quotes.

Done.

>> Source/WebCore/inspector/front-end/Resource.js:510
>> +            this._responseHeadersText += key + ": " + this.responseHeaders[key] + '\n'; 
> 
> ditto.

Done.
Comment 5 Annie Sullivan 2011-04-21 18:30:16 PDT
Created attachment 90647 [details]
Patch: Addresses comments and adds localized strings.
Comment 6 Pavel Feldman 2011-04-22 02:07:22 PDT
Comment on attachment 90647 [details]
Patch: Addresses comments and adds localized strings.

I think you need to merge this code with the tip of the tree. Also, note that there is a way to copy headers via switching to raw view + selecting + copypasting.
Comment 7 Annie Sullivan 2011-04-22 11:48:38 PDT
Created attachment 90734 [details]
New patch, merged with tip of tree
Comment 8 Annie Sullivan 2011-04-22 11:55:49 PDT
(In reply to comment #6)
> (From update of attachment 90647 [details])
> I think you need to merge this code with the tip of the tree. Also, note that there is a way to copy headers via switching to raw view + selecting + copypasting.

Yes, it's possible to do this, but it's really hard to get all the headers without truncating something from the top or bottom or accidentally including some of the text above/below the headers, especially on a laptop with a smaller screen and no mouse. I think this is why both Firebug and HttpWatch provide context menu options for this. It's a very useful feature for quickly getting information into a bug or email.
Comment 9 Pavel Feldman 2011-04-25 09:39:19 PDT
Comment on attachment 90734 [details]
New patch, merged with tip of tree

Clearing flags on attachment: 90734

Committed r84778: <http://trac.webkit.org/changeset/84778>
Comment 10 Pavel Feldman 2011-04-25 09:39:28 PDT
All reviewed patches have been landed.  Closing bug.