Skip to content

Commit

Permalink
Remove the requestRange/requestFull methods from the `NetworkMana…
Browse files Browse the repository at this point in the history
…ger` class

Originally the code in this file was used in both the GENERIC and MOZCENTRAL builds, however that's no longer the case.
Hence we can now directly call `NetworkManager.prototype.request` and remove these old "helper" methods that only had a single call-site each.
  • Loading branch information
Snuffleupagus committed Dec 31, 2024
1 parent f19b0a1 commit 01240fd
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions src/display/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,6 @@ class NetworkManager {
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) {
const xhr = new XMLHttpRequest();
const xhrId = this.currXhrId++;
Expand Down Expand Up @@ -248,14 +233,13 @@ class PDFNetworkStreamFullRequestReader {
constructor(manager, source) {
this._manager = manager;

const args = {
this._url = source.url;
this._fullRequestId = manager.request({
onHeadersReceived: this._onHeadersReceived.bind(this),
onDone: this._onDone.bind(this),
onError: this._onError.bind(this),
onProgress: this._onProgress.bind(this),
};
this._url = source.url;
this._fullRequestId = manager.requestFull(args);
});
this._headersCapability = Promise.withResolvers();
this._disableRange = source.disableRange || false;
this._contentLength = source.length; // Optional
Expand Down Expand Up @@ -418,14 +402,15 @@ class PDFNetworkStreamRangeRequestReader {
constructor(manager, begin, end) {
this._manager = manager;

const args = {
this._url = manager.url;
this._requestId = manager.request({
begin,
end,
onHeadersReceived: this._onHeadersReceived.bind(this),
onDone: this._onDone.bind(this),
onError: this._onError.bind(this),
onProgress: this._onProgress.bind(this),
};
this._url = manager.url;
this._requestId = manager.requestRange(begin, end, args);
});
this._requests = [];
this._queuedChunk = null;
this._done = false;
Expand Down

0 comments on commit 01240fd

Please sign in to comment.