Bug 795979 - RDP, new packet type: getObjectsProperties. r=past
☠☠ backed out by 60610dbd2cf0 ☠ ☠
authorMike Hordecki <mhordecki@mozilla.com>
Thu, 15 Aug 2013 18:10:00 +0200
changeset 156182 e039f5fc18d0e6a714a0cdba1471acc7237832b0
parent 156181 03e2d35cfb2c02bb16ef271f4a01d5e9187bbcd5
child 156183 c1a70c4645724603dc73ccf92756b56092e7d2e7
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast
bugs795979
milestone26.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 795979 - RDP, new packet type: getObjectsProperties. r=past
toolkit/components/telemetry/Histograms.json
toolkit/devtools/client/dbg-client.jsm
toolkit/devtools/server/actors/script.js
toolkit/devtools/server/tests/unit/test_objectgrips-09.js
toolkit/devtools/server/tests/unit/xpcshell.ini
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -3355,16 +3355,28 @@
     "description": "The time (in milliseconds) that it took a 'prototypeAndProperties' request to go round trip."
   },
   "DEVTOOLS_DEBUGGER_RDP_REMOTE_PROTOTYPEANDPROPERTIES_MS": {
     "kind": "exponential",
     "high": "10000",
     "n_buckets": "1000",
     "description": "The time (in milliseconds) that it took a 'prototypeAndProperties' request to go round trip."
   },
+  "DEVTOOLS_DEBUGGER_RDP_LOCAL_PROTOTYPESANDPROPERTIES_MS": {
+    "kind": "exponential",
+    "high": "10000",
+    "n_buckets": "1000",
+    "description": "The time (in milliseconds) that it took a 'prototypesAndProperties' request to go round trip."
+  },
+  "DEVTOOLS_DEBUGGER_RDP_REMOTE_PROTOTYPESANDPROPERTIES_MS": {
+    "kind": "exponential",
+    "high": "10000",
+    "n_buckets": "1000",
+    "description": "The time (in milliseconds) that it took a 'prototypesAndProperties' request to go round trip."
+  },
   "DEVTOOLS_DEBUGGER_RDP_LOCAL_PROPERTY_MS": {
     "kind": "exponential",
     "high": "10000",
     "n_buckets": "1000",
     "description": "The time (in milliseconds) that it took a 'property' request to go round trip."
   },
   "DEVTOOLS_DEBUGGER_RDP_REMOTE_PROPERTY_MS": {
     "kind": "exponential",
--- a/toolkit/devtools/client/dbg-client.jsm
+++ b/toolkit/devtools/client/dbg-client.jsm
@@ -1621,18 +1621,32 @@ ThreadClient.prototype = {
    */
   source: function TC_source(aForm) {
     if (aForm.actor in this._threadGrips) {
       return this._threadGrips[aForm.actor];
     }
 
     return this._threadGrips[aForm.actor] = new SourceClient(this._client,
                                                              aForm);
-  }
+  },
 
+  /**
+   * Request the prototype and own properties of mutlipleObjects.
+   *
+   * @param aOnResponse function
+   *        Called with the request's response.
+   * @param actors [string]
+   *        List of actor ID of the queried objects.
+   */
+  getPrototypesAndProperties: DebuggerClient.requester({
+    type: "prototypesAndProperties",
+    actors: args(0)
+  }, {
+    telemetry: "PROTOTYPESANDPROPERTIES"
+  })
 };
 
 eventSource(ThreadClient.prototype);
 
 /**
  * Creates a tracing profiler client for the remote debugging protocol
  * server. This client is a front to the trace actor created on the
  * server side, hiding the protocol details in a traditional
--- a/toolkit/devtools/server/actors/script.js
+++ b/toolkit/devtools/server/actors/script.js
@@ -2065,31 +2065,60 @@ ThreadActor.prototype = {
           && bp.line <= endLine) {
         this._setBreakpoint(bp);
       }
     }
 
     return true;
   },
 
+
+  /**
+   * Get prototypes and properties of multiple objects.
+   */
+  onPrototypesAndProperties: function TA_onPrototypesAndProperties(aRequest) {
+    let result = {};
+    for (let actorID of aRequest.actors) {
+      // This code assumes that there are no lazily loaded actors returned
+      // by this call.
+      let actor = this.conn.getActor(actorID);
+      if (!actor) {
+        return { from: this.actorID,
+                 error: "noSuchActor" };
+      }
+      let handler = actor.onPrototypeAndProperties;
+      if (!handler) {
+        return { from: this.actorID,
+                 error: "unrecognizedPacketType",
+                 message: ('Actor "' + actorID +
+                           '" does not recognize the packet type ' +
+                           '"prototypeAndProperties"') };
+      }
+      result[actorID] = handler.call(actor, {});
+    }
+    return { from: this.actorID,
+             actors: result };
+  }
+
 };
 
 ThreadActor.prototype.requestTypes = {
   "attach": ThreadActor.prototype.onAttach,
   "detach": ThreadActor.prototype.onDetach,
   "reconfigure": ThreadActor.prototype.onReconfigure,
   "resume": ThreadActor.prototype.onResume,
   "clientEvaluate": ThreadActor.prototype.onClientEvaluate,
   "frames": ThreadActor.prototype.onFrames,
   "interrupt": ThreadActor.prototype.onInterrupt,
   "eventListeners": ThreadActor.prototype.onEventListeners,
   "releaseMany": ThreadActor.prototype.onReleaseMany,
   "setBreakpoint": ThreadActor.prototype.onSetBreakpoint,
   "sources": ThreadActor.prototype.onSources,
-  "threadGrips": ThreadActor.prototype.onThreadGrips
+  "threadGrips": ThreadActor.prototype.onThreadGrips,
+  "prototypesAndProperties": ThreadActor.prototype.onPrototypesAndProperties
 };
 
 
 /**
  * Creates a PauseActor.
  *
  * PauseActors exist for the lifetime of a given debuggee pause.  Used to
  * scope pause-lifetime grips.
new file mode 100644
--- /dev/null
+++ b/toolkit/devtools/server/tests/unit/test_objectgrips-09.js
@@ -0,0 +1,65 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+/**
+ * This tests exercises getProtypesAndProperties message accepted
+ * by a thread actor.
+ */
+
+var gDebuggee;
+var gClient;
+var gThreadClient;
+
+function run_test()
+{
+  initTestDebuggerServer();
+  gDebuggee = addTestGlobal("test-grips");
+  gDebuggee.eval(function stopMe(arg1, arg2) {
+    debugger;
+  }.toString());
+
+  gClient = new DebuggerClient(DebuggerServer.connectPipe());
+  gClient.connect(function() {
+    attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) {
+      gThreadClient = aThreadClient;
+      test_object_grip();
+    });
+  });
+  do_test_pending();
+}
+
+function test_object_grip()
+{
+  gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) {
+    let args = aPacket.frame.arguments;
+
+    gThreadClient.getPrototypesAndProperties([args[0].actor, args[1].actor], function(aResponse) {
+      let obj1 = aResponse.actors[args[0].actor];
+      let obj2 = aResponse.actors[args[1].actor];
+      do_check_eq(obj1.ownProperties.x.configurable, true);
+      do_check_eq(obj1.ownProperties.x.enumerable, true);
+      do_check_eq(obj1.ownProperties.x.writable, true);
+      do_check_eq(obj1.ownProperties.x.value, 10);
+
+      do_check_eq(obj1.ownProperties.y.configurable, true);
+      do_check_eq(obj1.ownProperties.y.enumerable, true);
+      do_check_eq(obj1.ownProperties.y.writable, true);
+      do_check_eq(obj1.ownProperties.y.value, "kaiju");
+
+      do_check_eq(obj2.ownProperties.z.configurable, true);
+      do_check_eq(obj2.ownProperties.z.enumerable, true);
+      do_check_eq(obj2.ownProperties.z.writable, true);
+      do_check_eq(obj2.ownProperties.z.value, 123);
+
+      do_check_true(obj1.prototype != undefined);
+      do_check_true(obj2.prototype != undefined);
+
+      gThreadClient.resume(function() {
+        finishClient(gClient);
+      });
+    });
+
+  });
+
+  gDebuggee.eval("stopMe({ x: 10, y: 'kaiju'}, { z: 123 })");
+}
+
--- a/toolkit/devtools/server/tests/unit/xpcshell.ini
+++ b/toolkit/devtools/server/tests/unit/xpcshell.ini
@@ -122,16 +122,17 @@ reason = bug 820380
 [test_objectgrips-01.js]
 [test_objectgrips-02.js]
 [test_objectgrips-03.js]
 [test_objectgrips-04.js]
 [test_objectgrips-05.js]
 [test_objectgrips-06.js]
 [test_objectgrips-07.js]
 [test_objectgrips-08.js]
+[test_objectgrips-09.js]
 [test_interrupt.js]
 [test_stepping-01.js]
 [test_stepping-02.js]
 [test_stepping-03.js]
 [test_stepping-04.js]
 [test_stepping-05.js]
 [test_stepping-06.js]
 [test_framebindings-01.js]