gecko-dev/devtools/client/webconsole
Nicolas Chevobbe f2f6b15222 Bug 1616721 - Block messages triggered by eager evaluation. r=loganfsmyth.
This patch is in 2 folds:
- The first one sets a specific url option in evalWithDebugger when an eager evaluation is requested.
- Then in console-service, we block any message that has this specific sourceName, as it indicates it was triggered by the eager evaluation.

A test is added to ensure this works as expected.

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

--HG--
extra : moz-landing-system : lando
2020-02-26 11:50:45 +00:00
..
actions Bug 1605329: Console input should execute expression in the right context. r=nchevobbe 2020-02-27 22:43:23 +00:00
components Backed out 2 changesets (bug 1616847, bug 1609942) for dt failures on browser_jsterm_autocomplete_control_space.js . CLOSED TREE 2020-02-28 22:05:05 +02:00
enhancers Bug 1613047 - Fix CSS Warnings in a Fission world when navigating. r=ochameau. 2020-02-13 09:47:29 +00:00
middleware Bug 1602974 - Catch errors while setting console history to prevent test failures. r=Honza. 2019-12-13 07:54:08 +00:00
reducers Bug 1615973 - Hide invoke getter popup when evaluating expression. r=Honza. 2020-02-17 14:44:34 +00:00
selectors Bug 1602489 - Basic eager evaluation support, r=nchevobbe. 2019-12-12 21:48:03 +00:00
test Bug 1616721 - Block messages triggered by eager evaluation. r=loganfsmyth. 2020-02-26 11:50:45 +00:00
utils Bug 1601688 - Use emitForTests when events are only used in tests. r=Honza. 2020-01-09 16:07:42 +00:00
.babelrc
README.md
browser-console-manager.js Bug 1618876 - Return a process descriptor in RootFront getProcess/getMainProcess r=ochameau 2020-03-03 09:24:55 +00:00
browser-console.js Bug 1605763 - Emit 'web-console-created' after the BrowserConsole is fully loaded. r=nchevobbe 2020-02-13 13:50:30 +00:00
commands.js Bug 1605329: Console input should execute expression in the right context. r=nchevobbe 2020-02-27 22:43:23 +00:00
constants.js Bug 1605154 - Implement JS execution context selector UI. r=nchevobbe 2020-02-13 15:00:06 +00:00
index.html Bug 1618511 - Added the accordion css to the console index file r=nchevobbe 2020-02-27 14:47:40 +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 Bug 1592363 - Make the console use the TargetList. r=nchevobbe 2019-11-07 15:05:10 +00:00
service-container.js Bug 1601688 - Use emitForTests when events are only used in tests. r=Honza. 2020-01-09 16:07:42 +00:00
store.js Bug 1605329: Console input should execute expression in the right context. r=nchevobbe 2020-02-27 22:43:23 +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 1614792 - Rename DebuggerClient to DevToolsClient. r=jdescottes 2020-02-17 13:39:25 +00:00
webconsole-ui.js Bug 1605329: Console input should execute expression in the right context. r=nchevobbe 2020-02-27 22:43:23 +00:00
webconsole-wrapper.js Bug 1605329: Console input should execute expression in the right context. r=nchevobbe 2020-02-27 22:43:23 +00:00
webconsole.js Bug 1616380 - Refactor frame helpers to use fronts. r=nchevobbe 2020-02-21 13:21:33 +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