Crossfire 0.3a5 Migration

From FirebugWiki

(Difference between revisions)
Jump to: navigation, search
m (onScript)
m (onScript)
Line 27: Line 27:
</source>
</source>
:
:
-
Now the event has the following changes:
+
The event has the following changes:
-
* the body no longer contains an <code>href</code> or <code>context_href</code> entry
+
* the <code>body</code> object no longer contains an <code>href</code> or <code>context_href</code> entry
-
* the body now contains the <code>script</code> meta-data object, identical to what is returned via a [[Crossfire_Protocol_Reference#script]] request with no included source.
+
* the <code>body</code> object now contains the <code>script</code> meta-data object, identical to what is returned via a [[Crossfire_Protocol_Reference#script]] request with no included source.
:
:
New event form:
New event form:
Line 55: Line 55:
</source>
</source>
:
:
-
The values and kinds of the <code>data</code> and <code>script</code> objects are as follows:
+
The values and kinds of the <code>script</code> object are as follows:
:
:
{| border="1" cellpadding="5" cellspacing="0"
{| border="1" cellpadding="5" cellspacing="0"

Revision as of 16:28, 14 March 2011

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