gecko-dev/devtools/client/webconsole
Nicolas Chevobbe cb521cd00a Bug 1558692 - Fix browser_webconsole_warning_group_multiples.js intermittent. r=bgrins.
Making the URLs unique seems to fix the issue.

Differential Revision: https://phabricator.services.mozilla.com/D34877

--HG--
extra : moz-landing-system : lando
2019-06-13 16:04:11 +00:00
..
actions Bug 1523864 - Move filter bar layout change to the App level. r=Honza. 2019-06-07 14:23:35 +00:00
components Bug 1557632 - Don't check if input is compilable unit on Ctrl+Enter. r=Honza. 2019-06-13 12:35:04 +00:00
enhancers Bug 1530133 Part 2 - Allow clearing console messages by their logpoint ID, r=nchevobbe. 2019-02-23 16:19:17 -10:00
middleware Bug 1531395 - Add telemetry to track persist option usage in the Console panel. r=nchevobbe 2019-04-16 16:49:19 +00:00
reducers Bug 1523864 - Move filter bar layout change to the App level. r=Honza. 2019-06-07 14:23:35 +00:00
selectors Bug 1548833 - Replace message table data with generalized message payload. r=nchevobbe 2019-06-06 15:25:20 +00:00
test Bug 1558692 - Fix browser_webconsole_warning_group_multiples.js intermittent. r=bgrins. 2019-06-13 16:04:11 +00:00
utils Bug 1536854 - Log errors from logpoint as actual errors in the console r=davidwalsh,nchevobbe 2019-06-12 12:10:35 +00:00
.babelrc
browser-console.js Bug 1463128 - Refactor WebConsole and BrowserConsole to ES6 classes; r=bgrins. 2019-02-27 10:05:51 +00:00
constants.js Bug 1545888 - Use template-styled message with placeholders as warning group labels. r=Honza. 2019-06-11 13:47:37 +00:00
hudservice.js Bug 1532238 - Run Browser console's server in a dedicated compartment. r=nchevobbe 2019-03-05 14:55:34 +00:00
index.html Bug 1436043- Fix: console missing coloured bars, adds requests.css to webconcole; r=nchevobbe 2019-05-27 06:10:39 +00:00
main.js Bug 1463128 - Rename WebConsoleUI.owner into WebConsoleUI.hud; r=bgrins. 2019-02-27 10:04:53 +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
README.md Bug 1526247 - Rename webconsole-output-wrapper; r=bgrins. 2019-02-11 06:42:28 +00:00
store.js Bug 1552434 - Move timestamp preference change handler. r=rcaliman. 2019-06-03 15:10:14 +00:00
types.js Bug 1093953 - (Part 1) Make CSS warnings expandable to show affected DOM elements. r=Honza 2019-05-03 13:01:27 +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 1541355 - Don't display DevTools internal frames in Netmonitor stacktrace. r=Honza. 2019-05-22 08:57:36 +00:00
webconsole-l10n.js
webconsole-ui.js Bug 1552434 - Move timestamp preference change handler. r=rcaliman. 2019-06-03 15:10:14 +00:00
webconsole-wrapper.js Bug 1525618 - Add an option in the settings panel to toggle warning groups. r=Honza. 2019-06-03 15:10:45 +00:00
webconsole.js Bug 1543008 - Prevent event propagation in OpenLink webconsole function. r=nchevobbe 2019-05-27 06:24:11 +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