fune/devtools/client/webconsole
2023-01-19 20:16:41 +00:00
..
actions Bug 1809119 - [devtools] Use selected target in context selector for Browser Console autocomplete. r=ochameau. 2023-01-10 07:52:54 +00:00
components Bug 1809385 - [devtools] Clear autocomplete cache data on evaluation context change. r=ochameau. 2023-01-10 12:37:19 +00:00
enhancers Bug 1792847 - [devtools] Use absolute URLs to import modules in devtools/client/webconsole. r=jdescottes 2022-09-30 15:17:40 +00:00
middleware Bug 1807898 - [devtools] Remove all callsites passing a now-useless telemetry sessionId. r=devtools-reviewers,nchevobbe 2023-01-04 18:28:33 +00:00
reducers Bug 1806405 - [devtools] Remove code related to "show content message" toggle. r=perftest-reviewers,nchevobbe,kshampur 2022-12-20 19:30:30 +00:00
selectors Bug 1793396 - [devtools] Use absolute URLs in all usages of loader.lazyRequireGetter. r=Honza 2022-10-03 18:57:13 +00:00
test Bug 1810995 - update BrowserTestUtils.loadURI consumers to use loadURIString (automated) - toolkit/ - r=Standard8,nchevobbe 2023-01-19 20:16:41 +00:00
utils Bug 1801462 - [devtools] Guard getWarningGroupType on message. r=jdescottes. 2023-01-13 16:29:27 +00:00
browser-console-manager.js Bug 1625939 - [devtools] Remove devtools.browsertoolbox.fission preference and remove old non-fission Browser Toolbox. r=nchevobbe,fluent-reviewers,flod,perftest-reviewers,kshampur 2022-12-20 10:16:48 +00:00
browser-console.js Bug 1807898 - [devtools] Set Telemetry sessionID by the Telemetry helper. r=devtools-reviewers,nchevobbe 2023-01-04 18:28:33 +00:00
constants.js Bug 1806405 - [devtools] Remove code related to "show content message" toggle. r=perftest-reviewers,nchevobbe,kshampur 2022-12-20 19:30:30 +00:00
index.html
moz.build
panel.js Bug 1793396 - [devtools] Use absolute URLs in all usages of loader.lazyRequireGetter. r=Honza 2022-10-03 18:57:13 +00:00
README.md
service-container.js Bug 1792847 - [devtools] Use absolute URLs to import modules in devtools/client/webconsole. r=jdescottes 2022-09-30 15:17:40 +00:00
store.js Bug 1807898 - [devtools] Remove all callsites passing a now-useless telemetry sessionId. r=devtools-reviewers,nchevobbe 2023-01-04 18:28:33 +00:00
types.js Bug 1792847 - [devtools] Use absolute URLs to import modules in devtools/client/webconsole. r=jdescottes 2022-09-30 15:17:40 +00:00
utils.js Bug 1789980 - [devtools] Migrate all callsites using require("chrome") to use Components.* global symbols. r=jdescottes,perftest-reviewers,AlexandruIonescu 2022-09-20 12:52:27 +00:00
webconsole-ui.js Bug 1721592 - [devtools] Remove network legacy listeners. r=devtools-reviewers,jdescottes 2023-01-04 18:27:21 +00:00
webconsole-wrapper.js Bug 1543012 - [devtools] Migrate console node test to jest. r=jdescottes. 2023-01-19 14:55:39 +00:00
webconsole.js Bug 1748112 - [devtools] Do not pass lineNumber = 0 to viewSource r=Honza 2023-01-05 09:25:58 +00:00

WebConsole

The WebConsole (webconsole) shows you all the console API calls made by scripts and alerts you when javascript errors are thrown by a script. It can also display network logs, and you can evaluate expressions using the console input, a.k.a. JsTerm. You can read more about it to learn all the features and how to use the tool.

Run WebConsole

If you want to build the WebConsole inside of the DevTools toolbox (Firefox Devtools Panels), follow the simple Firefox build documentation. Start your compiled firefox and open the Firefox developer tool, you can then see the WebConsole tab.

Code Structure

Top level files are used to launch the WebConsole inside of the DevTools toolbox. The main files used to run the WebConsole are:

  • main.js called by devtools toolbox to launch the WebConsole panel.
  • index.html panel UI and launch scripts.

UI

The WebConsole UI is built using React components (in components/).

The React application is rendered from webconsole-wrapper.js. It contains 4 top components:

  • ConsoleOutput (in ConsoleOutput.js) is the component where messages are rendered.
  • FilterBar (in FilterBar.js) is the component for the filter bars (filter input and toggle buttons).
  • SideBar (in SideBar.js) is the component that render the sidebar where objects can be placed in.
  • JsTerm (in JsTerm.js) is the component that render the console input.

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

State

Besides the UI, the WebConsole 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.

The redux state is a plain javascript object with the following properties:

{
  // State of the filter input and toggle buttons
  filters,
  // State of the input history
  history,
  // Console messages data and state (hidden, expanded, groups, …)
  messages,
  // State of notifications displayed on the output (e.g. self-XSS warning message)
  notifications,
  // Preferences (persist message, message limit, …)
  prefs,
  // Interface state (filter bar visible, sidebar visible, …)
  ui,
}

Tests

See test/README.md