tree: cb810950178deadfc06ac41a3916ece84eb0c26c [search]
  1. components/
  2. forward/
  3. binaryResourceView.css
  4. BinaryResourceView.test.ts
  5. BinaryResourceView.ts
  6. BUILD.gn
  7. DIR_METADATA
  8. eventSourceMessagesView.css
  9. EventSourceMessagesView.ts
  10. FetchHeaderCommenting.test.ts
  11. FetchHeaderCommenting.ts
  12. LinkPreloadGenerator.test.ts
  13. LinkPreloadGenerator.ts
  14. network-meta.ts
  15. network.ts
  16. networkConfigView.css
  17. NetworkConfigView.test.ts
  18. NetworkConfigView.ts
  19. NetworkDataGridNode.test.ts
  20. NetworkDataGridNode.ts
  21. NetworkFrameGrouper.ts
  22. NetworkItemView.test.ts
  23. NetworkItemView.ts
  24. networkLogView.css
  25. NetworkLogView.test.ts
  26. NetworkLogView.ts
  27. NetworkLogViewColumns.test.ts
  28. NetworkLogViewColumns.ts
  29. networkManageCustomHeadersView.css
  30. NetworkManageCustomHeadersView.test.ts
  31. NetworkManageCustomHeadersView.ts
  32. NetworkOverview.test.ts
  33. NetworkOverview.ts
  34. networkPanel.css
  35. NetworkPanel.test.ts
  36. NetworkPanel.ts
  37. NetworkSearchScope.test.ts
  38. NetworkSearchScope.ts
  39. networkTimingTable.css
  40. networkWaterfallColumn.css
  41. NetworkWaterfallColumn.test.ts
  42. NetworkWaterfallColumn.ts
  43. OWNERS
  44. README.md
  45. requestConditionsDrawer.css
  46. RequestConditionsDrawer.test.ts
  47. RequestConditionsDrawer.ts
  48. requestCookiesView.css
  49. RequestCookiesView.test.ts
  50. RequestCookiesView.ts
  51. requestDeviceBoundSessionsView.css
  52. RequestDeviceBoundSessionsView.test.ts
  53. RequestDeviceBoundSessionsView.ts
  54. RequestHeadersView.test.ts
  55. RequestHeadersView.ts
  56. requestHTMLView.css
  57. RequestHTMLView.test.ts
  58. RequestHTMLView.ts
  59. requestInitiatorView.css
  60. RequestInitiatorView.test.ts
  61. RequestInitiatorView.ts
  62. requestInitiatorViewTree.css
  63. requestPayloadTree.css
  64. requestPayloadView.css
  65. RequestPayloadView.test.ts
  66. RequestPayloadView.ts
  67. RequestPreviewView.test.ts
  68. RequestPreviewView.ts
  69. RequestResponseView.test.ts
  70. RequestResponseView.ts
  71. RequestTimingView.test.ts
  72. RequestTimingView.ts
  73. resourceChunkView.css
  74. ResourceChunkView.ts
  75. ResourceDirectSocketChunkView.test.ts
  76. ResourceDirectSocketChunkView.ts
  77. ResourceWebSocketFrameView.test.ts
  78. ResourceWebSocketFrameView.ts
  79. ShowMoreDetailsWidget.test.ts
  80. ShowMoreDetailsWidget.ts
  81. signedExchangeInfoTree.css
  82. signedExchangeInfoView.css
  83. SignedExchangeInfoView.test.ts
  84. SignedExchangeInfoView.ts
front_end/panels/network/README.md

Network panel (front_end/panels/network/)

Overview

This directory holds the Network panel. It shows the request log, the request details tabs, the request conditions drawer, and the network conditions drawer. It is in the panels layer, the top of core -> models -> ui -> panels.

The panel is mostly UI. CDP access lives in core/sdk (SDK.NetworkManager, SDK.NetworkRequest). The request log lives in models/logs (Logs.NetworkLog). HAR export lives in models/har. Timing math lives in models/network_time_calculator. Put new non-UI logic in one of those modules, not here. See core/sdk/README.md and foundation/README.md.

Public Interface & Entrypoints

GN targetEntrypointVisibilityPurpose
:bundlenetwork.tsEntrypoints, AI assistance, a few sibling panels and components, tests, devtools_panels_visibilityPublic surface of the panel.
:metanetwork-meta.tsThis module, entrypointsLazy views, actions, setting UIs, revealers, context menu provider.
:network— (implementation)— (devtools_ui_module)All .ts sources listed in BUILD.gn.
:css_files*.css—generate_css target for the panel stylesheets.
./forward:bundleforward/forward.tsmodels, panels, uiLight types other modules use to link into the panel.
./components:bundlecomponents/components.tsThis module, panels/application, devtools_panels_visibilityLeaf components for headers, trust tokens and direct sockets.

BUILD.gn has the exact visibility lists. Ask an owner before you add a new consumer.

network.ts and forward/forward.ts define the public surface. Files they do not re-export are internal.

  • Key classes:
    • NetworkPanel (NetworkPanel.ts): the panel singleton (NetworkPanel.instance()). Also holds revealers such as RequestRevealer, RequestLocationRevealer and RequestIdRevealer, and SearchNetworkView.
    • NetworkLogView (NetworkLogView.ts): the request grid, its filters and the summary. Uses DEFAULT_VIEW and MoreFiltersDropDownUI.
    • NetworkRequestNode and NetworkGroupNode (NetworkDataGridNode.ts): grid rows.
    • NetworkItemView (NetworkItemView.ts): the tabbed details view for one request.
    • RequestConditionsDrawer (RequestConditionsDrawer.ts): drawer view network.blocked-urls.
    • NetworkConfigView (NetworkConfigView.ts): drawer view network.config.

Local Invariants & Anti-Patterns

1. Link into the panel through forward and a revealer

To open a request, reveal a forward type. This keeps callers off the heavy :bundle and off the NetworkPanel singleton. network-meta.ts registers a revealer for each revealable type.

// ❌ BAD: needs the whole panel bundle, and does not show the panel first.
Network.NetworkPanel.NetworkPanel.instance().revealAndHighlightRequest(request);
// ✅ GOOD: the pattern used in panels/application/FrameDetailsView.ts.
const requestLocation = NetworkForward.UIRequestLocation.UIRequestLocation.tab(
    request, NetworkForward.UIRequestLocation.UIRequestTabs.HEADERS_COMPONENT);
await Common.Revealer.reveal(requestLocation);

2. Views take data and callbacks; presenters inject the view

Widgets here such as NetworkLogView follow the UI eng vision. A presenter takes view = DEFAULT_VIEW in its constructor and calls this.#view(...). The view input holds data and callbacks. See docs/ui_engineering.md.

// ❌ BAD: the presenter hard-codes the view, so tests cannot inject a stub.
MORE_FILTERS_DEFAULT_VIEW(input, undefined, this.#filterElement);
// ✅ GOOD: from MoreFiltersDropDownUI in NetworkLogView.ts.
export interface MoreFiltersViewInput {
  hideDataURLs: boolean;
  onHideDataURLsChange: () => void;
  // ...
}

export class MoreFiltersDropDownUI extends Common.ObjectWrapper.ObjectWrapper<UI.FilterBar.FilterUIEventTypes> {
  readonly #view: MoreFiltersView;

  constructor(view: MoreFiltersView = MORE_FILTERS_DEFAULT_VIEW) {
    super();
    this.#view = view;
  }
}

Styles. Light DOM stylesheets such as networkLogView.css are wrapped in @scope to (devtools-widget > *). Prefer --sys-size-* tokens over raw pixel values.

Verification

./dt test front_end/panels/network
autoninja -C out/Default front_end/panels/network:unittests
./dt lint front_end/panels/network
./dt test test/e2e/network

./components has its own unittests target. In tests that create a NetworkPanel, dispose targets and await UI.Widget.Widget.allUpdatesComplete and RenderCoordinator.done() in afterEach (see NetworkPanel.test.ts).