Merge pull request #12136 from Snuffleupagus/PDFFetchStreamRangeReader-AbortError

Ignore `fetch()` errors, in `PDFFetchStreamRangeReader`, once the request has been aborted
This commit is contained in:
Tim van der Meij 2020-07-29 00:09:51 +02:00 committed by GitHub
commit 6537e64cb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -243,12 +243,19 @@ class PDFFetchStreamRangeReader {
this._withCredentials, this._withCredentials,
this._abortController this._abortController
) )
).then(response => { )
.then(response => {
if (!validateResponseStatus(response.status)) { if (!validateResponseStatus(response.status)) {
throw createResponseStatusError(response.status, url); throw createResponseStatusError(response.status, url);
} }
this._readCapability.resolve(); this._readCapability.resolve();
this._reader = response.body.getReader(); this._reader = response.body.getReader();
})
.catch(reason => {
if (reason && reason.name === "AbortError") {
return;
}
throw reason;
}); });
this.onProgress = null; this.onProgress = null;