Skip to content

Latest commit

 

History

History
80 lines (61 loc) · 2.56 KB

File metadata and controls

80 lines (61 loc) · 2.56 KB

Debugger Architecture

Debugger Protocol

The client speaks with the server over a websocket with a JSON protocol.

Clients and Actors

The Debugger client communicates with the server via clients and actors.

Commands

method Client Actor
setBreakpoint client actor

Add Commands

Events

Add Events

Adding a new Actor Method

Actor methods are defined in shared/specs and implemented in actors. In this example, we add a method evaluateExpressions in the Frame actor.

We can test that method in the client with the dbg.sendPacket helper:

dbg
  .sendPacket({
    to: dbg.selectors.getSelectedFrame().id,
    type: "evaluateExpressions"
  })
  .then(console.log); // {fine: true, from: "server1.conn2.child1/frame41"}
diff --git a/devtools/server/actors/frame.js b/devtools/server/actors/frame.js
index e02cc1e..c177eb9 100644
--- a/devtools/server/actors/frame.js
+++ b/devtools/server/actors/frame.js
@@ -62,16 +62,26 @@ let FrameActor = ActorClassWithSpec(frameSpec, {
     return envActor.form();
   },

+  evaluateExpressions: function(a, b, c) {
+    dump(`>> evaluateExpressions:  ${a} ${b}, ${c}\n`);
+    return { fine: true };
+  },
+

diff --git a/devtools/shared/specs/frame.js b/devtools/shared/specs/frame.js
index 35510b4..a06f4a2 100644
--- a/devtools/shared/specs/frame.js
+++ b/devtools/shared/specs/frame.js
@@ -11,6 +11,9 @@ const frameSpec = generateActorSpec({
   methods: {
     getEnvironment: {
       response: RetVal("json")
+    },
+    evaluateExpressions: {
+      response: RetVal("json")
     }
   },
 });