Bug 1035296 - Make protocol.js pass error messages for unknownError (part 2); r=past
authorJoe Walker <jwalker@mozilla.com>
Mon, 04 Aug 2014 12:26:41 +0100
changeset 197494 215da263fe0630d42c4a9b8be24a59e1592ab0c4
parent 197493 0053279a09b4ab97ccb7a049cef1ad70d9b5cf69
child 197495 84caca21e7ccef43632191fb27b2f8f74dc6b481
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerspast
bugs1035296
milestone34.0a1
Bug 1035296 - Make protocol.js pass error messages for unknownError (part 2); r=past
toolkit/devtools/gcli/source/lib/gcli/cli.js
toolkit/devtools/server/protocol.js
--- a/toolkit/devtools/gcli/source/lib/gcli/cli.js
+++ b/toolkit/devtools/gcli/source/lib/gcli/cli.js
@@ -2065,16 +2065,20 @@ Requisition.prototype.exec = function(op
       if (ex != null) {
         util.errorHandler(ex);
       }
       else {
         console.error(data);
       }
     }
 
+    if (data != null && typeof data === 'string') {
+      data = data.replace(/^Protocol error: /, ''); // Temp fix for bug 1035296
+    }
+
     data = (data != null && data.isTypedData) ? data : {
       isTypedData: true,
       data: data,
       type: 'error'
     };
     output.complete(data, true);
     return output;
   };
--- a/toolkit/devtools/server/protocol.js
+++ b/toolkit/devtools/server/protocol.js
@@ -1107,17 +1107,17 @@ let Front = Class({
 
     let deferred = this._requests.shift();
     if (packet.error) {
       // "Protocol error" is here to avoid TBPL heuristics. See also
       // https://mxr.mozilla.org/webtools-central/source/tbpl/php/inc/GeneralErrorFilter.php
       let message = (packet.error == "unknownError" && packet.message) ?
                     "Protocol error: " + packet.message :
                     packet.error;
-      deferred.reject(packet.error);
+      deferred.reject(message);
     } else {
       deferred.resolve(packet);
     }
   }
 });
 exports.Front = Front;
 
 /**