Bug 1677665 - Update Architecture docs DONTBUILD

Differential Revision: https://phabricator.services.mozilla.com/D97250
This commit is contained in:
Maja Frydrychowicz 2020-11-17 03:35:16 +00:00
parent 60669a2ed8
commit 31e88a9520

View file

@ -6,8 +6,8 @@ This document will cover the Remote Agent architecture by following the sequence
Remote Agent startup Remote Agent startup
-------------------- --------------------
Everything starts with `RemoteAgent` class. Everything starts with the `RemoteAgent` implementation, which handles command line
This singleton handles command lines arguments (--remote-debugging-port) to eventually arguments (--remote-debugging-port) to eventually
start a server listening on the TCP port 9222 (or the one specified by the command line). start a server listening on the TCP port 9222 (or the one specified by the command line).
The browser target websocket URL will be printed to stderr. The browser target websocket URL will be printed to stderr.
To do that this component glue together three main high level components: To do that this component glue together three main high level components:
@ -31,7 +31,7 @@ To do that this component glue together three main high level components:
We have a future intention to fix this and report only what Firefox implements. We have a future intention to fix this and report only what Firefox implements.
You can connect to these websocket URL in order to debug things. You can connect to these websocket URL in order to debug things.
* `targets/Targets` * `targets/TargetList`
This component is responsible of maintaining the list of all debuggable targets. This component is responsible of maintaining the list of all debuggable targets.
For now it can be either: For now it can be either:
* The main browser target * The main browser target
@ -49,7 +49,7 @@ Connecting to Websocket endpoints
--------------------------------- ---------------------------------
Each target's websocket URL will be registered as a HTTP endpoint via `server/HTTPD:registerPathHandler`. Each target's websocket URL will be registered as a HTTP endpoint via `server/HTTPD:registerPathHandler`.
(This registration is done from `RemoteAgent:init`) (This registration is done from `RemoteAgentClass:listen`)
Once a HTTP request happens, `server/HTTPD` will call the `handle` method on the object passed to `registerPathHandler`. Once a HTTP request happens, `server/HTTPD` will call the `handle` method on the object passed to `registerPathHandler`.
For static endpoints registered by `JSONHandler`, this will call `JSONHandler:handle` and return a JSON string as http body. For static endpoints registered by `JSONHandler`, this will call `JSONHandler:handle` and return a JSON string as http body.
For target's endpoint, it is slightly more complicated as it requires a special handshake to morph the HTTP connection into a WebSocket one. For target's endpoint, it is slightly more complicated as it requires a special handshake to morph the HTTP connection into a WebSocket one.
@ -81,7 +81,7 @@ When a request is made to a target URL, `targets/Target:handle` is called and:
Typically, the `sessions/TabSession` forward the CDP command to the content process where the tab is running. Typically, the `sessions/TabSession` forward the CDP command to the content process where the tab is running.
It also redirects back the command response as well as Domain events from that process back to the parent process in order to It also redirects back the command response as well as Domain events from that process back to the parent process in order to
forward them to the connection. forward them to the connection.
Sessions will be using the `Domains` class as an helper to manage a list of Domain implementations in a given context. Sessions will be using the `DomainCache` class as a helper to manage a list of Domain implementations in a given context.
Debugging additional Targets Debugging additional Targets
---------------------------- ----------------------------
@ -139,25 +139,25 @@ Organizational chart of all the classes
└───────────────┘ └───────────────┘ 1 └───────────────┘ └───────────────┘ └───────────────┘ 1 └───────────────┘
│ 1 ┌────────────┐ 1 │ 1 ┌────────────────┐ 1
└───────────────▶│ Targets │◀─┐ └───────────────▶│ TargetList │◀─┐
└────────────┘ │ └────────────────┘ │
│ │
▼ 1..n │ ▼ 1..n
┌────────────┐ │ ┌────────────┐
┌─────────────────│ Target [1]│ │ ┌─────────────────│ Target [1]│
│ └────────────┘ │ │ └────────────┘
│ ▲ 1 │ │ ▲ 1
▼ 1..n │ │ ▼ 1..n │
┌────────────┐ 1..n┌────────────┐ │ ┌────────────┐ 1..n┌────────────┐
│ Connection │◀─────────▶│ Session [2]│──┘ │ Connection │◀─────────▶│ Session [2]│──────
└────────────┘ 1 └────────────┘ └────────────┘ 1 └────────────┘
│ 1 ▲ │ 1 ▲
│ │ │ │
▼ 1 ▼ 1 ▼ 1 ▼ 1
┌────────────────────┐ ┌──────────── 1..n┌────────────┐ ┌────────────────────┐ ┌──────────────┐ 1..n┌────────────┐
│ WebSocketTransport │ │ Domains │──────────▶│ Domain [3]│ │ WebSocketTransport │ │ DomainCache | │──────────▶│ Domain [3]│
└────────────────────┘ └──────────── └────────────┘ └────────────────────┘ └──────────────┘ └────────────┘
``` ```
[1] Target is inherited by TabTarget and MainProcessTarget. [1] Target is inherited by TabTarget and MainProcessTarget.
[2] Session is inherited by TabSession and MainProcessSession. [2] Session is inherited by TabSession and MainProcessSession.