Bug 1453385 - Fix actors using something else than RetVal in response's spec. r=jryans draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Fri, 13 Apr 2018 02:56:46 -0700
changeset 781943 7c961d6a54c671fe91e6720240fb6eeb2ebd7a36
parent 781942 a7903d7cc2357419d24c39ba1dca767fdba3f5d4
push id106451
push userbmo:poirot.alex@gmail.com
push dateFri, 13 Apr 2018 20:48:33 +0000
reviewersjryans
bugs1453385
milestone61.0a1
Bug 1453385 - Fix actors using something else than RetVal in response's spec. r=jryans MozReview-Commit-ID: 2fRciZoqQSY
devtools/server/performance/memory.js
devtools/server/tests/unit/test_protocol_children.js
devtools/shared/specs/memory.js
devtools/shared/specs/performance.js
--- a/devtools/server/performance/memory.js
+++ b/devtools/server/performance/memory.js
@@ -71,26 +71,28 @@ Memory.prototype = {
    * This attaches the MemoryBridge's Debugger instance so that you can start
    * recording allocations or take a census of the heap. In addition, the
    * MemoryBridge will start emitting GC events.
    */
   attach: expectState("detached", function() {
     this.dbg.addDebuggees();
     this.dbg.memory.onGarbageCollection = this._onGarbageCollection.bind(this);
     this.state = "attached";
+    return this.state;
   }, "attaching to the debugger"),
 
   /**
    * Detach from this MemoryBridge.
    */
   detach: expectState("attached", function() {
     this._clearDebuggees();
     this.dbg.enabled = false;
     this._dbg = null;
     this.state = "detached";
+    return this.state;
   }, "detaching from the debugger"),
 
   /**
    * Gets the current MemoryBridge attach/detach state.
    */
   getState: function() {
     return this.state;
   },
--- a/devtools/server/tests/unit/test_protocol_children.js
+++ b/devtools/server/tests/unit/test_protocol_children.js
@@ -76,17 +76,17 @@ const childSpec = protocol.generateActor
       request: { inputArray: Arg(0, "array:number") },
       response: RetVal("array:number")
     },
     getSibling: {
       request: { id: Arg(0) },
       response: { sibling: RetVal("childActor") }
     },
     emitEvents: {
-      response: { value: "correct response" },
+      response: { value: RetVal("string") },
     },
     release: {
       release: true
     }
   }
 });
 
 var ChildActor = protocol.ActorClassWithSpec(childSpec, {
@@ -151,16 +151,17 @@ var ChildActor = protocol.ActorClassWith
   },
 
   emitEvents: function() {
     EventEmitter.emit(this, "event1", 1, 2, 3);
     EventEmitter.emit(this, "event2", 4, 5, 6);
     EventEmitter.emit(this, "named-event", 1, 2, 3);
     EventEmitter.emit(this, "object-event", this);
     EventEmitter.emit(this, "array-object-event", [this]);
+    return "correct response";
   },
 
   release: function() { },
 });
 
 var ChildFront = protocol.FrontClassWithSpec(childSpec, {
   initialize: function(client, form) {
     protocol.Front.prototype.initialize.call(this, client, form);
--- a/devtools/shared/specs/memory.js
+++ b/devtools/shared/specs/memory.js
@@ -45,23 +45,23 @@ const memorySpec = generateActorSpec({
       data: Arg(0, "json"),
     },
   },
 
   methods: {
     attach: {
       request: {},
       response: {
-        type: "attached"
+        type: RetVal("string")
       }
     },
     detach: {
       request: {},
       response: {
-        type: "detached"
+        type: RetVal("string")
       }
     },
     getState: {
       response: {
         state: RetVal(0, "string")
       }
     },
     takeCensus: {
--- a/devtools/shared/specs/performance.js
+++ b/devtools/shared/specs/performance.js
@@ -74,14 +74,14 @@ const performanceSpec = generateActorSpe
 
     getConfiguration: {
       request: {},
       response: { config: RetVal("json") }
     },
 
     setProfilerStatusInterval: {
       request: { interval: Arg(0, "number") },
-      response: { oneway: true }
+      oneway: true
     },
   }
 });
 
 exports.performanceSpec = performanceSpec;