mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Ensure that ReadableStream
s are cancelled with actual Errors
There's a number of spots in the current code, and tests, where `cancel` methods are not called with appropriate arguments (leading to Promises not being rejected with Errors as intended). In some cases the cancel `reason` is implicitly set to `undefined`, and in others the cancel `reason` is just a plain String. To address this inconsistency, the patch changes things such that cancelling is done with `AbortException`s everywhere instead.
This commit is contained in:
parent
d909b86b28
commit
a3150166ec
8 changed files with 32 additions and 29 deletions
|
@ -13,6 +13,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AbortException } from '../../src/shared/util';
|
||||
import { PDFNetworkStream } from '../../src/display/network';
|
||||
|
||||
describe('network', function() {
|
||||
|
@ -79,7 +80,7 @@ describe('network', function() {
|
|||
isStreamingSupported = fullReader.isStreamingSupported;
|
||||
isRangeSupported = fullReader.isRangeSupported;
|
||||
// we shall be able to close the full reader without issues
|
||||
fullReader.cancel('Don\'t need full reader');
|
||||
fullReader.cancel(new AbortException('Don\'t need fullReader.'));
|
||||
fullReaderCancelled = true;
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue