mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
Adds fetch stream logic for networking part of PDF.js
This commit is contained in:
parent
f54dfc63dc
commit
3516a59384
6 changed files with 270 additions and 20 deletions
|
@ -13,12 +13,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { assert, createPromiseCapability } from '../shared/util';
|
||||
import {
|
||||
assert, createPromiseCapability, MissingPDFException,
|
||||
UnexpectedResponseException
|
||||
} from '../shared/util';
|
||||
createResponseStatusError, validateRangeRequestCapabilities
|
||||
} from './network_utils';
|
||||
import globalScope from '../shared/global_scope';
|
||||
import { validateRangeRequestCapabilities } from './network_utils';
|
||||
|
||||
if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
|
||||
throw new Error('Module "./network" shall not ' +
|
||||
|
@ -417,14 +416,7 @@ PDFNetworkStreamFullRequestReader.prototype = {
|
|||
|
||||
_onError: function PDFNetworkStreamFullRequestReader_onError(status) {
|
||||
var url = this._url;
|
||||
var exception;
|
||||
if (status === 404 || status === 0 && /^file:/.test(url)) {
|
||||
exception = new MissingPDFException('Missing PDF "' + url + '".');
|
||||
} else {
|
||||
exception = new UnexpectedResponseException(
|
||||
'Unexpected server response (' + status +
|
||||
') while retrieving PDF "' + url + '".', status);
|
||||
}
|
||||
var exception = createResponseStatusError(status, url);
|
||||
this._storedError = exception;
|
||||
this._headersReceivedCapability.reject(exception);
|
||||
this._requests.forEach(function (requestCapability) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue