gecko-dev/devtools/client/webconsole
Nicolas Chevobbe b4e71553af Bug 1648017 - Disable console text-selection only evaluation in in-line mode. r=Honza.
This feature is great in editor mode, but can be confusing in in-line mode.
In inline mode, the input is cleared when you evaluate, so if you wrongfully
evaluated only a text selection, you may lose the whole input, and have to
type it again.
This patch disable the feature in inline mode, and modifies the existing test
so we make sure that this work as expected in both editor and inline mode.

Differential Revision: https://phabricator.services.mozilla.com/D81333
2020-06-29 11:49:29 +00:00
..
actions Bug 1640641 - Instantiate only one ResourceWatcher in the console stubs test. r=nchevobbe 2020-05-29 06:29:38 +00:00
components Bug 1648017 - Disable console text-selection only evaluation in in-line mode. r=Honza. 2020-06-29 11:49:29 +00:00
enhancers Bug 1625910 - Use ResourceAPI for CSS Warning messages.r=ochameau. 2020-06-16 18:21:22 +00:00
middleware Bug 1489489 - add reverse search telemetry. r=nchevobbe. 2020-04-14 09:33:28 +00:00
reducers Bug 1635460 - Show 4XX and 5XX Network requests as errors in the console. r=Honza. 2020-06-02 13:31:24 +00:00
selectors Bug 1616897 - Remove WebReplay-related functions/variables/css rules in devtools. r=jlast. 2020-03-27 15:10:53 +00:00
test Bug 1648017 - Disable console text-selection only evaluation in in-line mode. r=Honza. 2020-06-29 11:49:29 +00:00
utils Bug 1645896 - Add a console log origins that have their cookies partitioned by dFPI. r=timhuang 2020-06-25 05:51:29 +00:00
.babelrc
README.md Bug 1628599 - Fixing all links pointing to docs.firefox-dev.tools r=Honza,remote-protocol-reviewers,perftest-reviewers,maja_zf,davehunt 2020-06-01 10:58:38 +00:00
browser-console-manager.js Bug 1625495 - Remove devtools/shared/client folder r=daisuke,ochameau,nchevobbe 2020-03-31 08:36:29 +00:00
browser-console.js Bug 1607569 - Fix leak in browser_console_devtools_loader_exception. r=ochameau. 2020-05-12 07:05:27 +00:00
commands.js Bug 1616301 - Handle targets in toolbox store instead of threads. r=jlast. 2020-04-01 14:33:58 +00:00
constants.js Bug 1631799 - Fix order of command and its result message when server and client don't have the same clock time. r=jdescottes. 2020-04-30 06:31:14 +00:00
index.html Bug 1639962 - Fix the network headers panel in the console r=Honza 2020-05-22 13:18:56 +00:00
moz.build Bug 1613391 - Remove unnecessary moz.build files in console tests. r=jdescottes. 2020-02-06 15:52:08 +00:00
panel.js
service-container.js Bug 1643180 - Part 2: Update the Frame component to always pass generated position to view source. r=jlast 2020-06-05 22:18:38 +00:00
store.js Bug 1628346 - Add a dedicated context selector pref for content toolbox. r=ochameau. 2020-04-10 13:51:51 +00:00
types.js Bug 1629875 - Style blocked network messages in console. r=nchevobbe 2020-06-10 08:31:42 +00:00
utils.js
webconsole-connection-proxy.js Bug 1607569 - Fix leak in browser_console_devtools_loader_exception. r=ochameau. 2020-05-12 07:05:27 +00:00
webconsole-ui.js Bug 1639934 - Enable devtools.contenttoolbox.fission by default but gate it behind fission.autostart r=ochameau 2020-06-17 19:46:51 +00:00
webconsole-wrapper.js Bug 1628994 - Don't render input related elements in browser console when devtools.chrome.enabled is not true. r=jlast. 2020-04-15 11:27:57 +00:00
webconsole.js Bug 1643180 - Part 2: Update the Frame component to always pass generated position to view source. r=jlast 2020-06-05 22:18:38 +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