gecko-dev/devtools/client/webconsole
Alexandre Poirot 7ff377187d Bug 1835985 - [devtools] Avoid duplicating frame objects because of original vs generated contexts. r=devtools-reviewers,bomsy
Because the React component were always reading frame.location,
the selector had to clone all frame objects in order to sometimes
store the generated location in frame.location.

Instead the React component can read the shouldDisplayOriginalLocation state
and either use frame.location -or- frame.generatedLocation.
Similarly to what we do in most places for breakpoints.

Differential Revision: https://phabricator.services.mozilla.com/D179784
2023-06-12 13:54:44 +00:00
..
actions Bug 1809119 - [devtools] Use selected target in context selector for Browser Console autocomplete. r=ochameau. 2023-01-10 07:52:54 +00:00
components Bug 1826062 - Automatic fixes for upgrading Prettier to 2.8.8. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,calu 2023-05-20 12:26:53 +00:00
enhancers Bug 1792847 - [devtools] Use absolute URLs to import modules in devtools/client/webconsole. r=jdescottes 2022-09-30 15:17:40 +00:00
middleware Bug 1826062 - Automatic fixes for Prettier 2.0.5 upgrade. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,owlish 2023-05-20 12:26:49 +00:00
reducers Bug 1826062 - Automatic fixes for upgrading Prettier to 2.8.8. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,calu 2023-05-20 12:26:53 +00:00
selectors Bug 1826062 - Automatic fixes for upgrading Prettier to 2.8.8. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,calu 2023-05-20 12:26:53 +00:00
test Bug 1835985 - [devtools] Avoid duplicating frame objects because of original vs generated contexts. r=devtools-reviewers,bomsy 2023-06-12 13:54:44 +00:00
utils Bug 1826062 - Automatic fixes for upgrading Prettier to 2.8.8. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,calu 2023-05-20 12:26:53 +00:00
README.md
browser-console-manager.js Bug 1811806 - [devtools] Fix Browser Console issues when closing it during its initialization. r=devtools-reviewers,jdescottes 2023-01-26 08:34:31 +00:00
browser-console.js Bug 1807898 - [devtools] Set Telemetry sessionID by the Telemetry helper. r=devtools-reviewers,nchevobbe 2023-01-04 18:28:33 +00:00
constants.js Bug 1806405 - [devtools] Remove code related to "show content message" toggle. r=perftest-reviewers,nchevobbe,kshampur 2022-12-20 19:30:30 +00:00
index.html Bug 1826063 - Automatic fixes for enabling Prettier on production xhtml and html files. r=mossop,webdriver-reviewers,webcompat-reviewers,geckoview-reviewers,extension-reviewers,settings-reviewers,application-update-reviewers,credential-management-reviewers,fxview-reviewers,sgalich,nalexander,devtools-reviewers,sclements,denschub,robwu,owlish 2023-05-20 12:26:56 +00:00
moz.build Bug 1776145 - [devtools] Remove WebConsoleConnectionProxy. r=ochameau. 2022-07-04 13:27:52 +00:00
panel.js Bug 1793396 - [devtools] Use absolute URLs in all usages of loader.lazyRequireGetter. r=Honza 2022-10-03 18:57:13 +00:00
service-container.js Bug 1792847 - [devtools] Use absolute URLs to import modules in devtools/client/webconsole. r=jdescottes 2022-09-30 15:17:40 +00:00
store.js Bug 1807898 - [devtools] Remove all callsites passing a now-useless telemetry sessionId. r=devtools-reviewers,nchevobbe 2023-01-04 18:28:33 +00:00
types.js Bug 1826062 - Automatic fixes for Prettier 2.0.5 upgrade. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,owlish 2023-05-20 12:26:49 +00:00
utils.js Bug 1789980 - [devtools] Migrate all callsites using require("chrome") to use Components.* global symbols. r=jdescottes,perftest-reviewers,AlexandruIonescu 2022-09-20 12:52:27 +00:00
webconsole-ui.js Bug 1826062 - Automatic fixes for upgrading Prettier to 2.8.8. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,calu 2023-05-20 12:26:53 +00:00
webconsole-wrapper.js Bug 1826062 - Automatic fixes for Prettier 2.0.5 upgrade. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,owlish 2023-05-20 12:26:49 +00:00
webconsole.js Bug 1748112 - [devtools] Do not pass lineNumber = 0 to viewSource r=Honza 2023-01-05 09:25:58 +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 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