Merge pull request #19273 from Snuffleupagus/NetworkManager-request-methods
Remove the `requestRange`/`requestFull` methods from the `NetworkManager` class
This commit is contained in:
commit
f9bea397f8
@ -52,21 +52,6 @@ class NetworkManager {
|
|||||||
this.pendingRequests = Object.create(null);
|
this.pendingRequests = Object.create(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
requestRange(begin, end, listeners) {
|
|
||||||
const args = {
|
|
||||||
begin,
|
|
||||||
end,
|
|
||||||
};
|
|
||||||
for (const prop in listeners) {
|
|
||||||
args[prop] = listeners[prop];
|
|
||||||
}
|
|
||||||
return this.request(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
requestFull(listeners) {
|
|
||||||
return this.request(listeners);
|
|
||||||
}
|
|
||||||
|
|
||||||
request(args) {
|
request(args) {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
const xhrId = this.currXhrId++;
|
const xhrId = this.currXhrId++;
|
||||||
@ -248,14 +233,13 @@ class PDFNetworkStreamFullRequestReader {
|
|||||||
constructor(manager, source) {
|
constructor(manager, source) {
|
||||||
this._manager = manager;
|
this._manager = manager;
|
||||||
|
|
||||||
const args = {
|
this._url = source.url;
|
||||||
|
this._fullRequestId = manager.request({
|
||||||
onHeadersReceived: this._onHeadersReceived.bind(this),
|
onHeadersReceived: this._onHeadersReceived.bind(this),
|
||||||
onDone: this._onDone.bind(this),
|
onDone: this._onDone.bind(this),
|
||||||
onError: this._onError.bind(this),
|
onError: this._onError.bind(this),
|
||||||
onProgress: this._onProgress.bind(this),
|
onProgress: this._onProgress.bind(this),
|
||||||
};
|
});
|
||||||
this._url = source.url;
|
|
||||||
this._fullRequestId = manager.requestFull(args);
|
|
||||||
this._headersCapability = Promise.withResolvers();
|
this._headersCapability = Promise.withResolvers();
|
||||||
this._disableRange = source.disableRange || false;
|
this._disableRange = source.disableRange || false;
|
||||||
this._contentLength = source.length; // Optional
|
this._contentLength = source.length; // Optional
|
||||||
@ -418,14 +402,15 @@ class PDFNetworkStreamRangeRequestReader {
|
|||||||
constructor(manager, begin, end) {
|
constructor(manager, begin, end) {
|
||||||
this._manager = manager;
|
this._manager = manager;
|
||||||
|
|
||||||
const args = {
|
this._url = manager.url;
|
||||||
|
this._requestId = manager.request({
|
||||||
|
begin,
|
||||||
|
end,
|
||||||
onHeadersReceived: this._onHeadersReceived.bind(this),
|
onHeadersReceived: this._onHeadersReceived.bind(this),
|
||||||
onDone: this._onDone.bind(this),
|
onDone: this._onDone.bind(this),
|
||||||
onError: this._onError.bind(this),
|
onError: this._onError.bind(this),
|
||||||
onProgress: this._onProgress.bind(this),
|
onProgress: this._onProgress.bind(this),
|
||||||
};
|
});
|
||||||
this._url = manager.url;
|
|
||||||
this._requestId = manager.requestRange(begin, end, args);
|
|
||||||
this._requests = [];
|
this._requests = [];
|
||||||
this._queuedChunk = null;
|
this._queuedChunk = null;
|
||||||
this._done = false;
|
this._done = false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user