fune/devtools/client/webconsole
Narcis Beleuzu 77e3895965 Backed out 6 changesets (bug 1842701) in order to re-think about the binding shadowing
Backed out changeset 493b4e3a7627 (bug 1842701)
Backed out changeset 12002bd5e6a2 (bug 1842701)
Backed out changeset aca0fc6203a1 (bug 1842701)
Backed out changeset 3e0836ade02c (bug 1842701)
Backed out changeset 57d1b9c07b5f (bug 1842701)
Backed out changeset 65b5aad07c1b (bug 1842701)
2023-08-02 20:46:37 +03:00
..
actions Bug 1267856 - [devtools] Don't clear output on console.clear() when persist logs is on. r=devtools-reviewers,bomsy. 2023-07-20 14:48:27 +00:00
components Bug 1826062 - Automatic fixes for upgrading Prettier to 2.8.8. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,calu 2023-05-20 12:26:53 +00:00
enhancers
middleware Bug 1826062 - Automatic fixes for Prettier 2.0.5 upgrade. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,owlish 2023-05-20 12:26:49 +00:00
reducers Bug 1826062 - Automatic fixes for upgrading Prettier to 2.8.8. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,calu 2023-05-20 12:26:53 +00:00
selectors Bug 1826062 - Automatic fixes for upgrading Prettier to 2.8.8. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,calu 2023-05-20 12:26:53 +00:00
test Backed out 6 changesets (bug 1842701) in order to re-think about the binding shadowing 2023-08-02 20:46:37 +03:00
utils Bug 1267856 - [devtools] Don't clear output on console.clear() when persist logs is on. r=devtools-reviewers,bomsy. 2023-07-20 14:48:27 +00:00
browser-console-manager.js Bug 1811806 - [devtools] Fix Browser Console issues when closing it during its initialization. r=devtools-reviewers,jdescottes 2023-01-26 08:34:31 +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 Bug 1826063 - Automatic fixes for enabling Prettier on production xhtml and html files. r=mossop,webdriver-reviewers,webcompat-reviewers,geckoview-reviewers,extension-reviewers,settings-reviewers,application-update-reviewers,credential-management-reviewers,fxview-reviewers,sgalich,nalexander,devtools-reviewers,sclements,denschub,robwu,owlish 2023-05-20 12:26:56 +00:00
moz.build
panel.js
README.md
service-container.js
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 1826062 - Automatic fixes for Prettier 2.0.5 upgrade. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,owlish 2023-05-20 12:26:49 +00:00
utils.js
webconsole-ui.js Bug 1826062 - Automatic fixes for upgrading Prettier to 2.8.8. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,calu 2023-05-20 12:26:53 +00:00
webconsole-wrapper.js Bug 1267856 - [devtools] Don't clear output on console.clear() when persist logs is on. r=devtools-reviewers,bomsy. 2023-07-20 14:48:27 +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