Getting started with Crossfire

From FirebugWiki

Jump to: navigation, search

Some helpful hints for those interested in getting started with Crossfire.

Contents

[edit] Concepts

[edit] Protocol

Crossfire is a protocol and reference implementation for remote Web Page Debugging.

Wire protocol

[edit] Client/Server

Firebug/Crossfire is typically considered the "server" while other tools that connect remotely are "clients" which can issue requests and receive data back from Firebug.

However, the Crossfire extension is also capable of operating as a client, for instance to connect to another instance of Crossfire running as a server in a separate Firefox process.

[edit] SVN

The crossfire source code lives in the Firebug repository on google code http://code.google.com/p/fbug/ in <svn_root>/extensions/crossfire. The current branch is 0.2.

[edit] Reference Client

There is a python script located in the /test/ directory of the Crossfire source. It is a command-line test client which implements the JSON-based protocol used by Crossfire. Some examples of using the test client can be found here (this is an older post and so refers to the python script as a test server, however the roles of client and server in Crossfire have since been reversed).

The test client depends on the readline library for handling command-line input, if you're on a *nix type platform you already have this, but on Windows you might need something like pyreadline

[edit] Building Crossfire

The Crossfire SVN source uses an Ant build script which is named build.xml following the Ant default. You will need to install Java and Ant to run the script. Typing ant xpi in the top-level directory will generate an an XPI file that you can install into Firefox. Note that simply typing ant to run the default build will probably fail unless you set up jsdoc as detailed below.

[edit] Generating Crossfire Documentation

The Ant script will attempt to generate documentation using jsdoc, by default if you just run ant with no target, or if you explicitly specify the doc target with ant doc. This will most likely fail because it cannot find the directory containing a jsdoc implementation. The Crossfire source does not include jsdoc, you will have to download it separately. By default, the ant script looks for a directory named 'jsdoc' in the parent directory of where the build.xml file is located. You can edit the property ${jsdoc.home} in the build.xml file to point to wherever you have put jsdoc.

[edit] Installing Crossfire

Rather than having to get the source and build the extensions yourself, you can always opt for a pre-built version of the extension(s) from http://getfirebug.com/releases/crossfire/.

[edit] Debugging Crossfire

[edit] Using FBTrace

Crossfire adds a DBG_CROSSFIRE flag to the FBTrace console. Almost every method called in the crossfire code will log something to FBTrace, so it's a good way to see what's going on, but expect a lot of output if you turn this on.

[edit] Using Chromebug

Chromebug can be used to debug Crossfire, with a few exceptions/caveats. Crossfire and Chromebug are not aware of each other's existence, but since Chromebug dispatches the same events that Firebug would, e.g. "onToggleBreakpoint", certain operations such as attempting to set a breakpoint in Crossfire's "onToggleBreakpoint" handler have surprising and unfortunate results.

Personal tools