gecko-dev/devtools/client/webconsole
Nicolas Chevobbe d31e32951a Bug 1581033 - Fix browser_console_open_or_focus intermittent. r=Honza.
Differential Revision: https://phabricator.services.mozilla.com/D45801

--HG--
extra : moz-landing-system : lando
2019-09-13 08:22:50 +00:00
..
actions Bug 1576318 Part 3 - Avoid rerendering messages when the paused execution point has not changed, r=loganfsmyth,nchevobbe. 2019-08-30 17:07:07 +00:00
components Bug 1579422 - Disconnect FilterBar resize observer when observed node is disconnected. r=jdescottes. 2019-09-09 09:05:08 +00:00
enhancers Bug 1572442 - Refactor how we create Console's network data provider. r=Honza. 2019-08-19 14:53:52 +00:00
middleware Bug 1577074 - Instrument scripts executed from editor mode. r=rcaliman. 2019-09-02 06:22:32 +00:00
reducers Bug 1576318 Part 3 - Avoid rerendering messages when the paused execution point has not changed, r=loganfsmyth,nchevobbe. 2019-08-30 17:07:07 +00:00
selectors Bug 1568779 - Remove editors settings comments in devtools files. r=pbro. 2019-08-19 12:48:16 +00:00
test Bug 1581033 - Fix browser_console_open_or_focus intermittent. r=Honza. 2019-09-13 08:22:50 +00:00
utils Bug 1580064 - Replace ObjectInspector symbol with better delimeter. r=nchevobbe 2019-09-10 22:47:42 +00:00
.babelrc
browser-console-manager.js Bug 1577431 - Cleanup Browser Console when closing its window. r=ochameau. 2019-08-29 15:31:12 +00:00
browser-console.js Bug 1577431 - Cleanup Browser Console when closing its window. r=ochameau. 2019-08-29 15:31:12 +00:00
constants.js Bug 1578665 - Create a dedicated pref for Browser Console editor state. r=Honza. 2019-09-05 09:23:47 +00:00
index.html Bug 1567071 - Remove main.js file. r=jdescottes. 2019-07-18 11:40:38 +00:00
moz.build Bug 1570320 - Rename hudservice into browser-console-manager. r=ochameau. 2019-08-05 11:40:58 +00:00
panel.js Bug 1570242 - Rename target to currentTarget in WebConsole codebase. r=nchevobbe,yulia 2019-08-22 08:10:13 +00:00
README.md
store.js Bug 1558417 - Add onboarding UI for Editor. r=Honza. 2019-08-28 15:42:36 +00:00
types.js Bug 1568779 - Remove editors settings comments in devtools files. r=pbro. 2019-08-19 12:48:16 +00:00
utils.js Bug 1568779 - Remove editors settings comments in devtools files. r=pbro. 2019-08-19 12:48:16 +00:00
webconsole-connection-proxy.js Bug 1576841 - Enable multi-proxy WebConsole in Browser Toolbox when fission pref is true. r=ochameau. 2019-08-27 17:41:29 +00:00
webconsole-ui.js Bug 1578675 - Make the Browser Toolbox console UI similar to Browser Console's one. r=Honza. 2019-09-06 13:38:37 +00:00
webconsole-wrapper.js Bug 1578675 - Make the Browser Toolbox console UI similar to Browser Console's one. r=Honza. 2019-09-06 13:38:37 +00:00
webconsole.js Bug 1576841 - Enable multi-proxy WebConsole in Browser Toolbox when fission pref is true. r=ochameau. 2019-08-27 17:41:29 +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 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