Crossfire 0.3a5 Migration

From FirebugWiki

Revision as of 01:59, 15 March 2011 by Mrennie (Talk | contribs)
Jump to: navigation, search

Contents

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.

changebreakpoint

The changebreakpoint request has been updated so that you must pass in the handle argument and can optionally specify the enabled or condition arguments. The response has also been updated to return the breakpoint object of the modified breakpoint - if the request was successful.

The related work item is: Issue 3928

Action Required

The following changes require clients to discontinue using the breakpoint argument and to begin using the handle argument and optionally use the enabled and condition arguments.

Details

In pre-0.3a5 versions the request had the form:

Content-Length:115
\r\n\r\n
{
  "type":"request",
  "command":"changebreakpoint",
  "context_id":"xf0.3::1021597",
  "seq":21,
  "arguments":{"breakpoint":7}
}
\r\n

The following has changed:

  • the arguments object no longer supports the breakpoint entry
  • the arguments object now supports the handle entry and optionally the enabled and condition entres

New request form:

Content-Length:115
\r\n\r\n
{
  "type":"request",
  "command":"changebreakpoint",
  "context_id":"xf0.3::1021597",
  "seq":21,
  "arguments":{
                "handle":7,
                "enabled":true,
                "condition":"y == 6"
              }
}
\r\n

In pre-0.3a5 versions the response you get had the form:

Content-Length:115
\r\n\r\n
{
  "type":"response",
  "command":"changebreakpoint",
  "seq":22,
  "request_seq":21,
  "body":{},
  "running":true,
  "success":true
}

The following has changed:

  • the body object contains the breakpoint object of the breakpoint that was changed

New response form:

Content-Length:115
\r\n\r\n
{
  "type":"response",
  "command":"changebreakpoint",
  "seq":22,
  "request_seq":21,
  "body":{
           "breakpoint": {
                           "handle":7,
                           "type":"line",
                           "enabled":true,
                           "condition":"y == 6",
                           "location":{
                                       "line":2,
                                       "url":"http://www.google.ca//event/seq/1"
                                     }
                         }
         },
  "running":true,
  "success":true
}

clearbreakpoint

The clearbreakpoint request has been updated to accept a new handle argument and to return breakpoint information in the response.

The related work item is: Issue 3928

Action Required

The following changes require clients to discontinue use of the target and line arguments in the arguments object and to begin using the handle argument. Clients can also optionally handle the updated breakpoint information in the response.

Details In pre-0.3a5 versions the request had the form:

Content-Length:194
\r\n\r\n
{
  "type":"request",
  "command":"clearbreakpoint",
  "context_id":"xf0.3::6179868",
  "seq":9,
  "arguments":{
                "target":"http://www.google.ca//event/seq/1", 
                "line":8
              },
}
\r\n

The following has changed:

  • the arguments object no longer supports the target and line entries
Content-Length:109
\r\n\r\n
{
  "type":"request",
  "command":"clearbreakpoint",
  "context_id":"xf0.3::6179868",
  "seq":7,
  "arguments":{
                "handle":1
              },
}
\r\n

In pre-0.3a5 versions the response had the form:

Content-Length:187
\r\n\r\n
{
  "command":"clearbreakpoint",
  "context_id":"xf0.3::6179868",
  "type":"response",
  "seq":13,
  "request_seq":9,
  "body":{
           "context_id":"xf0.3::6179868",
           "breakpoint":18
         },
  "running":true,
  "success":true
}

The following has changed:

  • the body object no longer contains the context_id and breakpoint entries
  • the body object now supports the breakpoints object

New response form:

Content-Length:229
\r\n\r\n
{
  "command":"clearbreakpoint",
  "type":"response",
  "seq":8,
  "request_seq":7,
  "body":{
           "breakpoint":{
                          "handle":1,
                          "type":"line",
                          "enabled":true,
                          "location":{
                                       "line":2,
                                       "url":"http://www.google.ca//event/seq/1"
                                     },
                        }
         },
  "running":true,
  "success":true
}

getbreakpoint

The getbreakpoint request has been updated to use the new handle argument and to include the new breakpoint object in the response

The related work item is: Issue 3928

Action Required

The following changes require clients to discontinue using the breakpoint argument and begin using the handle argument. Clients are also required to handle processing the new breakpoint object in the response.

Details

In pre-0.3a5 version the request had the form:

Content-Length:112
\r\n\r\n
{
  "type":"request",
  "command":"getbreakpoint",
  "context_id":"xf0.3::1021597",
  "seq":16,
  "arguments":{
                "breakpoint":5
              }
}
\r\n

The following has changed:

  • the arguments object no longer supports the breakpoint entry

New request form:

Content-Length:112
\r\n\r\n
{
  "type":"request",
  "command":"getbreakpoint",
  "context_id":"xf0.3::1021597",
  "seq":16,
  "arguments":{
                "handle":5
              }
}
\r\n

In pre-0.3a5 versions the response had the following form:

Content-Length:224
\r\n\r\n
{
  "type":"response",
  "command":"getbreakpoint",
  "seq":17,
  "request_seq":16,
  "body":{
           "handle":5,
           "type":"line",
           "line":2,
           "target":"http://www.google.ca//event/seq/1"
         },
  "running":true,
  "success":true
}

The following has changed:

  • the body object no longer supports the handle, type, line or target entries
  • the body object now supports the breakpoint object

New response form:

Content-Length:224
\r\n\r\n
{
  "type":"response",
  "command":"getbreakpoint",
  "seq":17,
  "request_seq":16,
  "body":{
           "breakpoint": {
                           "handle":5,
                           "type":"line",
                           "enabled":true,
                           "location": {
                                         "line":2,
                                         "url":"http://www.google.ca//event/seq/1"
                                       }
                         }
         },
  "running":true,
  "success":true
}

getbreakpoints

The getbreakpoints request has been updated to make use of the new location object for breakpoints and to remove extraneous entries from responses.

The related work item is: Issue 3928

Action Required

The following changes require clients to discontinue use of the context_id, target and line entries from the body object in responses and to begin using the new breakpoint object.

Details

The request format has not changed.

In pre-0.3a5 versions the response had the form:

Content-Length:312
\r\n\r\n
{
  "type":"response",
  "command":"getbreakpoints",
  "context_id":"xf0.3::6179868",
  "seq":13,
  "request_seq":12,
  "body":{
           "context_id":"xf0.3::6179868",
           "breakpoints":[{
                            "handle":7,
                            "type":"line",
                            "line":2,
                            "target":"http://www.google.ca//event/seq/1"
                         }]
         },
  "running":true,
  "success":true
}

The following has changed:

  • the body object no longer supports the context_id entry
  • the breakpoints object contains breakpoint object entires that support the new handle and location object entries

New response form:

Content-Length:1366
\r\n\r\n
{
  "type":"response",
  "command":"getbreakpoints",
  "seq":46,
  "request_seq":45,
  "body":{
           "breakpoints":[{
                            "handle":7,
                            "type":"line",
                            "location":{
                                         "line":2,
                                         "url":"http://www.google.ca//event/seq/1"
                                       },
                            "enabled":true
                         }]
         },
  "running":true,
  "success":true
}

setbreakpoint

The setbreakpoint request has been updated to accept new arguments; enabled and condition, and too make use of the new breakpoint location object.

The related work item is: Issue 3928

Action Required

The following changes require clients to discontinue using the two removed arguments; target and line, and to begin using the new location object. Clients can also optionally use the enabled and condition arguments.

Details

In pre-0.3a5 versions the request you send had the form:

Content-Length:192
\r\n\r\n
{
  "type":"request"
  "command":"setbreakpoint",
  "context_id":"xf0.3::2531266",
  "seq":5,
  "arguments":{
                "target":"http://www.google.ca//event/seq/1",
                "line":2
              }
}
\r\n

The following has changed:

  • the arguments object no longer supports the target or line entry
  • the arguments object now supports the location object and optionally the enabled and condition entries

New request form:

Content-Length:196
\r\n\r\n
{
  "type":"request",
  "command":"setbreakpoint",
  "context_id":"xf0.3::2531266",
  "seq":42,
  "arguments":{
                "enabled":true,
                "type":"line"
                "condition":null,
                "location":{
                             "line":2,
                             "url":"http://www.google.ca//event/seq/1"
                           }
              }
}
\r\n

In pre-0.3a5 versions the response you get had the form:

Content-Length:298
\r\n\r\n
{
  "type":"response",
  "command":"setbreakpoint",
  "context_id":"xf0.3::2531266",
  "seq":9,
  "request_seq":5,
  "body":{
           "context_id":"xf0.3::2531266",
           "breakpoint":{
                          "handle":22,
                          "type":"line",
                          "line":2,
                          "target":"http://www.google.ca//event/seq/1"
                        }
          },
  "running":true,
  "success":true,
}

The following has changed:

  • the body object no longer contains the context_id entry
  • the breakpoint object no longer contains the target or line entry
  • the breakpoint object now supports the location object and optionally the enabled and condition enties

New response form:

Content-Length:230
\r\n\r\n
{
  "seq":44,
  "type":"response",
  "command":"setbreakpoint",
  "request_seq":42,
  "body":{
           "breakpoint":{
                          "handle":22,
                          "type":"line",
                          "enabled":true,
                          "location":{
                                       "line":2,
                                       "url":"http://www.google.ca//event/seq/1"
                                     }
                        }
         },
  "running":true,
  "success":true
}

updatecontext

The updatecontext request has been added to the protocol in 0.3a5 and allows you to load a new URL into an existing context.

The related work item is: Issue 3841

Action Required

None, unless you want to support or use the new request

Details

Details on the new request can be found on the protocol reference page.

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//event/seq/1"
         }
}

The following has changed:

  • the body object no longer contains an href and context_href enties
  • 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::8127620",
  "data":{
           "script": {
                       "id":"http://www.google.ca//event/seq/1",
                       "lineOffset":0,
                       "columnOffset":0,
                       "sourceStart":"(function()\u000a",
                       "sourceLength":50,
                       "lineCount":4,
                       "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

onToggleBreakpoint

The onToggleBreakpoint event has been updated to reflect the new location object for breakpoints and to return a more complete set of breakpoint information.

The related work item is: Issue 3928

Action Required

The following changes require clients to discontinue using two removed attributes; url and line, and to begin using the new location object.

Details

In the pre-0.3a5 versions the onToggleBreakpoint event had the following form:

Content-Length:153
\r\n\r\n
{
  "type":"event",
  "event":"onToggleBreakpoint",
  "context_id":"xf0.3::7640268",
  "seq":20,
  "data":{
           "url":"http://www.google.ca//event/seq/1",
           "line":2,
           "set":true
         }
}

The following has changed:

  • the body object no longer supports the url and line entries
  • the body object now supports the location object to describe the locale of the breakpoint
  • the body object now supports the handle entry, which is the Crossfire handle for the breakpoint

New event form:

Content-Length:150
\r\n\r\n
{
  "seq":26,
  "type":"event",
  "event":"onToggleBreakpoint",
  "context_id":"xf0.3::7640268",
  "data":{
           "handle":4,
           "set":false,
           "location":{
                        "line":2,
                        "url":"http://www.google.ca//event/seq/1"
                      } 
         }
}

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

handle a Number identifier for the breakpoint - never less than 1
set a Boolean representing if the breakpoint has been set (true) or removed (false)
location an Object representing the locale of the breakpoint

onToggleDomBreakpoint

The onToggleDomBreakpoint event has been added to the protocol in 0.3a5 and is sent when a DOM element breakpoint is enabled or disabled

The related work item is: Issue 3928

Action Required

None, unless you want to support the new event

Details

Details on the new request can be found on the reference page.

Personal tools