Bug 819049: JS debugging protocol: replace 'nameAndParameters' request with 'parameterNames'; replace GripClient.prototype.getSignature with GripClient.prototype.getParameterNames. r=past
authorJim Blandy <jimb@mozilla.com>
Fri, 14 Dec 2012 10:26:47 -0800
changeset 125196 972ff78e9907c15649b3b94145b5669e9a888350
parent 125195 62d11f7658cce8e6c77da5f7702e7d913b61b8f4
child 125197 1237d9a6ce46f17bc4f0778b7e3935eea22aa994
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast
bugs819049
milestone20.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 819049: JS debugging protocol: replace 'nameAndParameters' request with 'parameterNames'; replace GripClient.prototype.getSignature with GripClient.prototype.getParameterNames. r=past
toolkit/devtools/debugger/dbg-client.jsm
toolkit/devtools/debugger/server/dbg-script-actors.js
toolkit/devtools/debugger/tests/unit/test_functiongrips-01.js
--- a/toolkit/devtools/debugger/dbg-client.jsm
+++ b/toolkit/devtools/debugger/dbg-client.jsm
@@ -1084,27 +1084,29 @@ function GripClient(aClient, aGrip)
 }
 
 GripClient.prototype = {
   get actor() { return this._grip.actor },
 
   valid: true,
 
   /**
-   * Request the name of the function and its formal parameters.
+   * Request the names of a function's formal parameters.
    *
    * @param aOnResponse function
-   *        Called with the request's response.
+   *        Called with an object of the form:
+   *        { parameterNames:[<parameterName>, ...] }
+   *        where each <parameterName> is the name of a parameter.
    */
-  getSignature: function GC_getSignature(aOnResponse) {
+  getParameterNames: function GC_getParameterNames(aOnResponse) {
     if (this._grip["class"] !== "Function") {
-      throw "getSignature is only valid for function grips.";
+      throw "getParameterNames is only valid for function grips.";
     }
 
-    let packet = { to: this.actor, type: "nameAndParameters" };
+    let packet = { to: this.actor, type: "parameterNames" };
     this._client.request(packet, function (aResponse) {
                                    if (aOnResponse) {
                                      aOnResponse(aResponse);
                                    }
                                  });
   },
 
   /**
--- a/toolkit/devtools/debugger/server/dbg-script-actors.js
+++ b/toolkit/devtools/debugger/server/dbg-script-actors.js
@@ -1668,30 +1668,29 @@ update(ObjectActor.prototype, {
     // We can't get to the frame that defined this function's environment,
     // neither here, nor during ObjectActor's construction. Luckily, we don't
     // use the 'scope' request in the debugger frontend.
     return { name: this.obj.name || null,
              scope: envActor.form(this.obj) };
   }),
 
   /**
-   * Handle a protocol request to provide the name and parameters of a function.
+   * Handle a protocol request to provide the parameters of a function.
    *
    * @param aRequest object
    *        The protocol request object.
    */
-  onNameAndParameters: PauseScopedActor.withPaused(function OA_onNameAndParameters(aRequest) {
+  onParameterNames: PauseScopedActor.withPaused(function OA_onParameterNames(aRequest) {
     if (this.obj.class !== "Function") {
       return { error: "objectNotFunction",
-               message: "nameAndParameters request is only valid for object " +
+               message: "'parameterNames' request is only valid for object " +
                         "grips with a 'Function' class." };
     }
 
-    return { name: this.obj.name || null,
-             parameters: this.obj.parameterNames };
+    return { parameterNames: this.obj.parameterNames };
   }),
 
   /**
    * Handle a protocol request to promote a pause-lifetime grip to a
    * thread-lifetime grip.
    *
    * @param aRequest object
    *        The protocol request object.
@@ -1714,17 +1713,17 @@ update(ObjectActor.prototype, {
     }
 
     this.release();
     return {};
   }),
 });
 
 ObjectActor.prototype.requestTypes = {
-  "nameAndParameters": ObjectActor.prototype.onNameAndParameters,
+  "parameterNames": ObjectActor.prototype.onParameterNames,
   "prototypeAndProperties": ObjectActor.prototype.onPrototypeAndProperties,
   "prototype": ObjectActor.prototype.onPrototype,
   "property": ObjectActor.prototype.onProperty,
   "ownPropertyNames": ObjectActor.prototype.onOwnPropertyNames,
   "scope": ObjectActor.prototype.onScope,
   "decompile": ObjectActor.prototype.onDecompile,
   "threadGrip": ObjectActor.prototype.onThreadGrip,
   "release": ObjectActor.prototype.onRelease,
--- a/toolkit/devtools/debugger/tests/unit/test_functiongrips-01.js
+++ b/toolkit/devtools/debugger/tests/unit/test_functiongrips-01.js
@@ -27,20 +27,19 @@ function test_named_function()
 {
   gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) {
     let args = aPacket.frame.arguments;
 
     do_check_eq(args[0].class, "Function");
     do_check_eq(args[0].name, "stopMe");
 
     let objClient = gThreadClient.pauseGrip(args[0]);
-    objClient.getSignature(function(aResponse) {
-      do_check_eq(aResponse.name, "stopMe");
-      do_check_eq(aResponse.parameters.length, 1);
-      do_check_eq(aResponse.parameters[0], "arg1");
+    objClient.getParameterNames(function(aResponse) {
+      do_check_eq(aResponse.parameterNames.length, 1);
+      do_check_eq(aResponse.parameterNames[0], "arg1");
 
       gThreadClient.resume(test_inferred_name_function);
     });
 
   });
 
   gDebuggee.eval("stopMe(stopMe)");
 }
@@ -50,22 +49,21 @@ function test_inferred_name_function() {
     let args = aPacket.frame.arguments;
 
     do_check_eq(args[0].class, "Function");
     // No name for an anonymous function, but it should have an inferred name.
     do_check_eq(args[0].name, undefined);
     do_check_eq(args[0].displayName, "o.m");
 
     let objClient = gThreadClient.pauseGrip(args[0]);
-    objClient.getSignature(function(aResponse) {
-      do_check_eq(aResponse.name, null);
-      do_check_eq(aResponse.parameters.length, 3);
-      do_check_eq(aResponse.parameters[0], "foo");
-      do_check_eq(aResponse.parameters[1], "bar");
-      do_check_eq(aResponse.parameters[2], "baz");
+    objClient.getParameterNames(function(aResponse) {
+      do_check_eq(aResponse.parameterNames.length, 3);
+      do_check_eq(aResponse.parameterNames[0], "foo");
+      do_check_eq(aResponse.parameterNames[1], "bar");
+      do_check_eq(aResponse.parameterNames[2], "baz");
 
       gThreadClient.resume(test_anonymous_function);
     });
   });
 
   gDebuggee.eval("var o = { m: function(foo, bar, baz) { } }; stopMe(o.m)");
 }
 
@@ -74,22 +72,21 @@ function test_anonymous_function() {
     let args = aPacket.frame.arguments;
 
     do_check_eq(args[0].class, "Function");
     // No name for an anonymous function, and no inferred name, either.
     do_check_eq(args[0].name, undefined);
     do_check_eq(args[0].displayName, undefined);
 
     let objClient = gThreadClient.pauseGrip(args[0]);
-    objClient.getSignature(function(aResponse) {
-      do_check_eq(aResponse.name, null);
-      do_check_eq(aResponse.parameters.length, 3);
-      do_check_eq(aResponse.parameters[0], "foo");
-      do_check_eq(aResponse.parameters[1], "bar");
-      do_check_eq(aResponse.parameters[2], "baz");
+    objClient.getParameterNames(function(aResponse) {
+      do_check_eq(aResponse.parameterNames.length, 3);
+      do_check_eq(aResponse.parameterNames[0], "foo");
+      do_check_eq(aResponse.parameterNames[1], "bar");
+      do_check_eq(aResponse.parameterNames[2], "baz");
 
       gThreadClient.resume(function() {
         finishClient(gClient);
       });
     });
   });
 
   gDebuggee.eval("stopMe(function(foo, bar, baz) { })");