Bug 1454792 - Use arrow functions instead of bind in protocol.js. r=jryans
MozReview-Commit-ID: 8pOL86G3ff5
--- a/devtools/shared/protocol.js
+++ b/devtools/shared/protocol.js
@@ -934,19 +934,18 @@ exports.Pool = Pool;
*/
var Actor = function(conn) {
Pool.call(this, conn);
// Forward events to the connection.
if (this._actorSpec && this._actorSpec.events) {
for (let key of this._actorSpec.events.keys()) {
let name = key;
- let sendEvent = this._sendEvent.bind(this, name);
this.on(name, (...args) => {
- sendEvent.apply(null, args);
+ this._sendEvent(name, ...args);
});
}
}
};
Actor.prototype = extend(Pool.prototype, {
// Will contain the actor's ID
actorID: null,
@@ -1165,17 +1164,17 @@ var generateRequestHandlers = function(a
conn.send(response);
};
this._queueResponse(p => {
return p
.then(() => ret)
.then(sendReturn)
- .catch(this.writeError.bind(this));
+ .catch(e => this.writeError(e));
});
} catch (e) {
this._queueResponse(p => {
return p.then(() => this.writeError(e));
});
}
};