1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Ensure that Errors are handled correctly when using postMessage with Streams in MessageHandler

Having recently worked with this code, it struck me that most of the `postMessage` calls where `Error`s are involved have never been correctly implemented (i.e. missing `wrapReason` calls).
This commit is contained in:
Jonas Jenwald 2019-09-02 13:18:39 +02:00
parent e59b11860d
commit 02bdacef42
2 changed files with 11 additions and 9 deletions

View file

@ -231,7 +231,7 @@ MessageHandler.prototype = {
targetName,
stream: StreamKind.CANCEL,
streamId,
reason,
reason: wrapReason(reason),
});
// Return Promise to signal success or failure.
return cancelCapability.promise;
@ -296,7 +296,7 @@ MessageHandler.prototype = {
targetName,
stream: StreamKind.ERROR,
streamId,
reason,
reason: wrapReason(reason),
});
},
@ -327,7 +327,7 @@ MessageHandler.prototype = {
targetName,
stream: StreamKind.START_COMPLETE,
streamId,
reason,
reason: wrapReason(reason),
});
});
},
@ -397,7 +397,7 @@ MessageHandler.prototype = {
targetName,
stream: StreamKind.PULL_COMPLETE,
streamId,
reason,
reason: wrapReason(reason),
});
});
break;
@ -450,7 +450,7 @@ MessageHandler.prototype = {
targetName,
stream: StreamKind.CANCEL_COMPLETE,
streamId,
reason,
reason: wrapReason(reason),
});
});
this.streamSinks[data.streamId].sinkCapability.