Crossfire 0.3a5 Migration

From FirebugWiki

(Difference between revisions)
Jump to: navigation, search
m (onScript)
m
Line 1: Line 1:
-
== 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.  
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.  
Line 10: Line 8:
:
:
The related work item is: [http://code.google.com/p/fbug/issues/detail?id=3476 Issue 3476]
The related work item is: [http://code.google.com/p/fbug/issues/detail?id=3476 Issue 3476]
 +
:
 +
'''Action Required'''
 +
:
 +
The following changes require clients to discontinue using two removed attributes; <code>href</code> and <code>context_href</code> and begin using the new <code>script</code> object.
 +
:
 +
'''Details'''
:
:
In the pre-0.3a5 versions of Crossfire the <code>onScript</code> event had the following form:
In the pre-0.3a5 versions of Crossfire the <code>onScript</code> event had the following form:
Line 27: Line 31:
</source>
</source>
:
:
-
The event has the following changes:
+
The following has changed:
* the <code>body</code> object 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 <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.
+
* 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|script]] request with no included source.
:
:
New event form:
New event form:

Revision as of 16:47, 14 March 2011

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

Action Required

The following changes require clients to discontinue using two removed attributes; href and context_href and begin using the new script object.

Details

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 following has changed:

  • 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 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