Bug 189606 - Web Inspector: group media network entries by the node that triggered the request
Summary: Web Inspector: group media network entries by the node that triggered the req...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on: 190318
Blocks: 189773 190372 190388
  Show dependency treegraph
 
Reported: 2018-09-13 17:17 PDT by Devin Rousso
Modified: 2018-10-18 09:07 PDT (History)
9 users (show)

See Also:


Attachments
Patch (97.09 KB, patch)
2018-09-13 23:24 PDT, Devin Rousso
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews103 for mac-sierra (2.34 MB, application/zip)
2018-09-14 00:39 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews107 for mac-sierra-wk2 (3.19 MB, application/zip)
2018-09-14 00:57 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews112 for mac-sierra (3.10 MB, application/zip)
2018-09-14 01:26 PDT, EWS Watchlist
no flags Details
[Image] After Patch is applied (1.26 MB, image/png)
2018-09-14 10:26 PDT, Devin Rousso
no flags Details
Patch (105.16 KB, patch)
2018-09-15 11:00 PDT, Devin Rousso
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews100 for mac-sierra (2.34 MB, application/zip)
2018-09-15 12:13 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews104 for mac-sierra-wk2 (3.11 MB, application/zip)
2018-09-15 12:30 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews116 for mac-sierra (3.06 MB, application/zip)
2018-09-15 12:53 PDT, EWS Watchlist
no flags Details
Patch (102.10 KB, patch)
2018-09-17 11:25 PDT, Devin Rousso
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-sierra (2.33 MB, application/zip)
2018-09-17 12:46 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews106 for mac-sierra-wk2 (3.12 MB, application/zip)
2018-09-17 13:02 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews117 for mac-sierra (3.18 MB, application/zip)
2018-09-17 13:25 PDT, EWS Watchlist
no flags Details
Patch (102.08 KB, patch)
2018-09-17 16:18 PDT, Devin Rousso
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews103 for mac-sierra (2.57 MB, application/zip)
2018-09-17 17:40 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews117 for mac-sierra (3.01 MB, application/zip)
2018-09-17 18:24 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews106 for mac-sierra-wk2 (3.57 MB, application/zip)
2018-09-17 18:38 PDT, EWS Watchlist
no flags Details
Patch (106.65 KB, patch)
2018-09-20 10:44 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (106.19 KB, patch)
2018-09-20 11:44 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (106.59 KB, patch)
2018-09-21 17:31 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (105.65 KB, patch)
2018-10-02 22:37 PDT, Devin Rousso
bburg: review-
Details | Formatted Diff | Diff
Patch (88.87 KB, patch)
2018-10-06 10:51 PDT, Devin Rousso
bburg: review+
Details | Formatted Diff | Diff
Patch (88.85 KB, patch)
2018-10-08 10:09 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2018-09-13 17:17:39 PDT
When working with media elements (e.g. <video> and <audio>), especially those with multiple video/audio/subtitle tracks, we could do a better job of displaying request information in a way that's easily relatable and understandable.  As an example, most (if not all) video files are loaded in segments via the “Range” request header, and each of these “loads” appeared in the table as a separate request to the exact same URL.  This is confusing, especially considering the fact that the difference between these requests only becomes apparent when one views the headers for the requests and perceives the difference in the “Range”.  We should improve the Network table to better display important information and group these types of loads together.
Comment 1 Radar WebKit Bug Importer 2018-09-13 17:18:02 PDT
<rdar://problem/44438527>
Comment 2 Devin Rousso 2018-09-13 23:24:59 PDT
Created attachment 349738 [details]
Patch
Comment 3 EWS Watchlist 2018-09-14 00:39:53 PDT Comment hidden (obsolete)
Comment 4 EWS Watchlist 2018-09-14 00:39:55 PDT Comment hidden (obsolete)
Comment 5 EWS Watchlist 2018-09-14 00:57:22 PDT Comment hidden (obsolete)
Comment 6 EWS Watchlist 2018-09-14 00:57:23 PDT Comment hidden (obsolete)
Comment 7 EWS Watchlist 2018-09-14 01:26:04 PDT Comment hidden (obsolete)
Comment 8 EWS Watchlist 2018-09-14 01:26:05 PDT Comment hidden (obsolete)
Comment 9 Devin Rousso 2018-09-14 10:26:18 PDT
Created attachment 349771 [details]
[Image] After Patch is applied
Comment 10 Joseph Pecoraro 2018-09-14 14:49:51 PDT
Comment on attachment 349738 [details]
Patch

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

> Source/WebCore/platform/network/ResourceRequestBase.h:239
> +    RefPtr<Node> m_initiatorNode;

As discussed in person, having ResourceRequest reference a WebCore::Node is a layering violation. The platform layer shouldn't know about WebCore types.
Comment 11 Devin Rousso 2018-09-15 11:00:18 PDT
Created attachment 349858 [details]
Patch

Some of these `InspectorInstrumentation` calls are probably unnecessary, so I'll try removing them one by one later.  This is mainly to see if the tests pass on EWS, although it is still reviewable.
Comment 12 EWS Watchlist 2018-09-15 12:13:53 PDT Comment hidden (obsolete)
Comment 13 EWS Watchlist 2018-09-15 12:13:55 PDT Comment hidden (obsolete)
Comment 14 EWS Watchlist 2018-09-15 12:30:55 PDT Comment hidden (obsolete)
Comment 15 EWS Watchlist 2018-09-15 12:30:56 PDT Comment hidden (obsolete)
Comment 16 EWS Watchlist 2018-09-15 12:53:52 PDT Comment hidden (obsolete)
Comment 17 EWS Watchlist 2018-09-15 12:53:54 PDT Comment hidden (obsolete)
Comment 18 Devin Rousso 2018-09-17 11:25:50 PDT
Created attachment 349913 [details]
Patch
Comment 19 EWS Watchlist 2018-09-17 12:46:18 PDT Comment hidden (obsolete)
Comment 20 EWS Watchlist 2018-09-17 12:46:20 PDT Comment hidden (obsolete)
Comment 21 EWS Watchlist 2018-09-17 13:02:13 PDT Comment hidden (obsolete)
Comment 22 EWS Watchlist 2018-09-17 13:02:15 PDT Comment hidden (obsolete)
Comment 23 EWS Watchlist 2018-09-17 13:25:22 PDT Comment hidden (obsolete)
Comment 24 EWS Watchlist 2018-09-17 13:25:24 PDT Comment hidden (obsolete)
Comment 25 Devin Rousso 2018-09-17 16:18:43 PDT
Created attachment 349967 [details]
Patch

Fixed a typo that was causing the unexpected test failures.
Comment 26 EWS Watchlist 2018-09-17 17:40:05 PDT Comment hidden (obsolete)
Comment 27 EWS Watchlist 2018-09-17 17:40:07 PDT Comment hidden (obsolete)
Comment 28 EWS Watchlist 2018-09-17 18:24:33 PDT Comment hidden (obsolete)
Comment 29 EWS Watchlist 2018-09-17 18:24:35 PDT Comment hidden (obsolete)
Comment 30 EWS Watchlist 2018-09-17 18:38:02 PDT Comment hidden (obsolete)
Comment 31 EWS Watchlist 2018-09-17 18:38:04 PDT Comment hidden (obsolete)
Comment 32 Devin Rousso 2018-09-20 10:44:14 PDT
Created attachment 350230 [details]
Patch

The canvas test failures were caused by `InspectorCanvas::buildObjectForCanvas` eagerly binding the canvas' node in `InspectorDOMAgent`, which will not be removed if the canvas' node is detached from the DOM since we unbind nodes in `InspectorDOMAgent` when they are removed from their parent.
Comment 33 Devin Rousso 2018-09-20 11:44:17 PDT
Created attachment 350239 [details]
Patch
Comment 34 Devin Rousso 2018-09-21 17:31:12 PDT
Created attachment 350463 [details]
Patch

localizedStrings :|
Comment 35 Joseph Pecoraro 2018-09-26 17:11:16 PDT
Comment on attachment 350463 [details]
Patch

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

Here is a first pass, I didn't review the NetworkTable changes closely, but I skimmed the rest of the patch to try and get a high level idea.

> LayoutTests/http/tests/inspector/network/har/har-basic.html:-39
> -            const loaderIdentifier = undefined;
> -            const targetId = undefined;
> -            const requestIdentifier = undefined;

why not keep these, they would still be undefined below, right?

> Source/WebCore/ChangeLog:21
> +        Handles initial (e.g. DNT) resource requests.

What is DNT here? Do Not Track?

> Source/WebCore/ChangeLog:29
> +        (MediaResourceLoader::requestResource):
> +        Handles byte-range requests.

I wonder why the other locations don't set the requester like here:

    request.setRequester(ResourceRequest::Requester::Media)

> Source/WebCore/ChangeLog:71
> +        Don't try to push the canvas' node to the frontend, as this will create a dangling node in
> +        `InspectorDOMAgent` if the canvas' node is detached from the DOM.

I think you can mention you intend to add this back in the future? I think you had mentioned this might be the case after updating DOM.NodeId to uniquely identify nodes through the entire node's lifetime.

> Source/WebCore/platform/network/ResourceRequestBase.h:239
> +    int m_initiatorNodeIdentifier;

All of these others have an initial value, you should set that here as well:

    int m_initatorNodeIdentifier { 0 };

> Source/WebInspectorUI/ChangeLog:85
> +        * UserInterface/Images/Range.svg: Added.

I think `ByteRange.svg` might be a better name than `Range.svg`.

I had always thought a [#] might be better than [R].
Another idea I've had for other byte-wise data was something like:
    
    _______
    | 0 1 | 
    | 1 0 |
    ⎺⎺⎺⎺⎺⎺⎺

JonDavis / mattbaker / xenon may know what it takes to create a new such icon path from a previously unused character. I have never created a new one myself!

> Source/WebInspectorUI/UserInterface/Images/Range.svg:2
> +<!-- Copyright © 2013 Apple Inc. All rights reserved. -->

2013 or 2018?

> Source/WebInspectorUI/UserInterface/Models/Resource.js:78
> +        this._target = targetIdentifier ? WI.targetManager.targetForIdentifier(targetIdentifier) : WI.mainTarget;

We use the identifier `targetId` everywhere in the frontend, and never `targetIdentifier`. I'm not sure we'd want to change that here.

> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.css:101
> +.network-table li.selected .cell.domain > .lock {
> +    filter: invert();
> +}

I'm not sure this is needed, we shouldn't ever be showing the whole row as selected in the Network Tab. (Maybe if we bring this Network Table to the Timeline Tab it would be needed).
Comment 36 Devin Rousso 2018-09-26 18:40:57 PDT
Comment on attachment 350463 [details]
Patch

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

>> LayoutTests/http/tests/inspector/network/har/har-basic.html:-39
>> -            const requestIdentifier = undefined;
> 
> why not keep these, they would still be undefined below, right?

Since `WI.Resource` now uses an object-bag, these values are unnecessary as they will effectively get set to undefined when the object-bag gets destructured.  Additionally, this makes the test a bit easier to read because now it's clear what's been specified and what's left "blank".

>> Source/WebCore/ChangeLog:21
>> +        Handles initial (e.g. DNT) resource requests.
> 
> What is DNT here? Do Not Track?

Yup!

>> Source/WebCore/ChangeLog:71
>> +        `InspectorDOMAgent` if the canvas' node is detached from the DOM.
> 
> I think you can mention you intend to add this back in the future? I think you had mentioned this might be the case after updating DOM.NodeId to uniquely identify nodes through the entire node's lifetime.

Yeah, I'll add a comment linking to one of these:
 - <https://webkit.org/b/178282>
 - <https://webkit.org/b/189687>
 - <https://webkit.org/b/189776>

>> Source/WebInspectorUI/UserInterface/Images/Range.svg:2
>> +<!-- Copyright © 2013 Apple Inc. All rights reserved. -->
> 
> 2013 or 2018?

I would think 2013 since this file is a direct copy of one of the other [R] icons, but I'm not the best person to ask about copyright 😅

>> Source/WebInspectorUI/UserInterface/Models/Resource.js:78
>> +        this._target = targetIdentifier ? WI.targetManager.targetForIdentifier(targetIdentifier) : WI.mainTarget;
> 
> We use the identifier `targetId` everywhere in the frontend, and never `targetIdentifier`. I'm not sure we'd want to change that here.

I think my main motivation was to match `loaderIdentifier` and `requestIdentifier`, but it's unnecessary.  I'll revert.

>> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.css:101
>> +}
> 
> I'm not sure this is needed, we shouldn't ever be showing the whole row as selected in the Network Tab. (Maybe if we bring this Network Table to the Timeline Tab it would be needed).

When looking at this patch alone, it is, because it's allowed for the user to select a node's row.  The followup <https://webkit.org/b/189773> removes this functionality by replacing the rest of the columns with the timeline.
Comment 37 Devin Rousso 2018-10-02 22:37:04 PDT
Created attachment 351480 [details]
Patch
Comment 38 BJ Burg 2018-10-03 16:54:29 PDT
Comment on attachment 351480 [details]
Patch

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

> Source/WebCore/ChangeLog:11
> +        Add extra arguments to functions that create `ResourceRequest` objets for media resources so

Nit: objects

> Source/WebCore/html/track/LoadableTextTrack.cpp:-85
> -    if (!m_loader->load(m_url, m_trackElement->mediaElementCrossOriginAttribute(), m_trackElement->isInUserAgentShadowTree()))

Why did this change?

> Source/WebCore/inspector/InspectorCanvas.cpp:-253
> -        else {

I don't quite understand why this change belongs in this patch.

> Source/WebCore/loader/TextTrackLoader.cpp:147
> +bool TextTrackLoader::load(const URL& url, HTMLTrackElement& element)

... Oh, i see. Jer, is this a layering violation for this part of the code?

> Source/WebCore/platform/network/ResourceRequestBase.h:176
> +    int initiatorNodeIdentifier() const { return m_initiatorNodeIdentifier; }

Please use Identified.h templates for this. It should be std::optional too.
Comment 39 Devin Rousso 2018-10-03 19:31:53 PDT
Comment on attachment 351480 [details]
Patch

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

>> Source/WebCore/inspector/InspectorCanvas.cpp:-253
>> -        else {
> 
> I don't quite understand why this change belongs in this patch.

It's more-so that this was never used by the frontend.  Since this patch adds calls to `WI.domManager.ensureDocument()` whenever the document changes, it would effect this code.  The change to "inspector/canvas/requestNode.html" is for the same reason.

>> Source/WebCore/loader/TextTrackLoader.cpp:147
>> +bool TextTrackLoader::load(const URL& url, HTMLTrackElement& element)
> 
> ... Oh, i see. Jer, is this a layering violation for this part of the code?

I might need some clarity as to what we consider a layering violation.

`TextTrackLoader` holds a reference to a `TextTrackLoaderClient`, which I think is always a `LoadableTextTrack`, which has access to its `HTMLTrackElement`.  Not sure if that is a similar concept to our "delegate" in WebInspector, but if so I can probably reach the `HTMLTrackElement` via the client.

>> Source/WebCore/platform/network/ResourceRequestBase.h:176
>> +    int initiatorNodeIdentifier() const { return m_initiatorNodeIdentifier; }
> 
> Please use Identified.h templates for this. It should be std::optional too.

I've never used `Identified` before.  Based on what I can understand from the code, I'm not sure that it's what we want here.  The reason this member exists is so that we can relate a specific request to the "node" that effectively triggered that request.  In this patch, this value is set to `InspectorDOMAgentt`s id for the node, which can then be properly propagated until it reaches `InspectorNetworkAgent`.  This value isn't supposed to be an identifier for the request itself, but instead used as a way for the inspector to relate this request to something else it has already identified.

Making it an `optional` seem's like a good idea though.
Comment 40 Jer Noble 2018-10-04 10:34:12 PDT
(In reply to Brian Burg from comment #38)
> Comment on attachment 351480 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=351480&action=review
>
> > Source/WebCore/loader/TextTrackLoader.cpp:147
> > +bool TextTrackLoader::load(const URL& url, HTMLTrackElement& element)
> 
> ... Oh, i see. Jer, is this a layering violation for this part of the code?

I don't think so; there's already a bunch of code in WebCore/loader than references HTMLMediaElements (as well as other HTML element types).
Comment 41 BJ Burg 2018-10-04 10:51:06 PDT
Comment on attachment 351480 [details]
Patch

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

>>> Source/WebCore/loader/TextTrackLoader.cpp:147
>>> +bool TextTrackLoader::load(const URL& url, HTMLTrackElement& element)
>> 
>> ... Oh, i see. Jer, is this a layering violation for this part of the code?
> 
> I might need some clarity as to what we consider a layering violation.
> 
> `TextTrackLoader` holds a reference to a `TextTrackLoaderClient`, which I think is always a `LoadableTextTrack`, which has access to its `HTMLTrackElement`.  Not sure if that is a similar concept to our "delegate" in WebInspector, but if so I can probably reach the `HTMLTrackElement` via the client.

Right. I'm not sure if it's okay in this code for a Loader to hold on to an Element subclass instance, or if they are supposed to be abstracted away with a *Client interface.

>>> Source/WebCore/platform/network/ResourceRequestBase.h:176
>>> +    int initiatorNodeIdentifier() const { return m_initiatorNodeIdentifier; }
>> 
>> Please use Identified.h templates for this. It should be std::optional too.
> 
> I've never used `Identified` before.  Based on what I can understand from the code, I'm not sure that it's what we want here.  The reason this member exists is so that we can relate a specific request to the "node" that effectively triggered that request.  In this patch, this value is set to `InspectorDOMAgentt`s id for the node, which can then be properly propagated until it reaches `InspectorNetworkAgent`.  This value isn't supposed to be an identifier for the request itself, but instead used as a way for the inspector to relate this request to something else it has already identified.
> 
> Making it an `optional` seem's like a good idea though.

I read into this more, and I think Identified would be a great replacement for `int`, but it would require significant code changes in InspectorDOMAgent. Perhaps let's defer this change til when you rework that agent? In the meantime, I would guess that other engineers prefer at least a more informative typedef for the ResourceRequest member, like Inspector::NodeIdentifier.

> Source/WebInspectorUI/ChangeLog:10
> +        node that initiated the load (if appliable). When grouped by node, a tree-like layout of the

Nit: if applicable

> Source/WebInspectorUI/ChangeLog:20
> +        Whenever the frame navigates, re-reqeust the document so that `NetworkAgent` is able to send

Nit: re-request

> Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js:157
> +                mainResource = new WI.Resource(framePayload.url, {

I like the new style, but please make a separate patch for it. It's kind of messy and this patch is already large.

> Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js:573
> +    _addNewResourceToFrameOrTarget(requestIdentifier, frameIdentifier, loaderIdentifier, url, type, requestMethod, requestHeaders, requestData, elapsedTime, walltime, frameName, frameSecurityOrigin, initiatorSourceCodeLocation, initiatorNode, originalRequestWillBeSentTimestamp, targetId)

Thought: it's regrettable that this function signature is so coupled to WI.Resource. Maybe the function should just take a WI.Resource and register it, someday.

> Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js:-570
> -                resource = new WI.Resource(url, null, type, loaderIdentifier, targetId, requestIdentifier, requestMethod, requestHeaders, requestData, elapsedTime, walltime, initiatorSourceCodeLocation, originalRequestWillBeSentTimestamp);

Thought: similarly, there is a bunch of weird knowledge here. I wonder if these code paths are only triggered by one or a few callers.
Comment 42 BJ Burg 2018-10-04 12:15:56 PDT
Comment on attachment 351480 [details]
Patch

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

This is almost ready to land. Here's what's left to do:

- Fix localization issue for byte range
- Move WI.Resource constructor refactor to another patch
- Address transferSize vs resourceSize computation for initiator node entries

>>>>> Source/WebCore/loader/TextTrackLoader.cpp:147
>>>>> +bool TextTrackLoader::load(const URL& url, HTMLTrackElement& element)
>>>> 
>>>> ... Oh, i see. Jer, is this a layering violation for this part of the code?
>>> 
>>> I might need some clarity as to what we consider a layering violation.
>>> 
>>> `TextTrackLoader` holds a reference to a `TextTrackLoaderClient`, which I think is always a `LoadableTextTrack`, which has access to its `HTMLTrackElement`.  Not sure if that is a similar concept to our "delegate" in WebInspector, but if so I can probably reach the `HTMLTrackElement` via the client.
>> 
>> I don't think so; there's already a bunch of code in WebCore/loader than references HTMLMediaElements (as well as other HTML element types).
> 
> Right. I'm not sure if it's okay in this code for a Loader to hold on to an Element subclass instance, or if they are supposed to be abstracted away with a *Client interface.

Ok, cool.

> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:389
> +        let setTextContent = (accessor) => {

Very cool.

> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:390
> +            let uniqueValues = this._uniqueValuesForDOMNodeEntry(entry, accessor);

Thought: It would be a little more definitive to do:

let entryRepresentsAnInitiator = !entry.resource // or some other condition
if (entryRepresentsAnInitiator) {
let uniqueValues = this._uniqueValuesForInitiatorEntry(entry, accessor);
if (uniqueValues.size() > 1)
...

We may want to expose non-node initiators (i.e., script) in the future and display them the same way. This would codify how initiators ought to be displayed when Group By Node (sic) is enabled.

EDIT: looking at the screenshot, it seems I'm confusing initiatorNode with the script location that's labeled 'Initiator'. Let's keep this as-is; in the future it would be worth exploring this idea (initiator tree in network table). It would be tricky to represent multi-level initiator chains without running out of room.

> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:443
> +            var resourceSize = entry.resourceSize;

Any reason to not use `let` and introduce a block scope?

> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:446
> +                resourceSize = resourceEntries.reduce((accumulator, current) => accumulator + (current.transferSize || 0), 0);

Why does this use transferSize instead of resourceSize? This seems wrong.

> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:449
>          case "transferSize":

Does the transferSize case work correctly when some of the things are (memory) cached? EDIT: I see, you added support in _populateTransferSizeCell. Nice.

> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:519
> +                    nameElement.textContent = WI.UIString("Byte Range %s").format(resource.requestHeaders["Range"].replace("bytes=", ""));

I have a feeling this is not going to localize well.
- This is a raw header, the value might be garbage.
- In the English localization, it should use an en-dash to represent a range of numbers.
- In other localizations, the range may be represented with different punctuation.

I'd recommend to extract the two numbers separately then format them into a localized string like "Byte Range %d–%d". Maybe the resource itself could expose the byte range as a getter that returns null or an object {start: end:}.

> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:-669
> -            comparator = comparator = (a, b) => a.startTime - b.startTime;

Haha

> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:823
> +        this._entriesSortComparator = (a, b) => reverseFactor * comparator(substitute(a, b), substitute(b, a));

This really needs a comment and/or a better name than 'substitute'. I'm caffeinated and still going crosseyed trying to understand it. I think it's replacing `entry` with the first resource that shares the same initiator node if it has one and `other` does not have the same initiator node. But the net effect isn't obvious.

> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:1033
> +

Nit: extra lines

> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:1107
> +        function updateEntry(existing) {

Capturing 'entry' here isn't making this any clearer. Maybe updateExistingFromEntry(existing, entry).

> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:1407
> +    _entryForDOMNode(domNode, requiredFields)

What's requiredFields for? I see we pass Object.keys(resourceEntry) but nothing happens with it.

> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:1409
> +        return {

I got a little confused that DOM node "entries" are completely different from resource entries, which are part of the Table API.
Comment 43 Devin Rousso 2018-10-05 19:04:36 PDT
Comment on attachment 351480 [details]
Patch

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

>> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:446
>> +                resourceSize = resourceEntries.reduce((accumulator, current) => accumulator + (current.transferSize || 0), 0);
> 
> Why does this use transferSize instead of resourceSize? This seems wrong.

I think this is a copypasta mistake 😅

>> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:1107
>> +        function updateEntry(existing) {
> 
> Capturing 'entry' here isn't making this any clearer. Maybe updateExistingFromEntry(existing, entry).

If I do that, then we have a shadowed variable `entry`.  I'll think of a better name.

>> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:1407
>> +    _entryForDOMNode(domNode, requiredFields)
> 
> What's requiredFields for? I see we pass Object.keys(resourceEntry) but nothing happens with it.

Leftover from a previous version.

>> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:1409
>> +        return {
> 
> I got a little confused that DOM node "entries" are completely different from resource entries, which are part of the Table API.

I don't think the Table API says anything about "entries", or really even knows about it.  It just asks for a number of rows and then tells us which `rowIndex` it's populating when it tries to render.  This follows that "pattern" in the sense that this is an "entry", just not for a resource.
Comment 44 Devin Rousso 2018-10-06 10:51:18 PDT
Created attachment 351728 [details]
Patch
Comment 45 BJ Burg 2018-10-08 08:52:15 PDT
Comment on attachment 351728 [details]
Patch

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

r=me, great work!

> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:818
> +        // If the entry has an `initiatorNode`, use that node's "first" resource as the value of

Thanks.

> Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:821
> +        // next to eachother, as they will all effectively be sorted by the first resource.

Nit: each other
Comment 46 Devin Rousso 2018-10-08 10:09:16 PDT
Created attachment 351785 [details]
Patch
Comment 47 WebKit Commit Bot 2018-10-08 11:26:00 PDT
Comment on attachment 351785 [details]
Patch

Clearing flags on attachment: 351785

Committed r236927: <https://trac.webkit.org/changeset/236927>
Comment 48 WebKit Commit Bot 2018-10-08 11:26:02 PDT
All reviewed patches have been landed.  Closing bug.
Comment 49 Truitt Savell 2018-10-18 09:07:02 PDT
Looks like the new test http/tests/inspector/network/resource-initiatorNode.html

added in https://trac.webkit.org/changeset/236927/webkit

is a flakey timeout.

History:
https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=http%2Ftests%2Finspector%2Fnetwork%2Fresource-initiatorNode.html

It is highly intermittent and only showed up recently.