gecko-dev/devtools/client/debugger/packages/devtools-reps
jaril 696cf3b52a Bug 1588997 - Convert ObjectClient to protocol.js front. r=nchevobbe.
- Converted the ObjectClient into an protocoljs Front
- Converted the SymbolIteratorClient into a protocoljs Front and moved it to devtools/shared/fronts
- Converted the PropertyIteratorClient into a protocoljs Front and moved it to devtools/shared/fronts
- Converted the EnvironmentClient into a protocoljs Front and moved it to devtools/shared/fronts
- Modified calls to `DebuggerClient.release()` so that it tries to call the ObjectFront's release method first, and falls back on `DebuggerClient.release()` if there's no object front
- Changed reps so that it instantiates only one ObjectClient per grip
- Changed tests so that they expect what the Front's request method resolves to where applicable (i.e. ObjectFront.allocationStack resolves to allocationStack, not a packet object with an allocationStack property)
- Changed callbacks provided to ObjectClient methods to be chained to the ObjectFront methods (e.g. ObjectClient.getScope(callback) changed to ObjectFront.getScope().callback())
- Changed tests to use async/await (test_framebindings-x.js, test_functiongrips-x.js, test_objectgrips-x.js)
- Changed tests to expect protocoljs to throw an error string instead of an error object (test_objectgrips-fn-apply-03.js, test_threadlifetime-02.js, test_pauselifetime-03.js)

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

--HG--
rename : devtools/shared/client/environment-client.js => devtools/shared/fronts/environment.js
rename : devtools/shared/client/property-iterator-client.js => devtools/shared/fronts/property-iterator.js
rename : devtools/shared/client/symbol-iterator-client.js => devtools/shared/fronts/symbol-iterator.js
extra : moz-landing-system : lando
2019-10-17 16:06:25 +00:00
..
assets Bug 1500987 - Elevate the new debugger one directory. r=jlast 2019-04-09 13:16:00 -04:00
bin Bug 1551218 - Part 3: Add a top-level .prettierrc and reformat the debugger, r=jlast 2019-05-17 15:51:36 +00:00
src Bug 1588997 - Convert ObjectClient to protocol.js front. r=nchevobbe. 2019-10-17 16:06:25 +00:00
config.js Bug 1551218 - Part 3: Add a top-level .prettierrc and reformat the debugger, r=jlast 2019-05-17 15:51:36 +00:00
jest.config.js Bug 1551218 - Part 3: Add a top-level .prettierrc and reformat the debugger, r=jlast 2019-05-17 15:51:36 +00:00
LICENSE Bug 1500987 - Elevate the new debugger one directory. r=jlast 2019-04-09 13:16:00 -04:00
moz.build Bug 1584973 - Expose object inspector's reducer file. r=jlast. 2019-10-02 08:05:28 +00:00
package.json Bug 1581738 - Fix ErrorRep for Error objects with non-string stack property. r=Honza. 2019-09-17 13:57:18 +00:00
postcss.config.js Bug 1551218 - Part 3: Add a top-level .prettierrc and reformat the debugger, r=jlast 2019-05-17 15:51:36 +00:00
README.md Bug 1500987 - Elevate the new debugger one directory. r=jlast 2019-04-09 13:16:00 -04:00
webpack.config.js Bug 1551218 - Part 3: Add a top-level .prettierrc and reformat the debugger, r=jlast 2019-05-17 15:51:36 +00:00

DevTools Reps

Reps is Firefox DevTools' remote object formatter. It stands for representation.

Example

const React = require("react");
let {
  Rep,
  Grip,
  MODE,
  ObjectInspector,
  ObjectInspectorUtils
} = require("devtools-reps");

function renderRep({ object, mode }) {
  return Rep({ object, defaultRep: Grip, mode });
}

ReactDOM.render(
  Rep({ object, defaultRep: Grip, mode }),
  document.createElement("div")
);

What is what?

Rep

Rep is the top-level component that is capable of formatting any type.

Supported types:

RegExp, StyleSheet, Event, DateTime, TextNode, Attribute, Func, ArrayRep, Document, Window, ObjectWithText, ObjectWithURL, GripArray, GripMap, Grip, Undefined, Null, StringRep, Number, SymbolRep,

Grip

Grip is a client representation of a remote JS object and is used as an input object for this rep component.

Getting started

You need to clone the debugger.html repository, then install dependencies, for which you'll need the Yarn tool:

git clone https://github.com/firefox-devtools/debugger.git
cd debugger.html
yarn install

Once everything is installed, you can start the development server with:

cd packages/devtools-reps/
yarn start

and navigate to http://localhost:8000 to access the dashboard.

Running the demo app

Navigating to the above address will have landed you on an empty launchpad UI:

Image of empty launchpad

Click on the Launch Firefox button. This should launch Firefox with a dedicated profile, listening for connections on port 6080.

The UI should update automatically and show you at least one tab for the new Firefox instance. If it doesn't, reload the dashboard.

Image of launchpad

Click on any of the tabs. This should open the demo app:

Image of demo app

Then you can type any expression in the input field. They will be evaluated against the target tab selected in the previous steps (so if there specific objects on window on this webpage, you can check how they are represented with reps etc, ...).

Running the tests

Reps tests are written with jest.

They are run on every pull request with Circle CI, and you can run them locally by executing yarn test from /packages/devtools-reps.

History

The Reps project was ported to Github January 18th, 2017. You can view the history of a file after that date on github or by running this query:

git log --before "2017-1-17" devtools/client/shared/components/reps

They were first moved to the devtools-reps repository, then to the devtools-core one, before being migrated to this repository.

License

MPL 2