Title: [292037] trunk/Source
Revision
292037
Author
pan...@apple.com
Date
2022-03-29 10:26:24 -0700 (Tue, 29 Mar 2022)

Log Message

Web Inspector: [Cocoa] Indicate a request was sent through proxy/private relay in Network tab
https://bugs.webkit.org/show_bug.cgi?id=233202

Reviewed by Devin Rousso.

Source/_javascript_Core:

Add new `isProxyConnection` property to network metrics protocol object.

* inspector/protocol/Network.json:

Source/WebCore:

Add plumbing for the new `isProxyConnection` network metric.

* inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::buildObjectForMetrics):
* platform/network/NetworkLoadMetrics.cpp:
(WebCore::AdditionalNetworkLoadMetricsForWebInspector::isolatedCopy):
* platform/network/NetworkLoadMetrics.h:
(WebCore::AdditionalNetworkLoadMetricsForWebInspector::encode const):
(WebCore::AdditionalNetworkLoadMetricsForWebInspector::decode):

Source/WebInspectorUI:

For resources that are sent through a proxy or relay (like iCloud Private Relay), the remoteAddress will be that
of the proxy or relay server, not the server that provided the page to the proxy or relay. To indicate this, we
now append `(Proxy)` to these remote IP addresses in Web Inspector so that it is clearer what server the remote
address actually represents in these cases.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Models/LocalResource.js:
* UserInterface/Models/Resource.js:
(WI.Resource.prototype.get displayRemoteAddress):
- Similar to `displayName` and `displayURL` which provide user-facing strings, add a `displayRemoteAddress` that
will denote the address is a proxy if applicable.

(WI.Resource.prototype.updateWithMetrics):
* UserInterface/Views/NetworkTableContentView.js:
(WI.NetworkTableContentView.prototype._entryForResource):
* UserInterface/Views/ResourceDetailsSidebarPanel.js:
(WI.ResourceDetailsSidebarPanel.prototype._refreshRequestAndResponse):
* UserInterface/Views/ResourceHeadersContentView.js:
(WI.ResourceHeadersContentView.prototype._refreshSummarySection):
* UserInterface/Views/ResourceTimelineDataGridNode.js:
(WI.ResourceTimelineDataGridNode.prototype.get data):

Source/WebKit:

Add plumbing for the new `isProxyConnection` network metric.

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (292036 => 292037)


--- trunk/Source/_javascript_Core/ChangeLog	2022-03-29 17:21:17 UTC (rev 292036)
+++ trunk/Source/_javascript_Core/ChangeLog	2022-03-29 17:26:24 UTC (rev 292037)
@@ -1,3 +1,14 @@
+2022-03-29  Patrick Angle  <pan...@apple.com>
+
+        Web Inspector: [Cocoa] Indicate a request was sent through proxy/private relay in Network tab
+        https://bugs.webkit.org/show_bug.cgi?id=233202
+
+        Reviewed by Devin Rousso.
+
+        Add new `isProxyConnection` property to network metrics protocol object.
+
+        * inspector/protocol/Network.json:
+
 2022-03-28  Yusuke Suzuki  <ysuz...@apple.com>
 
         [JSC] Clean up some 32bit load/store with 64bit load/store

Modified: trunk/Source/_javascript_Core/inspector/protocol/Network.json (292036 => 292037)


--- trunk/Source/_javascript_Core/inspector/protocol/Network.json	2022-03-29 17:21:17 UTC (rev 292036)
+++ trunk/Source/_javascript_Core/inspector/protocol/Network.json	2022-03-29 17:26:24 UTC (rev 292037)
@@ -95,7 +95,8 @@
                 { "name": "responseHeaderBytesReceived", "type": "number", "optional": true, "description": "Total HTTP response header bytes received over the network." },
                 { "name": "responseBodyBytesReceived", "type": "number", "optional": true, "description": "Total HTTP response body bytes received over the network." },
                 { "name": "responseBodyDecodedSize", "type": "number", "optional": true, "description": "Total decoded response body size in bytes." },
-                { "name": "securityConnection", "$ref": "Security.Connection", "optional": true, "description": "Connection information for the completed request." }
+                { "name": "securityConnection", "$ref": "Security.Connection", "optional": true, "description": "Connection information for the completed request." },
+                { "name": "isProxyConnection", "type": "boolean", "optional": true, "description": "Whether or not the connection was proxied through a server. If <code>true</code>, the <code>remoteAddress</code> will be for the proxy server, not the server that provided the resource to the proxy server."}
             ]
         },
         {

Modified: trunk/Source/WebCore/ChangeLog (292036 => 292037)


--- trunk/Source/WebCore/ChangeLog	2022-03-29 17:21:17 UTC (rev 292036)
+++ trunk/Source/WebCore/ChangeLog	2022-03-29 17:26:24 UTC (rev 292037)
@@ -1,3 +1,20 @@
+2022-03-29  Patrick Angle  <pan...@apple.com>
+
+        Web Inspector: [Cocoa] Indicate a request was sent through proxy/private relay in Network tab
+        https://bugs.webkit.org/show_bug.cgi?id=233202
+
+        Reviewed by Devin Rousso.
+
+        Add plumbing for the new `isProxyConnection` network metric.
+
+        * inspector/agents/InspectorNetworkAgent.cpp:
+        (WebCore::InspectorNetworkAgent::buildObjectForMetrics):
+        * platform/network/NetworkLoadMetrics.cpp:
+        (WebCore::AdditionalNetworkLoadMetricsForWebInspector::isolatedCopy):
+        * platform/network/NetworkLoadMetrics.h:
+        (WebCore::AdditionalNetworkLoadMetricsForWebInspector::encode const):
+        (WebCore::AdditionalNetworkLoadMetricsForWebInspector::decode):
+
 2022-03-29  Brandon Stewart  <brandonstew...@apple.com>
 
         Need to add ISO annotations to GPUUncapturedErrorEvent

Modified: trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp (292036 => 292037)


--- trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp	2022-03-29 17:21:17 UTC (rev 292036)
+++ trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp	2022-03-29 17:26:24 UTC (rev 292037)
@@ -275,7 +275,9 @@
             metrics->setRequestBodyBytesSent(additionalMetrics->requestBodyBytesSent);
         if (additionalMetrics->responseHeaderBytesReceived != std::numeric_limits<uint64_t>::max())
             metrics->setResponseHeaderBytesReceived(additionalMetrics->responseHeaderBytesReceived);
+        metrics->setIsProxyConnection(additionalMetrics->isProxyConnection);
     }
+
     if (networkLoadMetrics.responseBodyBytesReceived != std::numeric_limits<uint64_t>::max())
         metrics->setResponseBodyBytesReceived(networkLoadMetrics.responseBodyBytesReceived);
     if (networkLoadMetrics.responseBodyDecodedSize != std::numeric_limits<uint64_t>::max())

Modified: trunk/Source/WebCore/platform/network/NetworkLoadMetrics.cpp (292036 => 292037)


--- trunk/Source/WebCore/platform/network/NetworkLoadMetrics.cpp	2022-03-29 17:21:17 UTC (rev 292036)
+++ trunk/Source/WebCore/platform/network/NetworkLoadMetrics.cpp	2022-03-29 17:26:24 UTC (rev 292037)
@@ -91,6 +91,7 @@
     copy->requestHeaderBytesSent = requestHeaderBytesSent;
     copy->responseHeaderBytesReceived = responseHeaderBytesReceived;
     copy->requestBodyBytesSent = requestBodyBytesSent;
+    copy->isProxyConnection = isProxyConnection;
     return copy;
 }
 

Modified: trunk/Source/WebCore/platform/network/NetworkLoadMetrics.h (292036 => 292037)


--- trunk/Source/WebCore/platform/network/NetworkLoadMetrics.h	2022-03-29 17:21:17 UTC (rev 292036)
+++ trunk/Source/WebCore/platform/network/NetworkLoadMetrics.h	2022-03-29 17:26:24 UTC (rev 292037)
@@ -133,6 +133,8 @@
     uint64_t requestHeaderBytesSent { std::numeric_limits<uint64_t>::max() };
     uint64_t responseHeaderBytesReceived { std::numeric_limits<uint64_t>::max() };
     uint64_t requestBodyBytesSent { std::numeric_limits<uint64_t>::max() };
+
+    bool isProxyConnection { false };
 private:
     AdditionalNetworkLoadMetricsForWebInspector() { }
 };
@@ -283,6 +285,8 @@
     encoder << requestHeaderBytesSent;
     encoder << responseHeaderBytesReceived;
     encoder << requestBodyBytesSent;
+
+    encoder << isProxyConnection;
 }
 
 template<class Decoder>
@@ -333,6 +337,11 @@
     if (!requestBodyBytesSent)
         return nullptr;
 
+    std::optional<bool> isProxyConnection;
+    decoder >> isProxyConnection;
+    if (!isProxyConnection)
+        return nullptr;
+
     auto decoded = AdditionalNetworkLoadMetricsForWebInspector::create();
     decoded->priority = WTFMove(*priority);
     decoded->remoteAddress = WTFMove(*remoteAddress);
@@ -343,6 +352,7 @@
     decoded->requestHeaderBytesSent = WTFMove(*requestHeaderBytesSent);
     decoded->responseHeaderBytesReceived = WTFMove(*responseHeaderBytesReceived);
     decoded->requestBodyBytesSent = WTFMove(*requestBodyBytesSent);
+    decoded->isProxyConnection = WTFMove(*isProxyConnection);
     return decoded;
 }
 

Modified: trunk/Source/WebInspectorUI/ChangeLog (292036 => 292037)


--- trunk/Source/WebInspectorUI/ChangeLog	2022-03-29 17:21:17 UTC (rev 292036)
+++ trunk/Source/WebInspectorUI/ChangeLog	2022-03-29 17:26:24 UTC (rev 292037)
@@ -1,3 +1,32 @@
+2022-03-29  Patrick Angle  <pan...@apple.com>
+
+        Web Inspector: [Cocoa] Indicate a request was sent through proxy/private relay in Network tab
+        https://bugs.webkit.org/show_bug.cgi?id=233202
+
+        Reviewed by Devin Rousso.
+
+        For resources that are sent through a proxy or relay (like iCloud Private Relay), the remoteAddress will be that
+        of the proxy or relay server, not the server that provided the page to the proxy or relay. To indicate this, we
+        now append `(Proxy)` to these remote IP addresses in Web Inspector so that it is clearer what server the remote
+        address actually represents in these cases.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Models/LocalResource.js:
+        * UserInterface/Models/Resource.js:
+        (WI.Resource.prototype.get displayRemoteAddress):
+        - Similar to `displayName` and `displayURL` which provide user-facing strings, add a `displayRemoteAddress` that
+        will denote the address is a proxy if applicable.
+        
+        (WI.Resource.prototype.updateWithMetrics):
+        * UserInterface/Views/NetworkTableContentView.js:
+        (WI.NetworkTableContentView.prototype._entryForResource):
+        * UserInterface/Views/ResourceDetailsSidebarPanel.js:
+        (WI.ResourceDetailsSidebarPanel.prototype._refreshRequestAndResponse):
+        * UserInterface/Views/ResourceHeadersContentView.js:
+        (WI.ResourceHeadersContentView.prototype._refreshSummarySection):
+        * UserInterface/Views/ResourceTimelineDataGridNode.js:
+        (WI.ResourceTimelineDataGridNode.prototype.get data):
+
 2022-03-23  Razvan Caliman  <rcali...@apple.com>
 
         Web Inspector: Styles panel: Unwanted extra dash when autocompleting CSS variable names

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (292036 => 292037)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2022-03-29 17:21:17 UTC (rev 292036)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2022-03-29 17:26:24 UTC (rev 292037)
@@ -56,6 +56,8 @@
 localizedStrings["%s (%s, %s)"] = "%s (%s, %s)";
 /* Label for case-insensitive URL match pattern of a local override. */
 localizedStrings["%s (Case Insensitive) @ Local Override"] = "%s (Case Insensitive)";
+/* Label for the IP address of a proxy server used to retrieve a network resource. */
+localizedStrings["%s (Proxy) @ Resource Remote Address"] = "%s (Proxy)";
 localizedStrings["%s (default)"] = "%s (default)";
 localizedStrings["%s (hidden)"] = "%s (hidden)";
 localizedStrings["%s Callback"] = "%s Callback";

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/LocalResource.js (292036 => 292037)


--- trunk/Source/WebInspectorUI/UserInterface/Models/LocalResource.js	2022-03-29 17:21:17 UTC (rev 292036)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/LocalResource.js	2022-03-29 17:26:24 UTC (rev 292037)
@@ -72,6 +72,7 @@
         this._responseHeadersTransferSize = !isNaN(metrics.responseHeaderBytesReceived) ? metrics.responseHeaderBytesReceived : NaN;
         this._responseBodyTransferSize = !isNaN(metrics.responseBodyBytesReceived) ? metrics.responseBodyBytesReceived : NaN;
         this._responseBodySize = !isNaN(metrics.responseBodyDecodedSize) ? metrics.responseBodyDecodedSize : NaN;
+        this._isProxyConnection = !!metrics.isProxyConnection;
 
         // Set by `WI.LocalResourceOverride`.
         this._localResourceOverride = null;

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js (292036 => 292037)


--- trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js	2022-03-29 17:21:17 UTC (rev 292036)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js	2022-03-29 17:26:24 UTC (rev 292037)
@@ -79,6 +79,7 @@
         this._priority = WI.Resource.NetworkPriority.Unknown;
         this._remoteAddress = null;
         this._connectionIdentifier = null;
+        this._isProxyConnection = false;
         this._target = targetId ? WI.targetManager.targetForIdentifier(targetId) : WI.mainTarget;
         this._redirects = [];
 
@@ -382,6 +383,14 @@
         return WI.truncateURL(this._url, isMultiLine, dataURIMaxSize);
     }
 
+    get displayRemoteAddress()
+    {
+        if (this._isProxyConnection)
+            return WI.UIString("%s (Proxy)", "%s (Proxy) @ Resource Remote Address", "Label for the IP address of a proxy server used to retrieve a network resource.").format(this._remoteAddress);
+
+        return this._remoteAddress;
+    }
+
     get mimeTypeComponents()
     {
         if (!this._mimeTypeComponents)
@@ -822,6 +831,8 @@
             this._security.connection = metrics.securityConnection;
         }
 
+        this._isProxyConnection = !!metrics.isProxyConnection;
+
         this.dispatchEventToListeners(WI.Resource.Event.MetricsDidChange);
     }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js (292036 => 292037)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js	2022-03-29 17:21:17 UTC (rev 292036)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js	2022-03-29 17:26:24 UTC (rev 292037)
@@ -1898,7 +1898,7 @@
             protocol: resource.protocol,
             initiator: resource.initiatorSourceCodeLocation ? resource.initiatorSourceCodeLocation.displayLocationString() : "",
             priority: resource.priority,
-            remoteAddress: resource.remoteAddress,
+            remoteAddress: resource.displayRemoteAddress,
             connectionIdentifier: resource.connectionIdentifier,
             startTime: resource.firstTimestamp,
             currentSession: true,

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js (292036 => 292037)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js	2022-03-29 17:21:17 UTC (rev 292036)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js	2022-03-29 17:26:24 UTC (rev 292037)
@@ -364,7 +364,7 @@
             this._protocolRow.value = protocolDisplayName || emDash;
             this._protocolRow.tooltip = protocolDisplayName ? this._resource.protocol : "";
             this._priorityRow.value = WI.Resource.displayNameForPriority(this._resource.priority) || emDash;
-            this._remoteAddressRow.value = this._resource.remoteAddress || emDash;
+            this._remoteAddressRow.value = this._resource.displayRemoteAddress || emDash;
             this._connectionIdentifierRow.value = this._resource.connectionIdentifier || emDash;
         }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceHeadersContentView.js (292036 => 292037)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceHeadersContentView.js	2022-03-29 17:21:17 UTC (rev 292036)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceHeadersContentView.js	2022-03-29 17:26:24 UTC (rev 292037)
@@ -264,7 +264,7 @@
         this._summarySection.appendKeyValuePair(WI.UIString("Source"), source);
 
         if (this._resource.remoteAddress)
-            this._summarySection.appendKeyValuePair(WI.UIString("Address"), this._resource.remoteAddress);
+            this._summarySection.appendKeyValuePair(WI.UIString("Address"), this._resource.displayRemoteAddress);
 
         let initiatorLocation = this._resource.initiatorSourceCodeLocation;
         if (initiatorLocation) {

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js (292036 => 292037)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js	2022-03-29 17:21:17 UTC (rev 292036)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js	2022-03-29 17:26:24 UTC (rev 292037)
@@ -72,7 +72,7 @@
         this._cachedData.latency = this.resource.latency;
         this._cachedData.protocol = this.resource.protocol;
         this._cachedData.priority = this.resource.priority;
-        this._cachedData.remoteAddress = this.resource.remoteAddress;
+        this._cachedData.remoteAddress = this.resource.displayRemoteAddress;
         this._cachedData.connectionIdentifier = this.resource.connectionIdentifier;
         this._cachedData.initiator = this.resource.initiatorSourceCodeLocation;
         this._cachedData.source = this.resource.initiatorSourceCodeLocation; // Timeline Overview

Modified: trunk/Source/WebKit/ChangeLog (292036 => 292037)


--- trunk/Source/WebKit/ChangeLog	2022-03-29 17:21:17 UTC (rev 292036)
+++ trunk/Source/WebKit/ChangeLog	2022-03-29 17:26:24 UTC (rev 292037)
@@ -1,3 +1,15 @@
+2022-03-29  Patrick Angle  <pan...@apple.com>
+
+        Web Inspector: [Cocoa] Indicate a request was sent through proxy/private relay in Network tab
+        https://bugs.webkit.org/show_bug.cgi?id=233202
+
+        Reviewed by Devin Rousso.
+
+        Add plumbing for the new `isProxyConnection` network metric.
+
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
+
 2022-03-28  Simon Fraser  <simon.fra...@apple.com>
 
         [iOS GPUProcess] Image decoding should not trigger IOSurface usage in the web process

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (292036 => 292037)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2022-03-29 17:21:17 UTC (rev 292036)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2022-03-29 17:26:24 UTC (rev 292037)
@@ -902,6 +902,9 @@
             additionalMetrics->requestHeaderBytesSent = requestHeaderBytesSent;
             additionalMetrics->requestBodyBytesSent = task.countOfBytesSent;
             additionalMetrics->responseHeaderBytesReceived = responseHeaderBytesReceived;
+
+            additionalMetrics->isProxyConnection = m.proxyConnection;
+
             networkLoadMetrics.additionalNetworkLoadMetricsForWebInspector = WTFMove(additionalMetrics);
         }
 #if HAVE(CFNETWORK_METRICS_APIS_V4)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to