Bug 1460229 - Throw an explicit error message when a method specified in a spec is missing in the actor. r=jryans
authorAlexandre Poirot <poirot.alex@gmail.com>
Wed, 28 Mar 2018 01:08:06 -0700
changeset 418473 ac313bdb1bff493e0a6205755403879738fbccd5
parent 418472 a9ff6f58c296e9616e070017ba452d23c3f0bf05
child 418474 7ab222f263915f408726628725a2a4f6b9bb8c40
push id34003
push usershindli@mozilla.com
push dateWed, 16 May 2018 18:31:07 +0000
treeherdermozilla-central@a35fc68a2471 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans
bugs1460229
milestone62.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 1460229 - Throw an explicit error message when a method specified in a spec is missing in the actor. r=jryans MozReview-Commit-ID: JdsCMh93xZE
devtools/shared/protocol.js
--- a/devtools/shared/protocol.js
+++ b/devtools/shared/protocol.js
@@ -1146,16 +1146,20 @@ var generateRequestHandlers = function(a
         let args;
         try {
           args = spec.request.read(packet, this);
         } catch (ex) {
           console.error("Error reading request: " + packet.type);
           throw ex;
         }
 
+        if (!this[spec.name]) {
+          throw new Error(`Spec for '${actorProto.typeName}' specifies a '${spec.name}'` +
+                          ` method that isn't implemented by the actor`);
+        }
         let ret = this[spec.name].apply(this, args);
 
         let sendReturn = (retToSend) => {
           if (spec.oneway) {
             // No need to send a response.
             return;
           }