Remoting Architecture

From FirebugWiki

Revision as of 14:06, 15 August 2012 by Honza (Talk | contribs)
Jump to: navigation, search

This page is intended to summarize basic architecture concepts for Firebug (and Firebug extensions) remote capabilities (such as remote debugging or remote HTTP monitoring).

Contents

Resources

Proxy

The proxy object represents a connection between a panel (front end) and a module (back end).

The proxy has essentially two implementations:

  • Local - direct API calls
  • Remote - communication over TCP/IP protocol

Panel-proxy-module.png

  • Panel (a view) should never use Module (a service) directly
  • The communication should always be done through the current proxy
  • Each Panel should have its own proxy that implements API of the remote module (service)
  • There can be also proxy objects used by non-panel objects, e.g. the Profiler
  • It should be possible to create new proxies in extensions.


Here is a more detailed diagram with local and remote proxies.

Local-and-remote-proxies.png

  • Panel object at the top is referencing its proxy object
  • The proxy implementation can be local or remote
  • Local proxy uses direct API calls (in process) and asynchronous callbacks
  • Remote proxy uses TCP/IP connection to communicate with the back-end using JSON packets
  • The remote communication is based on RDP
  • The server side implements Actor, which is responsible for communication with specific proxy
  • The actor is finally consuming back-end Module (service) API

Connection

Connection object is responsible for sending properly setup packets to the server and handling all response packets. This object is also responsible for handling any errors (or error packets) that can occur during the communication.

Proxy-connection.png

  • Remote proxies should always use the connection object to send JSON packets
  • The connection is singleton it'll be probably attached to the global Firebug object

BTI

This section describes the current BTI (Browser Tools Interface) concepts. These concepts should be reviewed and refactored as necessary.

Browser

Proxy to a debuggable web browser. A browser may be remote and contain one or more JavaScript execution contexts. Each JavaScript execution context may contain one or more compilation units. A browser provides notification to registered listeners describing events that occur in the browser.

Bti-browser.png

WebApp

WebApp represents a browsing context. Browsing context is an environment in which Document objects are presented to the user. Instance of this object is associated with top level page window (it's on the same level as the context object).

This object doesn't implement any logic it's there only to demonstrate the concept.

JavaScriptTool

JavaScriptTool implements API related to script debugging. It serves similar purpose as a proxy object. It's currently placed between the Script panel and Firebug.Debugger module.

Bti-javascripttool.png

Compilation Unit

Describes a compilation unit in a browser context. A compilation unit may originate from a JavaScript source file or a script element in HTML. It's currently created when a new script is compiled (JSD).

CompilationUnit has:

  • list of breakpoints
  • url
  • reference to the current context
Personal tools