Crossfire 0.3a5 Migration

From FirebugWiki

Revision as of 16:28, 14 March 2011 by Mrennie (Talk | contribs)
Jump to: navigation, search

Crossfire 0.3a5 Migration Guide

During 0.3a5 development there was a lot of work done to make the protocol more consistent and coherent, as expected, this work brought with it many changes to the protocol and a few changes that are no longer compatible with existing versions of Crossfire.

This guide will help ease the transition from using a pre-0.3a5 version of Crossfire, with each affected protocol entity described in its own following section.

onScript

The onScript event has been updated to return attributes with consistent names and the meta-data about the script that was loaded.

The related work item is: Issue 3476

In the pre-0.3a5 versions of Crossfire the onScript event had the following form:

Content-Length:192
\r\n\r\n
{
  "type":"event",
  "event":"onScript",
  "context_id":"xf0.3::8127620",
  "body":{
           "context_href":"http://www.google.ca/advanced_search?hl=en/4",
           "href":"http://www.google.ca/advanced_search?hl=en"
         }
}

The event has the following changes:

  • the body object no longer contains an href or context_href entry
  • the body object now contains the script meta-data object, identical to what is returned via a Crossfire_Protocol_Reference#script request with no included source.

New event form:

Content-Length:631
\r\n\r\n
{
  "seq":10,
  "type":"event",
  "event":"onScript",
  "context_id":"xf0.3::2531266",
  "data":{
           "script": {
                       "id":"http://www.google.ca/advanced_search?hl=en",
                       "lineOffset":0,
                       "columnOffset":0,
                       "sourceStart":"(function()\u000a",
                       "sourceLength":311,
                       "lineCount":311,
                       "compilationType":"top-level"
                     }
          }
}

The values and kinds of the script object are as follows:

id a String identifier for the script - never null
lineOffset a Number representing the line offset of the script - never less than 0
columnOffset a Number representing the column offset of the script - never less than 0
sourceStart a String representing the first line of source in the script - never null
sourceLength a Number representing the entire length of the source of the script - never less than 0
lineCount a Number representing the total number of lines of source in the script - never less than 0
compilationType a String describing the kind of the script - see sourceFile.js for complete listing of types
Personal tools