зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1616381 - Do not try to emit error packets when the actor is destoyed. r=jdescottes
I also added another early return in order to avoid trying to send a method response if the actor is destroyed, as it isn't really useful and would also throw. Both ifs added by this changeset fixes the test failure independently of the other one. But I think we would benefit from both. The one in writeError would avoid throwing exception in the last change catch handler and so avoid unhandled promise rejections. The one in sendReturn probably helps having more meaningful error report! Differential Revision: https://phabricator.services.mozilla.com/D89682
This commit is contained in:
Родитель
a5b0f93ea2
Коммит
bdfead3b8b
|
@ -100,6 +100,12 @@ class Actor extends Pool {
|
|||
console.error(error.stack);
|
||||
}
|
||||
|
||||
// Do not try to send the error if the actor is destroyed
|
||||
// as the connection is probably also destroyed and may throw.
|
||||
if (this.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.conn.send({
|
||||
from: this.actorID,
|
||||
// error.error -> errors created using the throwError() helper
|
||||
|
@ -170,6 +176,13 @@ var generateRequestHandlers = function(actorSpec, actorProto) {
|
|||
// No need to send a response.
|
||||
return;
|
||||
}
|
||||
if (this.isDestroyed()) {
|
||||
console.error(
|
||||
`Tried to send a '${spec.name}' method reply on an already destroyed actor` +
|
||||
` '${this.typeName}'`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
let response;
|
||||
try {
|
||||
|
|
Загрузка…
Ссылка в новой задаче