gecko-dev/devtools/client/netmonitor
2018-11-13 11:31:39 -05:00
..
bin
configs
src Bug 1505073 - Fix the arrow positioning for the network throttling menu button in RDM. r=Honza 2018-11-13 11:31:39 -05:00
test Bug 1496742 - Allow to display Referrer Policy for a given request. r=Honza 2018-11-05 16:44:17 +00:00
.babelrc
.eslintrc.js
index.html Bug 1471152 - Package all panel scripts under resource://devtools/ instead of chrome://devtools/. r=jdescottes 2018-06-25 12:59:22 -07:00
initializer.js Bug 1486741 - Enable ESLint rule comma-dangle for all of mozilla-central (automatic fixes). r=mossop 2018-10-19 12:55:39 +00:00
launchpad.js Sumary: Bug 862851 - Swap the Domain and File columns in the network panel r=Honza 2018-10-30 16:44:15 +00:00
moz.build Bug 1471152 - Package all panel scripts under resource://devtools/ instead of chrome://devtools/. r=jdescottes 2018-06-25 12:59:22 -07:00
package.json
panel.js Bug 1397020 - Remove useless calls to TabTarget.attach r=yulia 2018-09-26 21:11:51 +00:00
README.md Bug 1429421 - remove gcli code; r=jdescottes,julienw,ochameau 2018-09-06 11:42:57 +00:00
webpack.config.js Bug 1502910 - Remove TimelineActor. r=Honza 2018-10-30 10:49:19 +00:00
yarn.lock

Network Monitor

The Network Monitor (netmonitor) shows you all the network requests Firefox makes (for example, when a page is loaded or when an XMLHttpRequest is performed) , how long each request takes, and details of each request. You can edit the method, query, header and resend the request as well. Read MDN to learn all the features and how to use the tool.

Prerequisite

If you want to build the Network Monitor inside of the DevTools toolbox (Firefox Devtools Panels), follow the simple Firefox build document in MDN. Start your compiled firefox and open the Firefox developer tool, you can see the Network Monitor inside.

Run inside of the DevTools toolbox

Files used to run the Network Monitor inside of the DevTools toolbox.

  • panel.js called by devtools toolbox to launch the Network Monitor panel.
  • index.html panel UI and launch scripts.
  • src/connector/ wrap function call for Browser specific API. Current support Firefox and Chrome(experimental).

Run in the browser tab (experimental)

Files used to run the Network Monitor in the browser tab

  • bin/ files to launch test server.
  • configs/ dev configs.
  • launchpad.js the entry point, equivalent to index.html.
  • webpack.config.js the webpack config file, including plenty of module alias map to shims and polyfills.
  • package.json declare every required packages and available commands.

To run in the browser tab, the Network Monitor needs to get some dependencies from npm module. Check package.json to see all dependencies. Check webpack.config.js to find the module alias, and check devtools-core packages to dive into actual modules used by the Network Monitor and other Devtools.

UI

The Network Monitor UI is built using React components (in src/components/).

  • MonitorPanel in MonitorPanel.js is the root element.
  • Three major container components are
    • Toolbar Panel related functions.
    • RequestList Show each request information.
    • NetworkDetailsPanel Show detailed information per request.
    • StatusBar Show statistics while loading.
  • src/assets Styles that affect the Network Monitor panel.

We prefer stateless component (define by function) instead of stateful component (define by class) unless the component has to maintain its internal state.

State

Besides the UI, the Network Monitor manages the app state via Redux. The following locations define the app state:

  • src/constants.js constants used across the tool including action and event names.
  • src/actions/ for all actions that change the state.
  • src/reducers/ for all reducers that change the state.
  • src/selectors/ functions that return a formatted version of parts of the app state.

We use reselect library to perform state calculations efficiently.