bug 1523104: remote: make Session#receiveMessage slightly more succinct; r=ochameau
authorAndreas Tolfsen <ato@sny.no>
Thu, 21 Feb 2019 13:07:29 +0000
changeset 521102 b35c2a9a00d2
parent 521101 2f7767b51e69
child 521103 cce704488a62
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1523104
milestone67.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 1523104: remote: make Session#receiveMessage slightly more succinct; r=ochameau
remote/Session.jsm
--- a/remote/Session.jsm
+++ b/remote/Session.jsm
@@ -55,31 +55,31 @@ class Session {
         request: {id, domainName, methodName, params},
       });
     } catch (e) {
       const error = formatError(e, {stack: true});
       this.connection.send({id, error});
     }
   }
 
-  receiveMessage({ name, data }) {
+  receiveMessage({name, data}) {
+    const {id, result, event, error} = data;
+
     switch (name) {
-      case "remote-protocol:result":
-        this.connection.send({
-          id: data.id,
-          result: data.result,
-        });
-        break;
-      case "remote-protocol:event":
-        this.connection.send(data.event);
-        break;
-      case "remote-protocol:error":
-        const error = formatError(data.error, {stack: true});
-        this.connection.send({id: data.id, error});
-        break;
+    case "remote-protocol:result":
+      this.connection.send({id, result});
+      break;
+
+    case "remote-protocol:event":
+      this.connection.send(event);
+      break;
+
+    case "remote-protocol:error":
+      this.connection.send({id, error: formatError(error, {stack: true})});
+      break;
     }
   }
 }
 
 /**
  * Split s by sep, returning list of substrings.
  * If max is given, at most max splits are done.
  * If max is 0, there is no limit on the number of splits.