Bug 807282 - Update marionette command/response to match that of the WebDriver spec; r=mdas
authorDavid Burns <dburns@mozilla.com>
Tue, 01 Oct 2013 16:13:04 +0100
changeset 164613 65d2859ad74ad27bb035fd3cd61d630139943739
parent 164612 02d1544a315464a3f91903f7fd64ca9c561517bb
child 164614 772c99944a84eadb0ea8904a96bf56ed47a82a0b
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmdas
bugs807282
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 807282 - Update marionette command/response to match that of the WebDriver spec; r=mdas
testing/marionette/client/marionette/client.py
testing/marionette/client/marionette/marionette.py
testing/marionette/client/setup.py
testing/marionette/marionette-elements.js
testing/marionette/marionette-listener.js
testing/marionette/marionette-server.js
--- a/testing/marionette/client/marionette/client.py
+++ b/testing/marionette/client/marionette/client.py
@@ -47,17 +47,17 @@ class MarionetteClient(object):
         response = self.sock.recv(10)
         sep = response.find(':')
         length = response[0:sep]
         if length != '':
             response = response[sep + 1:]
             response += self._recv_n_bytes(int(length) + 1 + len(length) - 10)
             return json.loads(response)
         else:
-            raise InvalidResponseException("Could not successfully complete " \
+            raise InvalidResponseException("Could not successfully complete "
                                            "transport of message to Gecko, "
                                            "socket closed?",
                                            status=ErrorCodes.INVALID_RESPONSE)
 
     def connect(self, timeout=240.0):
         """ Connect to the server and process the hello message we expect
             to receive in response.
         """
@@ -70,17 +70,17 @@ class MarionetteClient(object):
             # another connection attempt.
             self.sock = None
             raise
         hello = self.receive()
         self.traits = hello.get('traits')
         self.applicationType = hello.get('applicationType')
 
         # get the marionette actor id
-        response = self.send({'to':'root', 'type': 'getMarionetteID'})
+        response = self.send({'to': 'root', 'name': 'getMarionetteID'})
         self.actor = response['id']
 
     def send(self, msg):
         """ Send a message on the socket, prepending it with len(msg) + ':'.
         """
         if not self.sock:
             self.connect()
         if 'to' not in msg:
--- a/testing/marionette/client/marionette/marionette.py
+++ b/testing/marionette/client/marionette/marionette.py
@@ -61,109 +61,109 @@ class HTMLElement(object):
         return self.marionette.find_elements(method, target, self.id)
 
     def get_attribute(self, attribute):
         '''
         Returns the requested attribute (or None, if no attribute is set).
 
         :param attribute: The name of the attribute.
         '''
-        return self.marionette._send_message('getElementAttribute', 'value', element=self.id, name=attribute)
+        return self.marionette._send_message('getElementAttribute', 'value', id=self.id, name=attribute)
 
     def click(self):
-        return self.marionette._send_message('clickElement', 'ok', element=self.id)
+        return self.marionette._send_message('clickElement', 'ok', id=self.id)
 
     def tap(self, x=None, y=None):
         '''
         Simulates a set of tap events on the element.
 
         :param x: X-coordinate of tap event. If not given, default to the
          center of the element.
         :param x: X-coordinate of tap event. If not given, default to the
          center of the element.
         '''
-        return self.marionette._send_message('singleTap', 'ok', element=self.id, x=x, y=y)
+        return self.marionette._send_message('singleTap', 'ok', id=self.id, x=x, y=y)
 
     @property
     def text(self):
         '''
         Returns the visible text of the element, and its child elements.
         '''
-        return self.marionette._send_message('getElementText', 'value', element=self.id)
+        return self.marionette._send_message('getElementText', 'value', id=self.id)
 
     def send_keys(self, *string):
         '''
         Sends the string via synthesized keypresses to the element.
         '''
         typing = []
         for val in string:
             if isinstance(val, Keys):
                 typing.append(val)
             elif isinstance(val, int):
                 val = str(val)
                 for i in range(len(val)):
                     typing.append(val[i])
             else:
                 for i in range(len(val)):
                     typing.append(val[i])
-        return self.marionette._send_message('sendKeysToElement', 'ok', element=self.id, value=typing)
+        return self.marionette._send_message('sendKeysToElement', 'ok', id=self.id, value=typing)
 
     def clear(self):
         '''
         Clears the input of the element.
         '''
-        return self.marionette._send_message('clearElement', 'ok', element=self.id)
+        return self.marionette._send_message('clearElement', 'ok', id=self.id)
 
     def is_selected(self):
         '''
         Returns True if the element is selected.
         '''
-        return self.marionette._send_message('isElementSelected', 'value', element=self.id)
+        return self.marionette._send_message('isElementSelected', 'value', id=self.id)
 
     def is_enabled(self):
         '''
         Returns True if the element is enabled.
         '''
-        return self.marionette._send_message('isElementEnabled', 'value', element=self.id)
+        return self.marionette._send_message('isElementEnabled', 'value', id=self.id)
 
     def is_displayed(self):
         '''
         Returns True if the element is displayed.
         '''
-        return self.marionette._send_message('isElementDisplayed', 'value', element=self.id)
+        return self.marionette._send_message('isElementDisplayed', 'value', id=self.id)
 
     @property
     def size(self):
         '''
         A dictionary with the size of the element.
         '''
-        return self.marionette._send_message('getElementSize', 'value', element=self.id)
+        return self.marionette._send_message('getElementSize', 'value', id=self.id)
 
     @property
     def tag_name(self):
         '''
         The tag name of the element.
         '''
-        return self.marionette._send_message('getElementTagName', 'value', element=self.id)
+        return self.marionette._send_message('getElementTagName', 'value', id=self.id)
 
     @property
     def location(self):
         '''
         A dictionary with the x and y location of an element
         '''
-        return self.marionette._send_message('getElementPosition', 'value', element=self.id)
+        return self.marionette._send_message('getElementPosition', 'value', id=self.id)
 
     def value_of_css_property(self, property_name):
         '''
         Gets the value of the specified CSS property name.
 
         :param property_name: Property name to get the value of.
         '''
         return self.marionette._send_message('getElementValueOfCssProperty', 'value',
-                                             element=self.id,
+                                             id=self.id,
                                              propertyName=property_name)
 
 class Actions(object):
     '''
     An Action object represents a set of actions that are executed in a particular order.
 
     All action methods (press, etc.) return the Actions object itself, to make
     it easy to create a chain of events.
@@ -542,21 +542,21 @@ class Marionette(object):
                 pass
             time.sleep(1)
         return False
 
     def _send_message(self, command, response_key, **kwargs):
         if not self.session and command not in ('newSession', 'getStatus'):
             raise MarionetteException(message="Please start a session")
 
-        message = { 'type': command }
+        message = { 'name': command }
         if self.session:
-            message['session'] = self.session
+            message['sessionId'] = self.session
         if kwargs:
-            message.update(kwargs)
+            message['parameters'] = kwargs
 
         try:
             response = self.client.send(message)
         except socket.timeout:
             self.session = None
             self.window = None
             self.client.close()
             raise TimeoutException(message='socket.timeout', status=ErrorCodes.TIMEOUT, stacktrace=None)
@@ -573,17 +573,17 @@ class Marionette(object):
 
     def _handle_emulator_cmd(self, response):
         cmd = response.get("emulator_cmd")
         if not cmd or not self.emulator:
             raise MarionetteException(message="No emulator in this test to run "
                                       "command against.")
         cmd = cmd.encode("ascii")
         result = self.emulator._run_telnet(cmd)
-        return self.client.send({"type": "emulatorCmdResult",
+        return self.client.send({"name": "emulatorCmdResult",
                                  "id": response.get("id"),
                                  "result": result})
 
     def _handle_error(self, response):
         if 'error' in response and isinstance(response['error'], dict):
             status = response['error'].get('status', 500)
             message = response['error'].get('message')
             stacktrace = response['error'].get('stacktrace')
@@ -711,33 +711,33 @@ class Marionette(object):
         Sets the maximum number of ms that an asynchronous script is allowed to run.
 
         If a script does not return in the specified amount of time, a
         ScriptTimeoutException is raised.
 
         :param timeout: The maximum number of milliseconds an asynchronous
          script can run without causing an ScriptTimeoutException to be raised
         '''
-        response = self._send_message('setScriptTimeout', 'ok', value=timeout)
+        response = self._send_message('setScriptTimeout', 'ok', ms=timeout)
         return response
 
     def set_search_timeout(self, timeout):
         '''
         Sets a timeout for the find methods.
 
         When searching for an element using either
         :class:`Marionette.find_element` or :class:`Marionette.find_elements`,
         the method will continue trying to locate the element for up to timeout
         ms. This can be useful if, for example, the element you're looking for
         might not exist immediately, because it belongs to a page which is
         currently being loaded.
 
         :param timeout: Timeout in milliseconds.
         '''
-        response = self._send_message('setSearchTimeout', 'ok', value=timeout)
+        response = self._send_message('setSearchTimeout', 'ok', ms=timeout)
         return response
 
     @property
     def current_window_handle(self):
         '''
         A reference to the current window.
         '''
         self.window = self._send_message('getWindow', 'value')
@@ -798,17 +798,17 @@ class Marionette(object):
         return self._send_message('setContext', 'ok', value=context)
 
     def switch_to_window(self, window_id):
         '''
         Switch to the specified window; subsequent commands will be directed at the new window.
 
         :param window_id: The id or name of the window to switch to.
         '''
-        response = self._send_message('switchToWindow', 'ok', value=window_id)
+        response = self._send_message('switchToWindow', 'ok', name=window_id)
         self.window = window_id
         return response
 
     def get_active_frame(self):
         '''
         Returns an HTMLElement representing the frame Marionette is currently acting on.
         '''
         response = self._send_message('getActiveFrame', 'value')
@@ -827,17 +827,17 @@ class Marionette(object):
         Switch the current context to the specified frame. Subsequent commands will operate in the context of the specified frame, if applicable.
 
         :param frame: A reference to the frame to switch to: this can be an HTMLElement, an index, name or an id attribute. If you call switch_to_frame() without an argument, it will switch to the top-level frame.
         :param focus: A boolean value which determins whether to focus the frame that we just switched to.
         '''
         if isinstance(frame, HTMLElement):
             response = self._send_message('switchToFrame', 'ok', element=frame.id, focus=focus)
         else:
-            response = self._send_message('switchToFrame', 'ok', value=frame, focus=focus)
+            response = self._send_message('switchToFrame', 'ok', id=frame, focus=focus)
         return response
 
     def get_url(self):
         '''
         Returns the url of the active page in the browser.
         '''
         response = self._send_message('getUrl', 'value')
         return response
@@ -853,22 +853,22 @@ class Marionette(object):
         return response
 
     def navigate(self, url):
         '''
         Causes the browser to navigate to the specified url.
 
         :param url: The url to navigate to.
         '''
-        response = self._send_message('goUrl', 'ok', value=url)
+        response = self._send_message('goUrl', 'ok', url=url)
         return response
 
     def timeouts(self, timeout_type, ms):
         assert(timeout_type == self.TIMEOUT_SEARCH or timeout_type == self.TIMEOUT_SCRIPT or timeout_type == self.TIMEOUT_PAGE)
-        response = self._send_message('timeouts', 'ok', timeoutType=timeout_type, ms=ms)
+        response = self._send_message('timeouts', 'ok', type=timeout_type, ms=ms)
         return response
 
     def go_back(self):
         '''
         Causes the browser to perform a back navigation.
         '''
         response = self._send_message('goBack', 'ok')
         return response
@@ -925,17 +925,17 @@ class Marionette(object):
                           new_sandbox=True, special_powers=False,
                           script_timeout=None, inactivity_timeout=None,
                           filename=None):
         if script_args is None:
             script_args = []
         args = self.wrapArguments(script_args)
         response = self._send_message('executeJSScript',
                                       'value',
-                                      value=script,
+                                      script=script,
                                       args=args,
                                       async=async,
                                       newSandbox=new_sandbox,
                                       specialPowers=special_powers,
                                       scriptTimeout=script_timeout,
                                       inactivityTimeout=inactivity_timeout,
                                       filename=filename,
                                       line=None)
@@ -1006,17 +1006,17 @@ class Marionette(object):
         '''
         if script_args is None:
             script_args = []
         args = self.wrapArguments(script_args)
         stack = traceback.extract_stack()
         frame = stack[-2:-1][0] # grab the second-to-last frame
         response = self._send_message('executeScript',
                                       'value',
-                                      value=script,
+                                      script=script,
                                       args=args,
                                       newSandbox=new_sandbox,
                                       specialPowers=special_powers,
                                       scriptTimeout=script_timeout,
                                       line=int(frame[1]),
                                       filename=os.path.basename(frame[0]))
         return self.unwrapValue(response)
 
@@ -1054,17 +1054,17 @@ class Marionette(object):
         '''
         if script_args is None:
             script_args = []
         args = self.wrapArguments(script_args)
         stack = traceback.extract_stack()
         frame = stack[-2:-1][0] # grab the second-to-last frame
         response = self._send_message('executeAsyncScript',
                                       'value',
-                                      value=script,
+                                      script=script,
                                       args=args,
                                       newSandbox=new_sandbox,
                                       specialPowers=special_powers,
                                       scriptTimeout=script_timeout,
                                       line=int(frame[1]),
                                       filename=os.path.basename(frame[0]))
         return self.unwrapValue(response)
 
@@ -1261,9 +1261,9 @@ class Marionette(object):
         :param highlights: A list of HTMLElement objects to draw a red box around in the
          returned screenshot.
         '''
         if element is not None:
             element = element.id
         lights = None
         if highlights is not None:
             lights = [highlight.id for highlight in highlights if highlights]
-        return self._send_message("screenShot", 'value', element=element, highlights=lights)
+        return self._send_message("screenShot", 'value', id=element, highlights=lights)
--- a/testing/marionette/client/setup.py
+++ b/testing/marionette/client/setup.py
@@ -1,12 +1,12 @@
 import os
 from setuptools import setup, find_packages
 
-version = '0.5.37'
+version = '0.6.0'
 
 # get documentation from the README
 try:
     here = os.path.dirname(os.path.abspath(__file__))
     description = file(os.path.join(here, 'README.md')).read()
 except (OSError, IOError):
     description = ''
 
--- a/testing/marionette/marionette-elements.js
+++ b/testing/marionette/marionette-elements.js
@@ -100,17 +100,17 @@ ElementManager.prototype = {
    *        The window that contains the element
    *
    * @returns nsIDOMElement
    *        Returns the element or throws Exception if not found
    */
   getKnownElement: function EM_getKnownElement(id, win) {
     let el = this.seenItems[id];
     if (!el) {
-      throw new ElementException("Element has not been seen before", 17, null);
+      throw new ElementException("Element has not been seen before. Id given was " + id, 17, null);
     }
     try {
       el = el.get();
     }
     catch(e) {
       el = null;
       delete this.seenItems[id];
     }
--- a/testing/marionette/marionette-listener.js
+++ b/testing/marionette/marionette-listener.js
@@ -417,17 +417,17 @@ function executeScript(msg, directInject
     setTimer();
     heartbeatCallback = function resetInactivityTimeout() {
       curFrame.clearTimeout(inactivityTimeoutId);
       setTimer();
     };
   }
 
   asyncTestCommandId = msg.json.command_id;
-  let script = msg.json.value;
+  let script = msg.json.script;
 
   if (msg.json.newSandbox || !sandbox) {
     sandbox = createExecuteContentSandbox(curFrame,
                                           msg.json.timeout);
     if (!sandbox) {
       sendError("Could not create sandbox!", 500, null, asyncTestCommandId);
       return;
     }
@@ -540,17 +540,17 @@ function executeWithCallback(msg, useFin
 
     setTimer();
     heartbeatCallback = function resetInactivityTimeout() {
       curFrame.clearTimeout(inactivityTimeoutId);
       setTimer();
     };
   }
 
-  let script = msg.json.value;
+  let script = msg.json.script;
   asyncTestCommandId = msg.json.command_id;
 
   onunload = function() {
     sendError("unload was called", 17, null, asyncTestCommandId);
   };
   curFrame.addEventListener("unload", onunload, false);
 
   if (msg.json.newSandbox || !sandbox) {
@@ -842,17 +842,17 @@ function generateEvents(type, x, y, touc
 }
 
 /**
  * Function that perform a single tap
  */
 function singleTap(msg) {
   let command_id = msg.json.command_id;
   try {
-    let el = elementManager.getKnownElement(msg.json.value, curFrame);
+    let el = elementManager.getKnownElement(msg.json.id, curFrame);
     // after this block, the element will be scrolled into view
     if (!checkVisible(el)) {
        sendError("Element is not currently visible and may not be manipulated", 11, null, command_id);
        return;
     }
     if (!curFrame.document.createTouch) {
       mouseEventsOnly = true;
     }
@@ -1202,17 +1202,17 @@ function goUrl(msg) {
   function timerFunc(){
     removeEventListener("DOMContentLoaded", onDOMContentLoaded, false);
     sendError("Error loading page, timed out (onDOMContentLoaded)", 21, null, command_id);
   }
   if (msg.json.pageTimeout != null){
     checkTimer.initWithCallback(timerFunc, msg.json.pageTimeout, Ci.nsITimer.TYPE_ONE_SHOT);
   }
   addEventListener("DOMContentLoaded", onDOMContentLoaded, false);
-  curFrame.location = msg.json.value;
+  curFrame.location = msg.json.url;
 }
 
 /**
  * Get the current URI
  */
 function getUrl(msg) {
   sendResponse({value: curFrame.location.href}, msg.json.command_id);
 }
@@ -1306,17 +1306,17 @@ function getActiveElement(msg) {
 
 /**
  * Send click event to element
  */
 function clickElement(msg) {
   let command_id = msg.json.command_id;
   let el;
   try {
-    el = elementManager.getKnownElement(msg.json.element, curFrame);
+    el = elementManager.getKnownElement(msg.json.id, curFrame);
     if (checkVisible(el)) {
       if (utils.isElementEnabled(el)) {
         utils.synthesizeMouseAtCenter(el, {}, el.ownerDocument.defaultView)
       }
       else {
         sendError("Element is not Enabled", 12, null, command_id)
       }
     }
@@ -1331,60 +1331,60 @@ function clickElement(msg) {
 }
 
 /**
  * Get a given attribute of an element
  */
 function getElementAttribute(msg) {
   let command_id = msg.json.command_id;
   try {
-    let el = elementManager.getKnownElement(msg.json.element, curFrame);
+    let el = elementManager.getKnownElement(msg.json.id, curFrame);
     sendResponse({value: utils.getElementAttribute(el, msg.json.name)},
                  command_id);
   }
   catch (e) {
     sendError(e.message, e.code, e.stack, command_id);
   }
 }
 
 /**
  * Get the text of this element. This includes text from child elements.
  */
 function getElementText(msg) {
   let command_id = msg.json.command_id;
   try {
-    let el = elementManager.getKnownElement(msg.json.element, curFrame);
+    let el = elementManager.getKnownElement(msg.json.id, curFrame);
     sendResponse({value: utils.getElementText(el)}, command_id);
   }
   catch (e) {
     sendError(e.message, e.code, e.stack, command_id);
   }
 }
 
 /**
  * Get the tag name of an element.
  */
 function getElementTagName(msg) {
   let command_id = msg.json.command_id;
   try {
-    let el = elementManager.getKnownElement(msg.json.element, curFrame);
+    let el = elementManager.getKnownElement(msg.json.id, curFrame);
     sendResponse({value: el.tagName.toLowerCase()}, command_id);
   }
   catch (e) {
     sendError(e.message, e.code, e.stack, command_id);
   }
 }
 
 /**
  * Check if element is displayed
  */
 function isElementDisplayed(msg) {
   let command_id = msg.json.command_id;
   try {
-    let el = elementManager.getKnownElement(msg.json.element, curFrame);
+    let el = elementManager.getKnownElement(msg.json.id, curFrame);
     sendResponse({value: utils.isElementDisplayed(el)}, command_id);
   }
   catch (e) {
     sendError(e.message, e.code, e.stack, command_id);
   }
 }
 
 /**
@@ -1394,76 +1394,76 @@ function isElementDisplayed(msg) {
  *               'element' member holds the reference id to
  *               the element that will be checked
  *               'propertyName' is the CSS rule that is being requested
  */
 function getElementValueOfCssProperty(msg){
   let command_id = msg.json.command_id;
   let propertyName = msg.json.propertyName;
   try {
-    let el = elementManager.getKnownElement(msg.json.element, curFrame);
+    let el = elementManager.getKnownElement(msg.json.id, curFrame);
     sendResponse({value: curFrame.document.defaultView.getComputedStyle(el, null).getPropertyValue(propertyName)},
                  command_id);
   }
   catch (e) {
     sendError(e.message, e.code, e.stack, command_id);
   }
 }
 
 /**
  * Get the size of the element and return it
  */
 function getElementSize(msg){
   let command_id = msg.json.command_id;
   try {
-    let el = elementManager.getKnownElement(msg.json.element, curFrame);
-    let clientRect = el.getBoundingClientRect();  
+    let el = elementManager.getKnownElement(msg.json.id, curFrame);
+    let clientRect = el.getBoundingClientRect();
     sendResponse({value: {width: clientRect.width, height: clientRect.height}},
                  command_id);
   }
   catch (e) {
     sendError(e.message, e.code, e.stack, command_id);
   }
 }
 
 /**
  * Check if element is enabled
  */
 function isElementEnabled(msg) {
   let command_id = msg.json.command_id;
   try {
-    let el = elementManager.getKnownElement(msg.json.element, curFrame);
+    let el = elementManager.getKnownElement(msg.json.id, curFrame);
     sendResponse({value: utils.isElementEnabled(el)}, command_id);
   }
   catch (e) {
     sendError(e.message, e.code, e.stack, command_id);
   }
 }
 
 /**
  * Check if element is selected
  */
 function isElementSelected(msg) {
   let command_id = msg.json.command_id;
   try {
-    let el = elementManager.getKnownElement(msg.json.element, curFrame);
+    let el = elementManager.getKnownElement(msg.json.id, curFrame);
     sendResponse({value: utils.isElementSelected(el)}, command_id);
   }
   catch (e) {
     sendError(e.message, e.code, e.stack, command_id);
   }
 }
 
 /**
  * Send keys to element
  */
 function sendKeysToElement(msg) {
   let command_id = msg.json.command_id;
   try {
-    let el = elementManager.getKnownElement(msg.json.element, curFrame);
+    let el = elementManager.getKnownElement(msg.json.id, curFrame);
     if (checkVisible(el)) {
       utils.type(curFrame.document, el, msg.json.value.join(""), true);
       sendOk(command_id);
     }
     else {
       sendError("Element is not visible", 11, null, command_id)
     }
   }
@@ -1473,17 +1473,17 @@ function sendKeysToElement(msg) {
 }
 
 /**
  * Get the position of an element
  */
 function getElementPosition(msg) {
   let command_id = msg.json.command_id;
   try{
-    let el = elementManager.getKnownElement(msg.json.element, curFrame);
+    let el = elementManager.getKnownElement(msg.json.id, curFrame);
     let rect = el.getBoundingClientRect();
 
     let location = {};
     location.x = rect.left;
     location.y = rect.top;
 
     sendResponse({value: location}, command_id);
   }
@@ -1493,17 +1493,17 @@ function getElementPosition(msg) {
 }
 
 /**
  * Clear the text of an element
  */
 function clearElement(msg) {
   let command_id = msg.json.command_id;
   try {
-    let el = elementManager.getKnownElement(msg.json.element, curFrame);
+    let el = elementManager.getKnownElement(msg.json.id, curFrame);
     utils.clearElement(el);
     sendOk(command_id);
   }
   catch (e) {
     sendError(e.message, e.code, e.stack, command_id);
   }
 }
 
@@ -1534,20 +1534,20 @@ function switchToFrame(msg) {
     //Until Bug 761935 lands, we won't have multiple nested OOP iframes. We will only have one.
     //parWindow will refer to the iframe above the nested OOP frame.
     parWindow = curFrame.QueryInterface(Ci.nsIInterfaceRequestor)
                       .getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
   } catch (e) {
     // We probably have a dead compartment so accessing it is going to make Firefox
     // very upset. Let's now try redirect everything to the top frame even if the 
     // user has given us a frame since search doesnt look up.
-    msg.json.value = null;
+    msg.json.id = null;
     msg.json.element = null;
   }
-  if ((msg.json.value == null) && (msg.json.element == null)) {
+  if ((msg.json.id == null) && (msg.json.element == null)) {
     // returning to root frame
     sendSyncMessage("Marionette:switchedToFrame", { frameValue: null });
 
     curFrame = content;
     if(msg.json.focus == true) {
       curFrame.focus();
     }
     sandbox = null;
@@ -1568,46 +1568,46 @@ function switchToFrame(msg) {
         if (XPCNativeWrapper(frames[i]) == XPCNativeWrapper(wantedFrame)) {
           curFrame = frames[i]; 
           foundFrame = i;
         }
       }
     }
   }
   if (foundFrame == null) {
-    switch(typeof(msg.json.value)) {
+    switch(typeof(msg.json.id)) {
       case "string" :
         let foundById = null;
         for (let i = 0; i < frames.length; i++) {
           //give precedence to name
           let frame = frames[i];
           let name = utils.getElementAttribute(frame, 'name');
           let id = utils.getElementAttribute(frame, 'id');
-          if (name == msg.json.value) {
+          if (name == msg.json.id) {
             foundFrame = i;
             break;
-          } else if ((foundById == null) && (id == msg.json.value)) {
+          } else if ((foundById == null) && (id == msg.json.id)) {
             foundById = i;
           }
         }
         if ((foundFrame == null) && (foundById != null)) {
           foundFrame = foundById;
           curFrame = frames[foundFrame];
         }
         break;
       case "number":
-        if (frames[msg.json.value] != undefined) {
-          foundFrame = msg.json.value;
+        if (frames[msg.json.id] != undefined) {
+          foundFrame = msg.json.id;
           curFrame = frames[foundFrame];
         }
         break;
     }
   }
   if (foundFrame == null) {
-    sendError("Unable to locate frame: " + msg.json.value, 8, null, command_id);
+    sendError("Unable to locate frame: " + msg.json.id, 8, null, command_id);
     return;
   }
 
   sandbox = null;
 
   // send a synchronous message to let the server update the currently active
   // frame element (for getActiveFrame)
   let frameValue = elementManager.wrapValue(curFrame.wrappedJSObject)['ELEMENT'];
@@ -1820,19 +1820,19 @@ function importScript(msg) {
   sendOk(command_id);
 }
 
 /**
  * Saves a screenshot and returns a Base64 string
  */
 function screenShot(msg) {
   let node = null;
-  if (msg.json.element) {
+  if (msg.json.id) {
     try {
-      node = elementManager.getKnownElement(msg.json.element, curFrame)
+      node = elementManager.getKnownElement(msg.json.id, curFrame)
     }
     catch (e) {
       sendResponse(e.message, e.code, e.stack, msg.json.command_id);
       return;
     }
   }
   else {
       node = curFrame;
--- a/testing/marionette/marionette-server.js
+++ b/testing/marionette/marionette-server.js
@@ -146,29 +146,29 @@ MarionetteServerConnection.prototype = {
                                          Ci.nsIObserver,
                                          Ci.nsISupportsWeakReference]),
 
   /**
    * Debugger transport callbacks:
    */
   onPacket: function MSC_onPacket(aPacket) {
     // Dispatch the request
-    if (this.requestTypes && this.requestTypes[aPacket.type]) {
+    if (this.requestTypes && this.requestTypes[aPacket.name]) {
       try {
-        this.requestTypes[aPacket.type].bind(this)(aPacket);
+        this.requestTypes[aPacket.name].bind(this)(aPacket);
       } catch(e) {
         this.conn.send({ error: ("error occurred while processing '" +
-                                 aPacket.type),
+                                 aPacket.name),
                         message: e.message });
       }
     } else {
       this.conn.send({ error: "unrecognizedPacketType",
                        message: ('Marionette does not ' +
                                  'recognize the packet type "' +
-                                 aPacket.type + '"') });
+                                 aPacket.name + '"') });
     }
   },
 
   onClosed: function MSC_onClosed(aStatus) {
     this.server._connectionClosed(this);
     this.sessionTearDown();
   },
 
@@ -573,17 +573,17 @@ MarionetteServerConnection.prototype = {
    * Log message. Accepts user defined log-level.
    *
    * @param object aRequest
    *        'value' member holds log message
    *        'level' member hold log level
    */
   log: function MDA_log(aRequest) {
     this.command_id = this.getCommandId();
-    this.marionetteLog.log(aRequest.value, aRequest.level);
+    this.marionetteLog.log(aRequest.parameters.value, aRequest.parameters.level);
     this.sendOk(this.command_id);
   },
 
   /**
    * Return all logged messages.
    */
   getLogs: function MDA_getLogs() {
     this.command_id = this.getCommandId();
@@ -594,17 +594,17 @@ MarionetteServerConnection.prototype = {
    * Sets the context of the subsequent commands to be either 'chrome' or 'content'
    *
    * @param object aRequest
    *        'value' member holds the name of the context to be switched to
    */
   setContext: function MDA_setContext(aRequest) {
     this.command_id = this.getCommandId();
     this.logRequest("setContext", aRequest);
-    let context = aRequest.value;
+    let context = aRequest.parameters.value;
     if (context != "content" && context != "chrome") {
       this.sendError("invalid context", 500, null, this.command_id);
     }
     else {
       this.context = context;
       this.sendOk(this.command_id);
     }
   },
@@ -705,43 +705,43 @@ MarionetteServerConnection.prototype = {
     }
   },
 
   /**
    * Execute the given script either as a function body (executeScript)
    * or directly (for 'mochitest' like JS Marionette tests)
    *
    * @param object aRequest
-   *        'value' member is the script to run
+   *        'script' member is the script to run
    *        'args' member holds the arguments to the script
    * @param boolean directInject
    *        if true, it will be run directly and not as a 
    *        function body
    */
   execute: function MDA_execute(aRequest, directInject) {
-    let inactivityTimeout = aRequest.inactivityTimeout;
-    let timeout = aRequest.scriptTimeout ? aRequest.scriptTimeout : this.scriptTimeout;
+    let inactivityTimeout = aRequest.parameters.inactivityTimeout;
+    let timeout = aRequest.parameters.scriptTimeout ? aRequest.parameters.scriptTimeout : this.scriptTimeout;
     let command_id = this.command_id = this.getCommandId();
     let script;
     this.logRequest("execute", aRequest);
-    if (aRequest.newSandbox == undefined) {
+    if (aRequest.parameters.newSandbox == undefined) {
       //if client does not send a value in newSandbox, 
       //then they expect the same behaviour as webdriver
-      aRequest.newSandbox = true;
+      aRequest.parameters.newSandbox = true;
     }
     if (this.context == "content") {
       this.sendAsync("executeScript",
                      {
-                       value: aRequest.value,
-                       args: aRequest.args,
-                       newSandbox: aRequest.newSandbox,
+                       script: aRequest.parameters.script,
+                       args: aRequest.parameters.args,
+                       newSandbox: aRequest.parameters.newSandbox,
                        timeout: timeout,
-                       specialPowers: aRequest.specialPowers,
-                       filename: aRequest.filename,
-                       line: aRequest.line
+                       specialPowers: aRequest.parameters.specialPowers,
+                       filename: aRequest.parameters.filename,
+                       line: aRequest.parameters.line
                      },
                      command_id);
       return;
     }
 
     // handle the inactivity timeout
     let that = this;
     if (inactivityTimeout) {
@@ -766,152 +766,152 @@ MarionetteServerConnection.prototype = {
     }
 
     let curWindow = this.getCurrentWindow();
     let marionette = new Marionette(this, curWindow, "chrome",
                                     this.marionetteLog,
                                     timeout, this.heartbeatCallback, this.testName);
     let _chromeSandbox = this.createExecuteSandbox(curWindow,
                                                    marionette,
-                                                   aRequest.args,
-                                                   aRequest.specialPowers,
+                                                   aRequest.parameters.args,
+                                                   aRequest.parameters.specialPowers,
                                                    command_id);
     if (!_chromeSandbox)
       return;
 
     try {
       _chromeSandbox.finish = function chromeSandbox_finish() {
         if (that.inactivityTimer != null) {
           that.inactivityTimer.cancel();
         }
         return marionette.generate_results();
       };
 
       if (directInject) {
-        script = aRequest.value;
+        script = aRequest.parameters.script;
       }
       else {
         script = "let func = function() {" +
-                       aRequest.value + 
+                       aRequest.parameters.script + 
                      "};" +
                      "func.apply(null, __marionetteParams);";
       }
       this.executeScriptInSandbox(_chromeSandbox, script, directInject,
                                   false, command_id, timeout);
     }
     catch (e) {
       let error = createStackMessage(e,
                                      "execute_script",
-                                     aRequest.filename,
-                                     aRequest.line,
+                                     aRequest.parameters.filename,
+                                     aRequest.parameters.line,
                                      script);
       this.sendError(error[0], 17, error[1], command_id);
     }
   },
 
   /**
    * Set the timeout for asynchronous script execution
    *
    * @param object aRequest
-   *        'value' member is time in milliseconds to set timeout
+   *        'ms' member is time in milliseconds to set timeout
    */
   setScriptTimeout: function MDA_setScriptTimeout(aRequest) {
     this.command_id = this.getCommandId();
-    let timeout = parseInt(aRequest.value);
+    let timeout = parseInt(aRequest.parameters.ms);
     if(isNaN(timeout)){
       this.sendError("Not a Number", 500, null, this.command_id);
     }
     else {
       this.scriptTimeout = timeout;
       this.sendOk(this.command_id);
     }
   },
 
   /**
    * execute pure JS script. Used to execute 'mochitest'-style Marionette tests.
    *
    * @param object aRequest
-   *        'value' member holds the script to execute
+   *        'script' member holds the script to execute
    *        'args' member holds the arguments to the script
    *        'timeout' member will be used as the script timeout if it is given
    */
   executeJSScript: function MDA_executeJSScript(aRequest) {
-    let timeout = aRequest.scriptTimeout ? aRequest.scriptTimeout : this.scriptTimeout;
+    let timeout = aRequest.parameters.scriptTimeout ? aRequest.parameters.scriptTimeout : this.scriptTimeout;
     let command_id = this.command_id = this.getCommandId();
 
     //all pure JS scripts will need to call Marionette.finish() to complete the test.
     if (aRequest.newSandbox == undefined) {
       //if client does not send a value in newSandbox, 
       //then they expect the same behaviour as webdriver
       aRequest.newSandbox = true;
     }
     if (this.context == "chrome") {
       if (aRequest.async) {
-        this.executeWithCallback(aRequest, aRequest.async);
+        this.executeWithCallback(aRequest, aRequest.parameters.async);
       }
       else {
         this.execute(aRequest, true);
       }
     }
     else {
       this.sendAsync("executeJSScript",
                      {
-                       value: aRequest.value,
-                       args: aRequest.args,
-                       newSandbox: aRequest.newSandbox,
-                       async: aRequest.async,
+                       script: aRequest.parameters.script,
+                       args: aRequest.parameters.args,
+                       newSandbox: aRequest.parameters.newSandbox,
+                       async: aRequest.parameters.async,
                        timeout: timeout,
-                       inactivityTimeout: aRequest.inactivityTimeout,
-                       specialPowers: aRequest.specialPowers,
-                       filename: aRequest.filename,
-                       line: aRequest.line,
+                       inactivityTimeout: aRequest.parameters.inactivityTimeout,
+                       specialPowers: aRequest.parameters.specialPowers,
+                       filename: aRequest.parameters.filename,
+                       line: aRequest.parameters.line,
                      },
                      command_id);
    }
   },
 
   /**
    * This function is used by executeAsync and executeJSScript to execute a script
    * in a sandbox. 
    * 
    * For executeJSScript, it will return a message only when the finish() method is called.
    * For executeAsync, it will return a response when marionetteScriptFinished/arguments[arguments.length-1] 
    * method is called, or if it times out.
    *
    * @param object aRequest
-   *        'value' member holds the script to execute
+   *        'script' member holds the script to execute
    *        'args' member holds the arguments for the script
    * @param boolean directInject
    *        if true, it will be run directly and not as a 
    *        function body
    */
   executeWithCallback: function MDA_executeWithCallback(aRequest, directInject) {
-    let inactivityTimeout = aRequest.inactivityTimeout;
-    let timeout = aRequest.scriptTimeout ? aRequest.scriptTimeout : this.scriptTimeout;
+    let inactivityTimeout = aRequest.parameters.inactivityTimeout;
+    let timeout = aRequest.parameters.scriptTimeout ? aRequest.parameters.scriptTimeout : this.scriptTimeout;
     let command_id = this.command_id = this.getCommandId();
     let script;
     this.logRequest("executeWithCallback", aRequest);
-    if (aRequest.newSandbox == undefined) {
+    if (aRequest.parameters.newSandbox == undefined) {
       //if client does not send a value in newSandbox, 
       //then they expect the same behaviour as webdriver
-      aRequest.newSandbox = true;
+      aRequest.parameters.newSandbox = true;
     }
 
     if (this.context == "content") {
       this.sendAsync("executeAsyncScript",
                      {
-                       value: aRequest.value,
-                       args: aRequest.args,
+                       script: aRequest.parameters.script,
+                       args: aRequest.parameters.args,
                        id: this.command_id,
-                       newSandbox: aRequest.newSandbox,
+                       newSandbox: aRequest.parameters.newSandbox,
                        timeout: timeout,
                        inactivityTimeout: inactivityTimeout,
-                       specialPowers: aRequest.specialPowers,
-                       filename: aRequest.filename,
-                       line: aRequest.line
+                       specialPowers: aRequest.parameters.specialPowers,
+                       filename: aRequest.parameters.filename,
+                       line: aRequest.parameters.line
                      },
                      command_id);
       return;
     }
 
     // handle the inactivity timeout
     let that = this;
     if (inactivityTimeout) {
@@ -979,18 +979,18 @@ MarionetteServerConnection.prototype = {
     };
 
     function chromeAsyncFinish() {
       chromeAsyncReturnFunc(marionette.generate_results(), 0);
     }
 
     let _chromeSandbox = this.createExecuteSandbox(curWindow,
                                                    marionette,
-                                                   aRequest.args,
-                                                   aRequest.specialPowers,
+                                                   aRequest.parameters.args,
+                                                   aRequest.parameters.specialPowers,
                                                    command_id);
     if (!_chromeSandbox)
       return;
 
     try {
 
       this.timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
       if (this.timer != null) {
@@ -998,61 +998,61 @@ MarionetteServerConnection.prototype = {
           chromeAsyncReturnFunc("timed out", 28);
         }, that.timeout, Ci.nsITimer.TYPE_ONESHOT);
       }
 
       _chromeSandbox.returnFunc = chromeAsyncReturnFunc;
       _chromeSandbox.finish = chromeAsyncFinish;
 
       if (directInject) {
-        script = aRequest.value;
+        script = aRequest.parameters.script;
       }
       else {
         script =  '__marionetteParams.push(returnFunc);'
                 + 'let marionetteScriptFinished = returnFunc;'
-                + 'let __marionetteFunc = function() {' + aRequest.value + '};'
+                + 'let __marionetteFunc = function() {' + aRequest.parameters.script + '};'
                 + '__marionetteFunc.apply(null, __marionetteParams);';
       }
 
       this.executeScriptInSandbox(_chromeSandbox, script, directInject,
                                   true, command_id, timeout);
     } catch (e) {
       let error = createStackMessage(e,
                                      "execute_async_script",
-                                     aRequest.filename,
-                                     aRequest.line,
+                                     aRequest.parameters.filename,
+                                     aRequest.parameters.line,
                                      script);
       chromeAsyncReturnFunc(error[0], 17, error[1]);
     }
   },
 
   /**
    * Navigates to given url
    *
    * @param object aRequest
-   *        'value' member holds the url to navigate to
+   *        'url' member holds the url to navigate to
    */
   goUrl: function MDA_goUrl(aRequest) {
     let command_id = this.command_id = this.getCommandId();
     if (this.context != "chrome") {
       aRequest.command_id = command_id;
-      aRequest.pageTimeout = this.pageTimeout;
-      this.sendAsync("goUrl", aRequest, command_id);
+      aRequest.parameters.pageTimeout = this.pageTimeout;
+      this.sendAsync("goUrl", aRequest.parameters, command_id);
       return;
     }
 
-    this.getCurrentWindow().location.href = aRequest.value;
+    this.getCurrentWindow().location.href = aRequest.parameters.url;
     let checkTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
     let start = new Date().getTime();
     let end = null;
-    function checkLoad() { 
+    function checkLoad() {
       end = new Date().getTime();
       let elapse = end - start;
       if (this.pageTimeout == null || elapse <= this.pageTimeout){
-        if (curWindow.document.readyState == "complete") { 
+        if (curWindow.document.readyState == "complete") {
           sendOk(command_id);
           return;
         }
         else{ 
           checkTimer.initWithCallback(checkLoad, 100, Ci.nsITimer.TYPE_ONE_SHOT);
         }
       }
       else{
@@ -1169,44 +1169,44 @@ MarionetteServerConnection.prototype = {
     this.sendResponse(res, this.command_id);
   },
 
   /**
    * Switch to a window based on name or server-assigned id.
    * Searches based on name, then id.
    *
    * @param object aRequest
-   *        'value' member holds the name or id of the window to switch to
+   *        'name' member holds the name or id of the window to switch to
    */
   switchToWindow: function MDA_switchToWindow(aRequest) {
     let command_id = this.command_id = this.getCommandId();
     let winEn = this.getWinEnumerator(); 
     while(winEn.hasMoreElements()) {
       let foundWin = winEn.getNext();
       let winId = foundWin.QueryInterface(Ci.nsIInterfaceRequestor)
                           .getInterface(Ci.nsIDOMWindowUtils)
                           .outerWindowID;
       winId = winId + ((appName == "B2G") ? '-b2g' : '');
-      if (aRequest.value == foundWin.name || aRequest.value == winId) {
+      if (aRequest.parameters.name == foundWin.name || aRequest.parameters.name == winId) {
         if (this.browsers[winId] == undefined) {
           //enable Marionette in that browser window
           this.startBrowser(foundWin, false);
         }
         else {
           utils.window = foundWin;
           this.curBrowser = this.browsers[winId];
         }
         this.sendOk(command_id);
         return;
       }
     }
-    this.sendError("Unable to locate window " + aRequest.value, 23, null,
+    this.sendError("Unable to locate window " + aRequest.parameters.name, 23, null,
                    command_id);
   },
- 
+
   getActiveFrame: function MDA_getActiveFrame() {
     this.command_id = this.getCommandId();
 
     if (this.context == "chrome") {
       if (this.curFrame) {
         let frameUid = this.curBrowser.elementManager.addToKnownElements(this.curFrame.frameElement);
         this.sendResponse(frameUid, this.command_id);
       } else {
@@ -1219,125 +1219,125 @@ MarionetteServerConnection.prototype = {
     }
   },
 
   /**
    * Switch to a given frame within the current window
    *
    * @param object aRequest
    *        'element' is the element to switch to
-   *        'value' if element is not set, then this
+   *        'id' if element is not set, then this
    *                holds either the id, name or index 
    *                of the frame to switch to
    */
   switchToFrame: function MDA_switchToFrame(aRequest) {
     let command_id = this.command_id = this.getCommandId();
     this.logRequest("switchToFrame", aRequest);
     let checkTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
     let curWindow = this.getCurrentWindow();
-    let checkLoad = function() { 
+    let checkLoad = function() {
       let errorRegex = /about:.+(error)|(blocked)\?/;
-      if (curWindow.document.readyState == "complete") { 
+      if (curWindow.document.readyState == "complete") {
         this.sendOk(command_id);
         return;
-      } 
+      }
       else if (curWindow.document.readyState == "interactive" && errorRegex.exec(curWindow.document.baseURI)) {
         this.sendError("Error loading page", 13, null, command_id);
         return;
       }
-      
+
       checkTimer.initWithCallback(checkLoad.bind(this), 100, Ci.nsITimer.TYPE_ONE_SHOT);
     }
     if (this.context == "chrome") {
       let foundFrame = null;
-      if ((aRequest.value == null) && (aRequest.element == null)) {
+      if ((aRequest.parameters.id == null) && (aRequest.parameters.element == null)) {
         this.curFrame = null;
-        if (aRequest.focus) {
+        if (aRequest.parameters.focus) {
           this.mainFrame.focus();
         }
         checkTimer.initWithCallback(checkLoad.bind(this), 100, Ci.nsITimer.TYPE_ONE_SHOT);
         return;
       }
-      if (aRequest.element != undefined) {
-        if (this.curBrowser.elementManager.seenItems[aRequest.element] != undefined) {
-          let wantedFrame = this.curBrowser.elementManager.getKnownElement(aRequest.element, curWindow); //HTMLIFrameElement
+      if (aRequest.parameters.element != undefined) {
+        if (this.curBrowser.elementManager.seenItems[aRequest.parameters.element] != undefined) {
+          let wantedFrame = this.curBrowser.elementManager.getKnownElement(aRequest.parameters.element, curWindow); //HTMLIFrameElement
           let numFrames = curWindow.frames.length;
           for (let i = 0; i < numFrames; i++) {
             if (curWindow.frames[i].frameElement == wantedFrame) {
               curWindow = curWindow.frames[i]; 
               this.curFrame = curWindow;
-              if (aRequest.focus) {
+              if (aRequest.parameters.focus) {
                 this.curFrame.focus();
               }
               checkTimer.initWithCallback(checkLoad.bind(this), 100, Ci.nsITimer.TYPE_ONE_SHOT);
               return;
           }
         }
       }
     }
-    switch(typeof(aRequest.value)) {
+    switch(typeof(aRequest.parameters.id)) {
       case "string" :
         let foundById = null;
         let numFrames = curWindow.frames.length;
         for (let i = 0; i < numFrames; i++) {
           //give precedence to name
           let frame = curWindow.frames[i];
           let frameElement = frame.frameElement;
-          if (frame.name == aRequest.value) {
+          if (frame.name == aRequest.parameters.id) {
             foundFrame = i;
             break;
-          } else if ((foundById == null) && (frameElement.id == aRequest.value)) {
+          } else if ((foundById == null) && (frameElement.id == aRequest.parameters.id)) {
             foundById = i;
           }
         }
         if ((foundFrame == null) && (foundById != null)) {
           foundFrame = foundById;
         }
         break;
       case "number":
-        if (curWindow.frames[aRequest.value] != undefined) {
-          foundFrame = aRequest.value;
+        if (curWindow.frames[aRequest.parameters.id] != undefined) {
+          foundFrame = aRequest.parameters.id;
         }
         break;
       }
       if (foundFrame != null) {
         curWindow = curWindow.frames[foundFrame];
         this.curFrame = curWindow;
-        if (aRequest.focus) {
+        if (aRequest.parameters.focus) {
           this.curFrame.focus();
         }
         checkTimer.initWithCallback(checkLoad.bind(this), 100, Ci.nsITimer.TYPE_ONE_SHOT);
       } else {
-        this.sendError("Unable to locate frame: " + aRequest.value, 8, null,
+        this.sendError("Unable to locate frame: " + aRequest.parameters.id, 8, null,
                        command_id);
       }
     }
     else {
-      if ((!aRequest.value) && (!aRequest.element) &&
+      if ((!aRequest.parameters.id) && (!aRequest.parameters.element) &&
           (this.curBrowser.frameManager.currentRemoteFrame !== null)) {
         // We're currently using a ChromeMessageSender for a remote frame, so this
         // request indicates we need to switch back to the top-level (parent) frame.
         // We'll first switch to the parent's (global) ChromeMessageBroadcaster, so
         // we send the message to the right listener.
         this.switchToGlobalMessageManager();
       }
       aRequest.command_id = command_id;
-      this.sendAsync("switchToFrame", aRequest, command_id);
+      this.sendAsync("switchToFrame", aRequest.parameters, command_id);
     }
   },
 
   /**
    * Set timeout for searching for elements
    *
    * @param object aRequest
-   *        'value' holds the search timeout in milliseconds
+   *        'ms' holds the search timeout in milliseconds
    */
   setSearchTimeout: function MDA_setSearchTimeout(aRequest) {
     this.command_id = this.getCommandId();
-    let timeout = parseInt(aRequest.value);
+    let timeout = parseInt(aRequest.parameters.ms);
     if (isNaN(timeout)) {
       this.sendError("Not a Number", 500, null, this.command_id);
     }
     else {
       this.searchTimeout = timeout;
       this.sendOk(this.command_id);
     }
   },
@@ -1347,28 +1347,26 @@ MarionetteServerConnection.prototype = {
    *
    * @param object aRequest
    *        'type' hold the type of timeout
    *        'ms' holds the timeout in milliseconds
    */
   timeouts: function MDA_timeouts(aRequest){
     /*setTimeout*/
     this.command_id = this.getCommandId();
-    let timeout_type = aRequest.timeoutType;
-    let timeout = parseInt(aRequest.ms);
+    let timeout_type = aRequest.parameters.type;
+    let timeout = parseInt(aRequest.parameters.ms);
     if (isNaN(timeout)) {
       this.sendError("Not a Number", 500, null, this.command_id);
     }
     else {
       if (timeout_type == "implicit") {
-        aRequest.value = aRequest.ms;
         this.setSearchTimeout(aRequest);
       }
       else if (timeout_type == "script") {
-        aRequest.value = aRequest.ms;
         this.setScriptTimeout(aRequest);
       }
       else {
         this.pageTimeout = timeout;
         this.sendOk(this.command_id);
       }
     }
   },
@@ -1376,26 +1374,26 @@ MarionetteServerConnection.prototype = {
   /**
    * Single Tap
    *
    * @param object aRequest
             'element' represents the ID of the element to single tap on
    */
   singleTap: function MDA_singleTap(aRequest) {
     this.command_id = this.getCommandId();
-    let serId = aRequest.element;
-    let x = aRequest.x;
-    let y = aRequest.y;
+    let serId = aRequest.parameters.id;
+    let x = aRequest.parameters.x;
+    let y = aRequest.parameters.y;
     if (this.context == "chrome") {
       this.sendError("Command 'singleTap' is not available in chrome context", 500, null, this.command_id);
     }
     else {
       this.sendAsync("singleTap",
                      {
-                       value: serId,
+                       id: serId,
                        corx: x,
                        cory: y
                      },
                      this.command_id);
     }
   },
 
   /**
@@ -1407,18 +1405,18 @@ MarionetteServerConnection.prototype = {
   actionChain: function MDA_actionChain(aRequest) {
     this.command_id = this.getCommandId();
     if (this.context == "chrome") {
       this.sendError("Command 'actionChain' is not available in chrome context", 500, null, this.command_id);
     }
     else {
       this.sendAsync("actionChain",
                      {
-                       chain: aRequest.chain,
-                       nextId: aRequest.nextId
+                       chain: aRequest.parameters.chain,
+                       nextId: aRequest.parameters.nextId
                      },
                      this.command_id);
     }
   },
 
   /**
    * multiAction
    *
@@ -1431,18 +1429,18 @@ MarionetteServerConnection.prototype = {
   multiAction: function MDA_multiAction(aRequest) {
     this.command_id = this.getCommandId();
     if (this.context == "chrome") {
        this.sendError("Command 'multiAction' is not available in chrome context", 500, null, this.command_id);
     }
     else {
       this.sendAsync("multiAction",
                      {
-                       value: aRequest.value,
-                       maxlen: aRequest.max_length
+                       value: aRequest.parameters.value,
+                       maxlen: aRequest.parameters.max_length
                      },
                      this.command_id);
    }
  },
 
   /**
    * Find an element using the indicated search strategy.
    *
@@ -1454,34 +1452,34 @@ MarionetteServerConnection.prototype = {
     let command_id = this.command_id = this.getCommandId();
     if (this.context == "chrome") {
       let id;
       try {
         let on_success = this.sendResponse.bind(this);
         let on_error = this.sendError.bind(this);
         id = this.curBrowser.elementManager.find(
                               this.getCurrentWindow(),
-                              aRequest,
+                              aRequest.parameters,
                               this.searchTimeout,
                               on_success,
                               on_error,
                               false,
                               command_id);
       }
       catch (e) {
         this.sendError(e.message, e.code, e.stack, command_id);
         return;
       }
     }
     else {
       this.sendAsync("findElementContent",
                      {
-                       value: aRequest.value,
-                       using: aRequest.using,
-                       element: aRequest.element,
+                       value: aRequest.parameters.value,
+                       using: aRequest.parameters.using,
+                       element: aRequest.parameters.element,
                        searchTimeout: this.searchTimeout
                      },
                      command_id);
     }
   },
 
   /**
    * Find elements using the indicated search strategy.
@@ -1493,34 +1491,34 @@ MarionetteServerConnection.prototype = {
   findElements: function MDA_findElements(aRequest) {
     let command_id = this.command_id = this.getCommandId();
     if (this.context == "chrome") {
       let id;
       try {
         let on_success = this.sendResponse.bind(this);
         let on_error = this.sendError.bind(this);
         id = this.curBrowser.elementManager.find(this.getCurrentWindow(),
-                                                 aRequest,
+                                                 aRequest.parameters,
                                                  this.searchTimeout,
                                                  on_success,
                                                  on_error,
                                                  true,
                                                  command_id);
       }
       catch (e) {
         this.sendError(e.message, e.code, e.stack, command_id);
         return;
       }
     }
     else {
       this.sendAsync("findElementsContent",
                      {
-                       value: aRequest.value,
-                       using: aRequest.using,
-                       element: aRequest.element,
+                       value: aRequest.parameters.value,
+                       using: aRequest.parameters.using,
+                       element: aRequest.parameters.element,
                        searchTimeout: this.searchTimeout
                      },
                      command_id);
     }
   },
 
   /**
    * Return the active element on the page
@@ -1529,361 +1527,361 @@ MarionetteServerConnection.prototype = {
     let command_id = this.command_id = this.getCommandId();
     this.sendAsync("getActiveElement", {}, command_id);
   },
 
   /**
    * Send click event to element
    *
    * @param object aRequest
-   *        'element' member holds the reference id to
+   *        'id' member holds the reference id to
    *        the element that will be clicked
    */
-  clickElement: function MDA_clickElement(aRequest) {
+  clickElement: function MDA_clickElementent(aRequest) {
     let command_id = this.command_id = this.getCommandId();
     if (this.context == "chrome") {
       try {
         //NOTE: click atom fails, fall back to click() action
         let el = this.curBrowser.elementManager.getKnownElement(
-            aRequest.element, this.getCurrentWindow());
+            aRequest.parameters.id, this.getCurrentWindow());
         el.click();
         this.sendOk(command_id);
       }
       catch (e) {
         this.sendError(e.message, e.code, e.stack, command_id);
       }
     }
     else {
-      // We need to protect against the click causing an OOP frame to close. 
-      // This fires the mozbrowserclose event when it closes so we need to 
+      // We need to protect against the click causing an OOP frame to close.
+      // This fires the mozbrowserclose event when it closes so we need to
       // listen for it and then just send an error back. The person making the
       // call should be aware something isnt right and handle accordingly
       let curWindow = this.getCurrentWindow();
       let self = this;
-      this.mozBrowserClose = function() { 
+      this.mozBrowserClose = function() {
         curWindow.removeEventListener('mozbrowserclose', self.mozBrowserClose, true);
         self.switchToGlobalMessageManager();
         self.sendError("The frame closed during the click, recovering to allow further communications", 500, null, command_id);
       };
       curWindow.addEventListener('mozbrowserclose', this.mozBrowserClose, true);
       this.sendAsync("clickElement",
-                     { element: aRequest.element },
+                     { id: aRequest.parameters.id },
                      command_id);
     }
   },
 
   /**
    * Get a given attribute of an element
    *
    * @param object aRequest
-   *        'element' member holds the reference id to
+   *        'id' member holds the reference id to
    *        the element that will be inspected
    *        'name' member holds the name of the attribute to retrieve
    */
   getElementAttribute: function MDA_getElementAttribute(aRequest) {
     let command_id = this.command_id = this.getCommandId();
     if (this.context == "chrome") {
       try {
         let el = this.curBrowser.elementManager.getKnownElement(
-            aRequest.element, this.getCurrentWindow());
-        this.sendResponse(utils.getElementAttribute(el, aRequest.name),
+            aRequest.parameters.id, this.getCurrentWindow());
+        this.sendResponse(utils.getElementAttribute(el, aRequest.parameters.name),
                           command_id);
       }
       catch (e) {
         this.sendError(e.message, e.code, e.stack, command_id);
       }
     }
     else {
       this.sendAsync("getElementAttribute",
                      {
-                       element: aRequest.element,
-                       name: aRequest.name
+                       id: aRequest.parameters.id,
+                       name: aRequest.parameters.name
                      },
                      command_id);
     }
   },
 
   /**
    * Get the text of an element, if any. Includes the text of all child elements.
    *
    * @param object aRequest
-   *        'element' member holds the reference id to
+   *        'id' member holds the reference id to
    *        the element that will be inspected 
    */
   getElementText: function MDA_getElementText(aRequest) {
     let command_id = this.command_id = this.getCommandId();
     if (this.context == "chrome") {
       //Note: for chrome, we look at text nodes, and any node with a "label" field
       try {
         let el = this.curBrowser.elementManager.getKnownElement(
-            aRequest.element, this.getCurrentWindow());
+            aRequest.parameters.id, this.getCurrentWindow());
         let lines = [];
         this.getVisibleText(el, lines);
         lines = lines.join("\n");
         this.sendResponse(lines, command_id);
       }
       catch (e) {
         this.sendError(e.message, e.code, e.stack, command_id);
       }
     }
     else {
       this.sendAsync("getElementText",
-                     { element: aRequest.element },
+                     { id: aRequest.parameters.id },
                      command_id);
     }
   },
 
   /**
    * Get the tag name of the element.
    *
    * @param object aRequest
-   *        'element' member holds the reference id to
+   *        'id' member holds the reference id to
    *        the element that will be inspected 
    */
   getElementTagName: function MDA_getElementTagName(aRequest) {
     let command_id = this.command_id = this.getCommandId();
     if (this.context == "chrome") {
       try {
         let el = this.curBrowser.elementManager.getKnownElement(
-            aRequest.element, this.getCurrentWindow());
+            aRequest.parameters.id, this.getCurrentWindow());
         this.sendResponse(el.tagName.toLowerCase(), command_id);
       }
       catch (e) {
         this.sendError(e.message, e.code, e.stack, command_id);
       }
     }
     else {
       this.sendAsync("getElementTagName",
-                     { element: aRequest.element },
+                     { id: aRequest.parameters.id },
                      command_id);
     }
   },
 
   /**
    * Check if element is displayed
    *
    * @param object aRequest
-   *        'element' member holds the reference id to
+   *        'id' member holds the reference id to
    *        the element that will be checked 
    */
   isElementDisplayed: function MDA_isElementDisplayed(aRequest) {
     let command_id = this.command_id = this.getCommandId();
     if (this.context == "chrome") {
       try {
         let el = this.curBrowser.elementManager.getKnownElement(
-            aRequest.element, this.getCurrentWindow());
+            aRequest.parameters.id, this.getCurrentWindow());
         this.sendResponse(utils.isElementDisplayed(el), command_id);
       }
       catch (e) {
         this.sendError(e.message, e.code, e.stack, command_id);
       }
     }
     else {
       this.sendAsync("isElementDisplayed",
-                     { element:aRequest.element },
+                     { id:aRequest.parameters.id },
                      command_id);
     }
   },
 
   /**
    * Return the property of the computed style of an element
    *
    * @param object aRequest
-   *               'element' member holds the reference id to
+   *               'id' member holds the reference id to
    *               the element that will be checked
    *               'propertyName' is the CSS rule that is being requested
    */
   getElementValueOfCssProperty: function MDA_getElementValueOfCssProperty(aRequest){
     let command_id = this.command_id = this.getCommandId();
     this.sendAsync("getElementValueOfCssProperty",
-                   {element: aRequest.element, propertyName: aRequest.propertyName},
+                   {id: aRequest.parameters.id, propertyName: aRequest.parameters.propertyName},
                    command_id);
   },
 
   /**
    * Check if element is enabled
    *
    * @param object aRequest
-   *        'element' member holds the reference id to
+   *        'id' member holds the reference id to
    *        the element that will be checked
    */
   isElementEnabled: function MDA_isElementEnabled(aRequest) {
     let command_id = this.command_id = this.getCommandId();
     if (this.context == "chrome") {
       try {
         //Selenium atom doesn't quite work here
         let el = this.curBrowser.elementManager.getKnownElement(
-            aRequest.element, this.getCurrentWindow());
+            aRequest.parameters.id, this.getCurrentWindow());
         if (el.disabled != undefined) {
           this.sendResponse(!!!el.disabled, command_id);
         }
         else {
         this.sendResponse(true, command_id);
         }
       }
       catch (e) {
         this.sendError(e.message, e.code, e.stack, command_id);
       }
     }
     else {
       this.sendAsync("isElementEnabled",
-                     { element:aRequest.element },
+                     { id:aRequest.parameters.id },
                      command_id);
     }
   },
 
   /**
    * Check if element is selected
    *
    * @param object aRequest
-   *        'element' member holds the reference id to
+   *        'id' member holds the reference id to
    *        the element that will be checked
    */
   isElementSelected: function MDA_isElementSelected(aRequest) {
     let command_id = this.command_id = this.getCommandId();
     if (this.context == "chrome") {
       try {
         //Selenium atom doesn't quite work here
         let el = this.curBrowser.elementManager.getKnownElement(
-            aRequest.element, this.getCurrentWindow());
+            aRequest.parameters.id, this.getCurrentWindow());
         if (el.checked != undefined) {
           this.sendResponse(!!el.checked, command_id);
         }
         else if (el.selected != undefined) {
           this.sendResponse(!!el.selected, command_id);
         }
         else {
           this.sendResponse(true, command_id);
         }
       }
       catch (e) {
         this.sendError(e.message, e.code, e.stack, command_id);
       }
     }
     else {
       this.sendAsync("isElementSelected",
-                     { element:aRequest.element },
+                     { id:aRequest.parameters.id },
                      command_id);
     }
   },
 
   getElementSize: function MDA_getElementSize(aRequest) {
     let command_id = this.command_id = this.getCommandId();
     if (this.context == "chrome") {
       try {
         let el = this.curBrowser.elementManager.getKnownElement(
-            aRequest.element, this.getCurrentWindow());
-        let clientRect = el.getBoundingClientRect();  
+            aRequest.parameters.id, this.getCurrentWindow());
+        let clientRect = el.getBoundingClientRect();
         this.sendResponse({width: clientRect.width, height: clientRect.height},
                           command_id);
       }
       catch (e) {
         this.sendError(e.message, e.code, e.stack, command_id);
       }
     }
     else {
       this.sendAsync("getElementSize",
-                     { element:aRequest.element },
+                     { id:aRequest.parameters.id },
                      command_id);
     }
   },
 
   /**
    * Send key presses to element after focusing on it
    *
    * @param object aRequest
-   *        'element' member holds the reference id to
+   *        'id' member holds the reference id to
    *        the element that will be checked
    *        'value' member holds the value to send to the element
    */
   sendKeysToElement: function MDA_sendKeysToElement(aRequest) {
     let command_id = this.command_id = this.getCommandId();
     if (this.context == "chrome") {
       try {
         let el = this.curBrowser.elementManager.getKnownElement(
-            aRequest.element, this.getCurrentWindow());
+            aRequest.parameters.id, this.getCurrentWindow());
         el.focus();
-        utils.sendString(aRequest.value.join(""), utils.window);
+        utils.sendString(aRequest.parameters.value.join(""), utils.window);
         this.sendOk(command_id);
       }
       catch (e) {
         this.sendError(e.message, e.code, e.stack, command_id);
       }
     }
     else {
       this.sendAsync("sendKeysToElement",
                      {
-                       element:aRequest.element,
-                       value: aRequest.value
+                       id:aRequest.parameters.id,
+                       value: aRequest.parameters.value
                      },
                      command_id);
     }
   },
 
   /**
    * Sets the test name
    *
    * The test name is used in logging messages.
    */
   setTestName: function MDA_setTestName(aRequest) {
     this.command_id = this.getCommandId();
     this.logRequest("setTestName", aRequest);
-    this.testName = aRequest.value;
+    this.testName = aRequest.parameters.value;
     this.sendAsync("setTestName",
-                   { value: aRequest.value },
+                   { value: aRequest.parameters.value },
                    this.command_id);
   },
 
   /**
    * Clear the text of an element
    *
    * @param object aRequest
-   *        'element' member holds the reference id to
+   *        'id' member holds the reference id to
    *        the element that will be cleared 
    */
   clearElement: function MDA_clearElement(aRequest) {
     let command_id = this.command_id = this.getCommandId();
     if (this.context == "chrome") {
       //the selenium atom doesn't work here
       try {
         let el = this.curBrowser.elementManager.getKnownElement(
-            aRequest.element, this.getCurrentWindow());
+            aRequest.parameters.id, this.getCurrentWindow());
         if (el.nodeName == "textbox") {
           el.value = "";
         }
         else if (el.nodeName == "checkbox") {
           el.checked = false;
         }
         this.sendOk(command_id);
       }
       catch (e) {
         this.sendError(e.message, e.code, e.stack, command_id);
       }
     }
     else {
       this.sendAsync("clearElement",
-                     { element:aRequest.element },
+                     { id:aRequest.parameters.id },
                      command_id);
     }
   },
 
   getElementPosition: function MDA_getElementPosition(aRequest) {
     this.command_id = this.getCommandId();
     this.sendAsync("getElementPosition",
-                   { element:aRequest.element },
+                   { id:aRequest.parameters.id },
                    this.command_id);
   },
 
   /**
    * Add a cookie to the document.
    */
   addCookie: function MDA_addCookie(aRequest) {
     this.command_id = this.getCommandId();
     this.sendAsync("addCookie",
-                   { cookie:aRequest.cookie },
+                   { cookie:aRequest.parameters.cookie },
                    this.command_id);
   },
 
   /**
    * Get all visible cookies for a document
    */
   getAllCookies: function MDA_getAllCookies() {
     this.command_id = this.getCommandId();
@@ -1899,17 +1897,17 @@ MarionetteServerConnection.prototype = {
   },
 
   /**
    * Delete a cookie by name
    */
   deleteCookie: function MDA_deleteCookie(aRequest) {
     this.command_id = this.getCommandId();
     this.sendAsync("deleteCookie",
-                   { name:aRequest.name },
+                   { name:aRequest.parameters.name },
                    this.command_id);
   },
 
   /**
    * Closes the Browser Window.
    *
    * If it is B2G it returns straight away and does not do anything
    *
@@ -1923,17 +1921,17 @@ MarionetteServerConnection.prototype = {
       this.sendOk(command_id);
     }
     else {
       // Get the total number of windows
       let numOpenWindows = 0;
       let winEnum = this.getWinEnumerator();
       while (winEnum.hasMoreElements()) {
         numOpenWindows += 1;
-        winEnum.getNext(); 
+        winEnum.getNext();
       }
 
       // if there is only 1 window left, delete the session
       if (numOpenWindows === 1){
         this.sessionTearDown();
         this.sendOk(command_id);
         return;
       }
@@ -2063,37 +2061,37 @@ MarionetteServerConnection.prototype = {
       else {
         //Note: The permission bits here don't actually get set (bug 804563)
         this.importedScripts.createUnique(
             Components.interfaces.nsIFile.NORMAL_FILE_TYPE, parseInt("0666", 8));
         file = FileUtils.openFileOutputStream(this.importedScripts,
             FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE);
         this.importedScripts.permissions = parseInt("0666", 8); //actually set permissions
       }
-      file.write(aRequest.script, aRequest.script.length);
+      file.write(aRequest.parameters.script, aRequest.parameters.script.length);
       file.close();
       this.sendOk(command_id);
     }
     else {
       this.sendAsync("importScript",
-                     { script: aRequest.script },
+                     { script: aRequest.parameters.script },
                      command_id);
     }
   },
 
   /**
    * Takes a screenshot of a DOM node. If there is no node given a screenshot
    * of the window will be taken.
    */
   screenShot: function MDA_saveScreenshot(aRequest) {
     this.command_id = this.getCommandId();
     this.sendAsync("screenShot",
                    {
-                     element: aRequest.element,
-                     highlights: aRequest.highlights
+                     id: aRequest.parameters.id,
+                     highlights: aRequest.parameters.highlights
                    },
                    this.command_id);
   },
 
   /**
    * Helper function to convert an outerWindowID into a UID that Marionette
    * tracks.
    */