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 418462 ac313bdb1bff493e0a6205755403879738fbccd5
parent 418461 a9ff6f58c296e9616e070017ba452d23c3f0bf05
child 418463 7ab222f263915f408726628725a2a4f6b9bb8c40
push id64047
push userapoirot@mozilla.com
push dateWed, 16 May 2018 09:37:52 +0000
treeherderautoland@ac313bdb1bff [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;
           }