gecko-dev/devtools/client/webconsole
Greg Tatum 39cd1d4845 Bug 1525358 - Rename perf.html to profiler.firefox.com; r=julienw
Differential Revision: https://phabricator.services.mozilla.com/D18728

--HG--
extra : moz-landing-system : lando
2019-02-21 23:16:40 +00:00
..
actions Bug 1523861 - Remove toggle filter button and always show the filter buttons toolbar. r=nchevobbe 2019-02-04 13:22:36 +00:00
components Backed out changeset 9316cb12864b (bug 1424159) for browser_webconsole_longstring failures CLOSED TREE 2019-02-22 05:02:50 +02:00
enhancers Bug 1527834 - Rename WebConsoleWrapper:hud to WebConsoleWrapper:webConsoleUI; r=bgrins. 2019-02-15 08:17:43 +00:00
middleware Bug 1525682 - Add back the telemetry probe monitoring the error messages issued by SpiderMonkey. r=miker 2019-02-14 13:48:12 +00:00
reducers Bug 1526566 - Show console messages in the order in which they executed, r=nchevobbe. 2019-02-08 14:56:53 -10:00
selectors Bug 1462394 - Handle autocompletion data fetching and caching in Redux; r=Honza. 2018-11-12 16:07:37 +00:00
test Bug 1525358 - Rename perf.html to profiler.firefox.com; r=julienw 2019-02-21 23:16:40 +00:00
utils Bug 1527834 - Rename WebConsoleWrapper:hud to WebConsoleWrapper:webConsoleUI; r=bgrins. 2019-02-15 08:17:43 +00:00
.babelrc
README.md Bug 1526247 - Rename webconsole-output-wrapper; r=bgrins. 2019-02-11 06:42:28 +00:00
browser-console.js Bug 1485664 - remove attachConsole from the debugger client; r=ochameau 2019-02-20 10:27:50 +00:00
constants.js Bug 1523861 - Remove toggle filter button and always show the filter buttons toolbar. r=nchevobbe 2019-02-04 13:22:36 +00:00
hudservice.js Bug 1520774 - Remove TargetFactory.forRemoteTab. r=yulia 2019-02-06 16:17:15 +00:00
index.html Bug 1390768 - Use new SmartTrace component in webconsole; r=Honza. 2018-11-12 15:42:40 +00:00
main.js Bug 1500072 - Add browserLoader reference on window when flags.testing is true;r=ochameau 2019-02-13 15:44:05 +00:00
moz.build Bug 1527834 - Rename webconsole-frame.js to webconsole-ui.js; r=bgrins. 2019-02-15 08:16:37 +00:00
panel.js Bug 1527834 - Rename webconsole-frame.js to webconsole-ui.js; r=bgrins. 2019-02-15 08:16:37 +00:00
store.js Bug 1527834 - Rename WebConsoleWrapper:hud to WebConsoleWrapper:webConsoleUI; r=bgrins. 2019-02-15 08:17:43 +00:00
types.js Bug 1525682 - Add `errorMessageName` in ConsoleMessage; r=bgrins. 2019-02-11 17:22:12 +00:00
utils.js Bug 1526883 - Cleanup devtools/client/webconsole/utils.js; r=bgrins. 2019-02-11 17:29:24 +00:00
webconsole-connection-proxy.js Bug 1485664 - adjust webconsole-connection-proxy to listen to webconsole front events, and fix r=ochameau 2019-02-19 15:57:52 +00:00
webconsole-l10n.js Bug 1454696 - Run eslint --fix for prefer-const;r=yulia 2018-06-01 12:36:09 +02:00
webconsole-ui.js Bug 1527834 - Rename webconsole-frame.js to webconsole-ui.js; r=bgrins. 2019-02-15 08:16:37 +00:00
webconsole-wrapper.js Bug 1527834 - Rename WebConsoleWrapper:hud to WebConsoleWrapper:webConsoleUI; r=bgrins. 2019-02-15 08:17:43 +00:00
webconsole.js Bug 1527834 - Rename webconsole-frame.js to webconsole-ui.js; r=bgrins. 2019-02-15 08:16:37 +00:00

README.md

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 on MDN 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