Title: [234963] trunk/Source/WebInspectorUI
Revision
234963
Author
[email protected]
Date
2018-08-16 15:49:04 -0700 (Thu, 16 Aug 2018)

Log Message

Web Inspector: Show Initiator information in Network Table
https://bugs.webkit.org/show_bug.cgi?id=188590
<rdar://problem/43305488>

Patch by Joseph Pecoraro <[email protected]> on 2018-08-16
Reviewed by Matt Baker.

* UserInterface/Views/NetworkResourceDetailView.js:
(WI.NetworkResourceDetailView):
(WI.NetworkResourceDetailView.prototype.shown):
(WI.NetworkResourceDetailView.prototype.willShowWithCookie):
(WI.NetworkResourceDetailView.prototype._showContentViewForNavigationItem):
When a ResourceDetailView gets shown, it may also want to show its initial content view
with a cookie as the cookie may contain position highlight information.

* UserInterface/Views/NetworkTableContentView.js:
(WI.NetworkTableContentView):
(WI.NetworkTableContentView.prototype._showResourceDetailView):
(WI.NetworkTableContentView.prototype.showRepresentedObject):
When showing a represented object, pass the cookie information on to the detail
view's so that it may include the cookie when showing the final content view.

(WI.NetworkTableContentView.prototype.tablePopulateCell):
(WI.NetworkTableContentView.prototype._populateInitiatorCell):
(WI.NetworkTableContentView.prototype.initialLayout):
New initiator column contains a source code link to the call site.

(WI.NetworkTableContentView.prototype._generateSortComparator):
(WI.NetworkTableContentView.prototype._entryForResource):
Entry data for the initiator is a display string that can be sorted easily.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (234962 => 234963)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-08-16 22:37:22 UTC (rev 234962)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-08-16 22:49:04 UTC (rev 234963)
@@ -1,5 +1,37 @@
 2018-08-16  Joseph Pecoraro  <[email protected]>
 
+        Web Inspector: Show Initiator information in Network Table
+        https://bugs.webkit.org/show_bug.cgi?id=188590
+        <rdar://problem/43305488>
+
+        Reviewed by Matt Baker.
+
+        * UserInterface/Views/NetworkResourceDetailView.js:
+        (WI.NetworkResourceDetailView):
+        (WI.NetworkResourceDetailView.prototype.shown):
+        (WI.NetworkResourceDetailView.prototype.willShowWithCookie):
+        (WI.NetworkResourceDetailView.prototype._showContentViewForNavigationItem):
+        When a ResourceDetailView gets shown, it may also want to show its initial content view
+        with a cookie as the cookie may contain position highlight information.
+
+        * UserInterface/Views/NetworkTableContentView.js:
+        (WI.NetworkTableContentView):
+        (WI.NetworkTableContentView.prototype._showResourceDetailView):
+        (WI.NetworkTableContentView.prototype.showRepresentedObject):
+        When showing a represented object, pass the cookie information on to the detail
+        view's so that it may include the cookie when showing the final content view.
+
+        (WI.NetworkTableContentView.prototype.tablePopulateCell):
+        (WI.NetworkTableContentView.prototype._populateInitiatorCell):
+        (WI.NetworkTableContentView.prototype.initialLayout):
+        New initiator column contains a source code link to the call site.
+
+        (WI.NetworkTableContentView.prototype._generateSortComparator):
+        (WI.NetworkTableContentView.prototype._entryForResource):
+        Entry data for the initiator is a display string that can be sorted easily.
+
+2018-08-16  Joseph Pecoraro  <[email protected]>
+
         LayoutTest inspector/worker/debugger-pause.html sometimes times out
         https://bugs.webkit.org/show_bug.cgi?id=188580
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkResourceDetailView.js (234962 => 234963)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkResourceDetailView.js	2018-08-16 22:37:22 UTC (rev 234962)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkResourceDetailView.js	2018-08-16 22:49:04 UTC (rev 234963)
@@ -42,6 +42,8 @@
         this._cookiesContentView = null;
         this._sizesContentView = null;
         this._timingContentView = null;
+
+        this._contentViewCookie = null;
     }
 
     // Public
@@ -54,6 +56,12 @@
             return;
 
         this._showPreferredContentView();
+
+        if (this._contentViewCookie) {
+            this._contentBrowser.showContentView(this._contentBrowser.currentContentView, this._contentViewCookie);
+            this._contentViewCookie = null;
+        }
+
         this._contentBrowser.shown();
     }
 
@@ -69,6 +77,11 @@
         this._contentBrowser.contentViewContainer.closeAllContentViews();
     }
 
+    willShowWithCookie(cookie)
+    {
+        this._contentViewCookie = cookie;
+    }
+
     // ResourceHeadersContentView delegate
 
     headersContentViewGoToRequestData(headersContentView)
@@ -174,27 +187,27 @@
         case "preview":
             if (!this._resourceContentView)
                 this._resourceContentView = this._contentBrowser.showContentViewForRepresentedObject(this._resource);
-            this._contentBrowser.showContentView(this._resourceContentView);
+            this._contentBrowser.showContentView(this._resourceContentView, this._contentViewCookie);
             break;
         case "headers":
             if (!this._headersContentView)
                 this._headersContentView = new WI.ResourceHeadersContentView(this._resource, this);
-            this._contentBrowser.showContentView(this._headersContentView);
+            this._contentBrowser.showContentView(this._headersContentView, this._contentViewCookie);
             break;
         case "cookies":
             if (!this._cookiesContentView)
                 this._cookiesContentView = new WI.ResourceCookiesContentView(this._resource);
-            this._contentBrowser.showContentView(this._cookiesContentView);
+            this._contentBrowser.showContentView(this._cookiesContentView, this._contentViewCookie);
             break;
         case "sizes":
             if (!this._sizesContentView)
                 this._sizesContentView = new WI.ResourceSizesContentView(this._resource, this);
-            this._contentBrowser.showContentView(this._sizesContentView);
+            this._contentBrowser.showContentView(this._sizesContentView, this._contentViewCookie);
             break;
         case "timing":
             if (!this._timingContentView)
                 this._timingContentView = new WI.ResourceTimingContentView(this._resource);
-            this._contentBrowser.showContentView(this._timingContentView);
+            this._contentBrowser.showContentView(this._timingContentView, this._contentViewCookie);
             break;
         }
     }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js (234962 => 234963)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js	2018-08-16 22:37:22 UTC (rev 234962)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js	2018-08-16 22:49:04 UTC (rev 234963)
@@ -35,6 +35,7 @@
         this._pendingInsertions = [];
         this._pendingUpdates = [];
         this._pendingFilter = false;
+        this._showingRepresentedObjectCookie = null;
 
         this._table = null;
         this._nameColumnWidthSetting = new WI.Setting("network-table-content-view-name-column-width", 250);
@@ -289,7 +290,9 @@
             return;
         }
 
+        this._showingRepresentedObjectCookie = cookie;
         this._table.selectRow(rowIndex);
+        this._showingRepresentedObjectCookie = null;
     }
 
     // NetworkResourceDetailView delegate
@@ -391,6 +394,9 @@
         case "protocol":
             cell.textContent = entry.protocol || emDash;
             break;
+        case "initiator":
+            this._populateInitiatorCell(cell, entry);
+            break;
         case "priority":
             cell.textContent = WI.Resource.displayNameForPriority(entry.priority) || emDash;
             break;
@@ -460,6 +466,21 @@
         cell.append(entry.domain);
     }
 
+    _populateInitiatorCell(cell, entry)
+    {
+        let initiatorLocation = entry.resource.initiatorSourceCodeLocation;
+        if (!initiatorLocation) {
+            cell.textContent = emDash;
+            return;
+        }
+
+        const options = {
+            dontFloat: true,
+            ignoreSearchTab: true,
+        };
+        cell.appendChild(WI.createSourceCodeLocationLink(initiatorLocation, options));
+    }
+
     _populateTransferSizeCell(cell, entry)
     {
         let responseSource = entry.resource.responseSource;
@@ -578,6 +599,7 @@
         case "method":
         case "scheme":
         case "protocol":
+        case "initiator":
         case "remoteAddress":
             // Simple string.
             comparator = (a, b) => (a[sortColumnIdentifier] || "").extendedLocaleCompare(b[sortColumnIdentifier] || "");
@@ -717,6 +739,13 @@
             initialWidth: 75,
         });
 
+        this._initiatorColumn = new WI.TableColumn("initiator", WI.UIString("Initiator"), {
+            hidden: true,
+            minWidth: 75,
+            maxWidth: 175,
+            initialWidth: 125,
+        });
+
         this._priorityColumn = new WI.TableColumn("priority", WI.UIString("Priority"), {
             hidden: true,
             minWidth: 65,
@@ -777,6 +806,7 @@
         this._table.addColumn(this._schemeColumn);
         this._table.addColumn(this._statusColumn);
         this._table.addColumn(this._protocolColumn);
+        this._table.addColumn(this._initiatorColumn);
         this._table.addColumn(this._priorityColumn);
         this._table.addColumn(this._remoteAddressColumn);
         this._table.addColumn(this._connectionIdentifierColumn);
@@ -969,6 +999,10 @@
             this.replaceSubview(oldResourceDetailView, this._resourceDetailView);
         } else
             this.addSubview(this._resourceDetailView);
+
+        if (this._showingRepresentedObjectCookie)
+            this._resourceDetailView.willShowWithCookie(this._showingRepresentedObjectCookie);
+
         this._resourceDetailView.shown();
 
         this.element.classList.add("showing-detail");
@@ -1197,6 +1231,7 @@
             transferSize: !isNaN(resource.networkTotalTransferSize) ? resource.networkTotalTransferSize : resource.estimatedTotalTransferSize,
             time: resource.totalDuration,
             protocol: resource.protocol,
+            initiator: resource.initiatorSourceCodeLocation ? resource.initiatorSourceCodeLocation.displayLocationString() : "",
             priority: resource.priority,
             remoteAddress: resource.remoteAddress,
             connectionIdentifier: resource.connectionIdentifier,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to