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

Changeset 292037 in webkit


Ignore:
Timestamp:
Mar 29, 2022, 10:26:24 AM (5 years ago)
Author:
Patrick Angle
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/JavaScriptCore:

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:]):

Location:
trunk/Source
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r292014 r292037  
     12022-03-29  Patrick Angle  <pangle@apple.com>
     2
     3        Web Inspector: [Cocoa] Indicate a request was sent through proxy/private relay in Network tab
     4        https://bugs.webkit.org/show_bug.cgi?id=233202
     5
     6        Reviewed by Devin Rousso.
     7
     8        Add new `isProxyConnection` property to network metrics protocol object.
     9
     10        * inspector/protocol/Network.json:
     11
    1122022-03-28  Yusuke Suzuki  <ysuzuki@apple.com>
    213
  • trunk/Source/JavaScriptCore/inspector/protocol/Network.json

    r278511 r292037  
    9696                { "name": "responseBodyBytesReceived", "type": "number", "optional": true, "description": "Total HTTP response body bytes received over the network." },
    9797                { "name": "responseBodyDecodedSize", "type": "number", "optional": true, "description": "Total decoded response body size in bytes." },
    98                 { "name": "securityConnection", "$ref": "Security.Connection", "optional": true, "description": "Connection information for the completed request." }
     98                { "name": "securityConnection", "$ref": "Security.Connection", "optional": true, "description": "Connection information for the completed request." },
     99                { "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."}
    99100            ]
    100101        },
  • trunk/Source/WebCore/ChangeLog

    r292036 r292037  
     12022-03-29  Patrick Angle  <pangle@apple.com>
     2
     3        Web Inspector: [Cocoa] Indicate a request was sent through proxy/private relay in Network tab
     4        https://bugs.webkit.org/show_bug.cgi?id=233202
     5
     6        Reviewed by Devin Rousso.
     7
     8        Add plumbing for the new `isProxyConnection` network metric.
     9
     10        * inspector/agents/InspectorNetworkAgent.cpp:
     11        (WebCore::InspectorNetworkAgent::buildObjectForMetrics):
     12        * platform/network/NetworkLoadMetrics.cpp:
     13        (WebCore::AdditionalNetworkLoadMetricsForWebInspector::isolatedCopy):
     14        * platform/network/NetworkLoadMetrics.h:
     15        (WebCore::AdditionalNetworkLoadMetricsForWebInspector::encode const):
     16        (WebCore::AdditionalNetworkLoadMetricsForWebInspector::decode):
     17
    1182022-03-29  Brandon Stewart  <brandonstewart@apple.com>
    219
  • trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp

    r291992 r292037  
    276276        if (additionalMetrics->responseHeaderBytesReceived != std::numeric_limits<uint64_t>::max())
    277277            metrics->setResponseHeaderBytesReceived(additionalMetrics->responseHeaderBytesReceived);
    278     }
     278        metrics->setIsProxyConnection(additionalMetrics->isProxyConnection);
     279    }
     280
    279281    if (networkLoadMetrics.responseBodyBytesReceived != std::numeric_limits<uint64_t>::max())
    280282        metrics->setResponseBodyBytesReceived(networkLoadMetrics.responseBodyBytesReceived);
  • trunk/Source/WebCore/platform/network/NetworkLoadMetrics.cpp

    r291441 r292037  
    9292    copy->responseHeaderBytesReceived = responseHeaderBytesReceived;
    9393    copy->requestBodyBytesSent = requestBodyBytesSent;
     94    copy->isProxyConnection = isProxyConnection;
    9495    return copy;
    9596}
  • trunk/Source/WebCore/platform/network/NetworkLoadMetrics.h

    r291441 r292037  
    134134    uint64_t responseHeaderBytesReceived { std::numeric_limits<uint64_t>::max() };
    135135    uint64_t requestBodyBytesSent { std::numeric_limits<uint64_t>::max() };
     136
     137    bool isProxyConnection { false };
    136138private:
    137139    AdditionalNetworkLoadMetricsForWebInspector() { }
    … …  
    284286    encoder << responseHeaderBytesReceived;
    285287    encoder << requestBodyBytesSent;
     288
     289    encoder << isProxyConnection;
    286290}
    287291
    … …  
    332336    decoder >> requestBodyBytesSent;
    333337    if (!requestBodyBytesSent)
     338        return nullptr;
     339
     340    std::optional<bool> isProxyConnection;
     341    decoder >> isProxyConnection;
     342    if (!isProxyConnection)
    334343        return nullptr;
    335344
    … …  
    344353    decoded->responseHeaderBytesReceived = WTFMove(*responseHeaderBytesReceived);
    345354    decoded->requestBodyBytesSent = WTFMove(*requestBodyBytesSent);
     355    decoded->isProxyConnection = WTFMove(*isProxyConnection);
    346356    return decoded;
    347357}
  • trunk/Source/WebInspectorUI/ChangeLog

    r291740 r292037  
     12022-03-29  Patrick Angle  <pangle@apple.com>
     2
     3        Web Inspector: [Cocoa] Indicate a request was sent through proxy/private relay in Network tab
     4        https://bugs.webkit.org/show_bug.cgi?id=233202
     5
     6        Reviewed by Devin Rousso.
     7
     8        For resources that are sent through a proxy or relay (like iCloud Private Relay), the remoteAddress will be that
     9        of the proxy or relay server, not the server that provided the page to the proxy or relay. To indicate this, we
     10        now append `(Proxy)` to these remote IP addresses in Web Inspector so that it is clearer what server the remote
     11        address actually represents in these cases.
     12
     13        * Localizations/en.lproj/localizedStrings.js:
     14        * UserInterface/Models/LocalResource.js:
     15        * UserInterface/Models/Resource.js:
     16        (WI.Resource.prototype.get displayRemoteAddress):
     17        - Similar to `displayName` and `displayURL` which provide user-facing strings, add a `displayRemoteAddress` that
     18        will denote the address is a proxy if applicable.
     19       
     20        (WI.Resource.prototype.updateWithMetrics):
     21        * UserInterface/Views/NetworkTableContentView.js:
     22        (WI.NetworkTableContentView.prototype._entryForResource):
     23        * UserInterface/Views/ResourceDetailsSidebarPanel.js:
     24        (WI.ResourceDetailsSidebarPanel.prototype._refreshRequestAndResponse):
     25        * UserInterface/Views/ResourceHeadersContentView.js:
     26        (WI.ResourceHeadersContentView.prototype._refreshSummarySection):
     27        * UserInterface/Views/ResourceTimelineDataGridNode.js:
     28        (WI.ResourceTimelineDataGridNode.prototype.get data):
     29
    1302022-03-23  Razvan Caliman  <rcaliman@apple.com>
    231
  • trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js

    r290720 r292037  
    5757/* Label for case-insensitive URL match pattern of a local override. */
    5858localizedStrings["%s (Case Insensitive) @ Local Override"] = "%s (Case Insensitive)";
     59/* Label for the IP address of a proxy server used to retrieve a network resource. */
     60localizedStrings["%s (Proxy) @ Resource Remote Address"] = "%s (Proxy)";
    5961localizedStrings["%s (default)"] = "%s (default)";
    6062localizedStrings["%s (hidden)"] = "%s (hidden)";
  • trunk/Source/WebInspectorUI/UserInterface/Models/LocalResource.js

    r270604 r292037  
    7373        this._responseBodyTransferSize = !isNaN(metrics.responseBodyBytesReceived) ? metrics.responseBodyBytesReceived : NaN;
    7474        this._responseBodySize = !isNaN(metrics.responseBodyDecodedSize) ? metrics.responseBodyDecodedSize : NaN;
     75        this._isProxyConnection = !!metrics.isProxyConnection;
    7576
    7677        // Set by `WI.LocalResourceOverride`.
  • trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js

    r284139 r292037  
    8080        this._remoteAddress = null;
    8181        this._connectionIdentifier = null;
     82        this._isProxyConnection = false;
    8283        this._target = targetId ? WI.targetManager.targetForIdentifier(targetId) : WI.mainTarget;
    8384        this._redirects = [];
    … …  
    383384    }
    384385
     386    get displayRemoteAddress()
     387    {
     388        if (this._isProxyConnection)
     389            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);
     390
     391        return this._remoteAddress;
     392    }
     393
    385394    get mimeTypeComponents()
    386395    {
    … …  
    822831            this._security.connection = metrics.securityConnection;
    823832        }
     833
     834        this._isProxyConnection = !!metrics.isProxyConnection;
    824835
    825836        this.dispatchEventToListeners(WI.Resource.Event.MetricsDidChange);
  • trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js

    r288565 r292037  
    18991899            initiator: resource.initiatorSourceCodeLocation ? resource.initiatorSourceCodeLocation.displayLocationString() : "",
    19001900            priority: resource.priority,
    1901             remoteAddress: resource.remoteAddress,
     1901            remoteAddress: resource.displayRemoteAddress,
    19021902            connectionIdentifier: resource.connectionIdentifier,
    19031903            startTime: resource.firstTimestamp,
  • trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js

    r269359 r292037  
    365365            this._protocolRow.tooltip = protocolDisplayName ? this._resource.protocol : "";
    366366            this._priorityRow.value = WI.Resource.displayNameForPriority(this._resource.priority) || emDash;
    367             this._remoteAddressRow.value = this._resource.remoteAddress || emDash;
     367            this._remoteAddressRow.value = this._resource.displayRemoteAddress || emDash;
    368368            this._connectionIdentifierRow.value = this._resource.connectionIdentifier || emDash;
    369369        }
  • trunk/Source/WebInspectorUI/UserInterface/Views/ResourceHeadersContentView.js

    r270134 r292037  
    265265
    266266        if (this._resource.remoteAddress)
    267             this._summarySection.appendKeyValuePair(WI.UIString("Address"), this._resource.remoteAddress);
     267            this._summarySection.appendKeyValuePair(WI.UIString("Address"), this._resource.displayRemoteAddress);
    268268
    269269        let initiatorLocation = this._resource.initiatorSourceCodeLocation;
  • trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js

    r263429 r292037  
    7373        this._cachedData.protocol = this.resource.protocol;
    7474        this._cachedData.priority = this.resource.priority;
    75         this._cachedData.remoteAddress = this.resource.remoteAddress;
     75        this._cachedData.remoteAddress = this.resource.displayRemoteAddress;
    7676        this._cachedData.connectionIdentifier = this.resource.connectionIdentifier;
    7777        this._cachedData.initiator = this.resource.initiatorSourceCodeLocation;
  • trunk/Source/WebKit/ChangeLog

    r292035 r292037  
     12022-03-29  Patrick Angle  <pangle@apple.com>
     2
     3        Web Inspector: [Cocoa] Indicate a request was sent through proxy/private relay in Network tab
     4        https://bugs.webkit.org/show_bug.cgi?id=233202
     5
     6        Reviewed by Devin Rousso.
     7
     8        Add plumbing for the new `isProxyConnection` network metric.
     9
     10        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
     11        (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
     12
    1132022-03-28  Simon Fraser  <simon.fraser@apple.com>
    214
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm

    r291735 r292037  
    903903            additionalMetrics->requestBodyBytesSent = task.countOfBytesSent;
    904904            additionalMetrics->responseHeaderBytesReceived = responseHeaderBytesReceived;
     905
     906            additionalMetrics->isProxyConnection = m.proxyConnection;
     907
    905908            networkLoadMetrics.additionalNetworkLoadMetricsForWebInspector = WTFMove(additionalMetrics);
    906909        }
Note: See TracChangeset for help on using the changeset viewer.