Bug 154048 - Web Inspector: Allow copying all headers in the request/response header tables
Summary: Web Inspector: Allow copying all headers in the request/response header tables
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: Safari 9
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-02-09 14:43 PST by Derk-Jan Hartman
Modified: 2016-02-22 03:39 PST (History)
8 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (5.23 KB, patch)
2016-02-09 15:16 PST, Joseph Pecoraro
timothy: review+
Details | Formatted Diff | Diff
[PATCH] For Landing (5.35 KB, patch)
2016-02-09 16:13 PST, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Derk-Jan Hartman 2016-02-09 14:43:59 PST
Quite often I have to file bugreports, where caching headers and varnish IDs and dates and cookies and basically everything that might remotely influence your session is important. Most of this information (with the exception of cookies, which is bug 16531) is available to me right there in the response section of the request.

But if I want to use it, I have to select each individual value and copy and past it somewhere else. This leads to a routine of "Type name of header (faster than copying it from inspector), copy value, repeat". After 2 headers i'm annoyed that I have to do it like this, after 8 headers i'm cursing :)


JoePeck> thedj: hmm, our DataGrid class doesn't yet have multiple-selection, so that would require some implementation work
JoePeck> thedj: we have a context menu for "Copy Row" maybe a "Copy All Rows" would be a reasonable short term hack"
Comment 1 Radar WebKit Bug Importer 2016-02-09 14:44:26 PST
<rdar://problem/24576302>
Comment 2 Joseph Pecoraro 2016-02-09 14:53:25 PST
It was easy to add a "Copy Table" context menu item here, which includes the DataGrid header names and then all the copyable row data. I'll test this a bit more and put up a patch.
Comment 3 Joseph Pecoraro 2016-02-09 15:16:54 PST
Created attachment 270956 [details]
[PATCH] Proposed Fix

There are other enhancement requests around copying requests as cURL and getting more exportable data about requests/responses. However a quick fix for this, which makes sense elsewhere as well, is to add a "Copy Table" context menu to any DataGrid that has copyable data. This patch adds it to rows and headers.
Comment 4 Timothy Hatcher 2016-02-09 15:30:25 PST
Comment on attachment 270956 [details]
[PATCH] Proposed Fix

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

> Source/WebInspectorUI/UserInterface/Views/DataGrid.js:1250
> +        var fields = [];
> +        for (var identifier of this.orderedColumns)

let
Comment 5 Devin Rousso 2016-02-09 15:44:32 PST
Comment on attachment 270956 [details]
[PATCH] Proposed Fix

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

>> Source/WebInspectorUI/UserInterface/Views/DataGrid.js:1250
>> +        for (var identifier of this.orderedColumns)
> 
> let

Actually, couldn't you just use an Array.prototype.map() here?
let fields = this.orderedColumns.map(item => this.headerTableHeader(identifier).textContent);
Comment 6 Joseph Pecoraro 2016-02-09 16:13:17 PST
Comment on attachment 270956 [details]
[PATCH] Proposed Fix

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

>>> Source/WebInspectorUI/UserInterface/Views/DataGrid.js:1250
>>> +        for (var identifier of this.orderedColumns)
>> 
>> let
> 
> Actually, couldn't you just use an Array.prototype.map() here?
> let fields = this.orderedColumns.map(item => this.headerTableHeader(identifier).textContent);

I like it. Used this for both this and the other similar method.
Comment 7 Joseph Pecoraro 2016-02-09 16:13:46 PST
Created attachment 270960 [details]
[PATCH] For Landing
Comment 8 Joseph Pecoraro 2016-02-09 16:16:14 PST
> > Actually, couldn't you just use an Array.prototype.map() here?
> > let fields = this.orderedColumns.map(item => this.headerTableHeader(identifier).textContent);

s/item/identifier/

Also we were avoiding arrow functions that used `this` in their body because the implicit lexical this binding was flakey until recently. But from what I understand this is working well now, and I tested this case and it worked well. So, onward with arrow functions!
Comment 9 WebKit Commit Bot 2016-02-09 17:13:41 PST
Comment on attachment 270960 [details]
[PATCH] For Landing

Clearing flags on attachment: 270960

Committed r196348: <http://trac.webkit.org/changeset/196348>
Comment 10 Derk-Jan Hartman 2016-02-22 03:39:53 PST
Super useful change, I've already used it twice today !