⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 223170 in webkit


Ignore:
Timestamp:
Oct 11, 2017, 12:55:24 AM (9 years ago)
Author:
Joseph Pecoraro
Message:

Web Inspector: Network Tab - Show initially loaded resources even if network info not logged
​https://bugs.webkit.org/show_bug.cgi?id=178098
<rdar://problem/34073529>

Reviewed by Devin Rousso.

  • UserInterface/Models/Resource.js:

(WI.Resource.prototype.hasResponse):
Resources loaded by Page.getFrameTree have a response but no status code data.
So include finished resources as having a resource.

  • UserInterface/Views/NetworkTableContentView.js:

(WI.NetworkTableContentView):
(WI.NetworkTableContentView.prototype.closed):
(WI.NetworkTableContentView.prototype._populateWithInitialResourcesIfNeeded):
(WI.NetworkTableContentView.prototype._mainFrameDidChange):
Listen for the first main frame change to perform an initial population.

(WI.NetworkTableContentView.prototype._insertResourceAndReloadTable):
This path is not currently taken when table is null, but change the code so
that if it is reached without the table it would behave gracefully.

  • UserInterface/Views/ResourceHeadersContentView.js:

(WI.ResourceHeadersContentView.prototype._refreshSummarySection):
On first open none of the resources have a statusCode. Show an emDash.

Location:
trunk/Source/WebInspectorUI
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r223164 r223170  
     12017-10-11  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Network Tab - Show initially loaded resources even if network info not logged
     4        https://bugs.webkit.org/show_bug.cgi?id=178098
     5        <rdar://problem/34073529>
     6
     7        Reviewed by Devin Rousso.
     8
     9        * UserInterface/Models/Resource.js:
     10        (WI.Resource.prototype.hasResponse):
     11        Resources loaded by Page.getFrameTree have a response but no status code data.
     12        So include finished resources as having a resource.
     13
     14        * UserInterface/Views/NetworkTableContentView.js:
     15        (WI.NetworkTableContentView):
     16        (WI.NetworkTableContentView.prototype.closed):
     17        (WI.NetworkTableContentView.prototype._populateWithInitialResourcesIfNeeded):
     18        (WI.NetworkTableContentView.prototype._mainFrameDidChange):
     19        Listen for the first main frame change to perform an initial population.
     20
     21        (WI.NetworkTableContentView.prototype._insertResourceAndReloadTable):
     22        This path is not currently taken when table is null, but change the code so
     23        that if it is reached without the table it would behave gracefully.
     24
     25        * UserInterface/Views/ResourceHeadersContentView.js:
     26        (WI.ResourceHeadersContentView.prototype._refreshSummarySection):
     27        On first open none of the resources have a statusCode. Show an emDash.
     28
    1292017-10-10  Brian Burg  <bburg@apple.com>
    230
  • trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js

    r223058 r223170  
    654654    hasResponse()
    655655    {
    656         return !isNaN(this._statusCode);
     656        return !isNaN(this._statusCode) || this._finished;
    657657    }
    658658
  • trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js

    r223147 r223170  
    103103        WI.Resource.addEventListener(WI.Resource.Event.LoadingDidFail, this._resourceLoadingDidFail, this);
    104104        WI.Resource.addEventListener(WI.Resource.Event.TransferSizeDidChange, this._resourceTransferSizeDidChange, this);
     105        WI.frameResourceManager.addEventListener(WI.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this);
    105106        WI.timelineManager.persistentNetworkTimeline.addEventListener(WI.Timeline.Event.RecordAdded, this._networkTimelineRecordAdded, this);
     107
     108        this._needsInitialPopulate = true;
    106109    }
    107110
    … …  
    191194        WI.Frame.removeEventListener(null, null, this);
    192195        WI.Resource.removeEventListener(null, null, this);
     196        WI.frameResourceManager.removeEventListener(WI.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this);
    193197        WI.timelineManager.persistentNetworkTimeline.removeEventListener(WI.Timeline.Event.RecordAdded, this._networkTimelineRecordAdded, this);
    194198
    … …  
    648652    }
    649653
     654    _populateWithInitialResourcesIfNeeded()
     655    {
     656        if (!this._needsInitialPopulate)
     657            return;
     658
     659        this._needsInitialPopulate = false;
     660
     661        console.assert(WI.frameResourceManager.mainFrame);
     662
     663        let populateFrameResources = (frame) => {
     664            if (frame.provisionalMainResource)
     665                this._pendingInsertions.push(frame.provisionalMainResource);
     666            else if (frame.mainResource)
     667                this._pendingInsertions.push(frame.mainResource);
     668
     669            for (let resource of frame.resourceCollection.items)
     670                this._pendingInsertions.push(resource);
     671
     672            for (let childFrame of frame.childFrameCollection.items)
     673                populateFrameResources(childFrame);
     674        };
     675
     676        populateFrameResources(WI.frameResourceManager.mainFrame);
     677
     678        this.needsLayout();
     679    }
     680
    650681    _checkTextFilterAgainstFinishedResource(resource)
    651682    {
    … …  
    829860    }
    830861
     862    _mainFrameDidChange()
     863    {
     864        this._populateWithInitialResourcesIfNeeded();
     865    }
     866
    831867    _resourceLoadingDidFinish(event)
    832868    {
    … …  
    895931    _insertResourceAndReloadTable(resource)
    896932    {
    897         if (!(WI.tabBrowser.selectedTabContentView instanceof WI.NetworkTabContentView)) {
     933        if (!this._table || !(WI.tabBrowser.selectedTabContentView instanceof WI.NetworkTabContentView)) {
    898934            this._pendingInsertions.push(resource);
    899935            this.needsLayout();
    900936            return;
    901937        }
    902 
    903         console.assert(this._table);
    904         if (!this._table)
    905             return;
    906938
    907939        let entry = this._entryForResource(resource);
  • trunk/Source/WebInspectorUI/UserInterface/Views/ResourceHeadersContentView.js

    r223078 r223170  
    267267
    268268        let status = emDash;
    269         if (this._resource.hasResponse())
     269        if (!isNaN(this._resource.statusCode))
    270270            status = this._resource.statusCode + (this._resource.statusText ? " " + this._resource.statusText : "");
    271271        this._appendKeyValuePair(detailsElement, WI.UIString("Status"), status);
Note: See TracChangeset for help on using the changeset viewer.