Skip to content

Commit 01240fd

Browse files
committed
Remove the requestRange/requestFull methods from the NetworkManager 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.
1 parent f19b0a1 commit 01240fd

File tree

1 file changed

+8
-23
lines changed

1 file changed

+8
-23
lines changed

src/display/network.js

+8-23
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,6 @@ class NetworkManager {
5252
this.pendingRequests = Object.create(null);
5353
}
5454

55-
requestRange(begin, end, listeners) {
56-
const args = {
57-
begin,
58-
end,
59-
};
60-
for (const prop in listeners) {
61-
args[prop] = listeners[prop];
62-
}
63-
return this.request(args);
64-
}
65-
66-
requestFull(listeners) {
67-
return this.request(listeners);
68-
}
69-
7055
request(args) {
7156
const xhr = new XMLHttpRequest();
7257
const xhrId = this.currXhrId++;
@@ -248,14 +233,13 @@ class PDFNetworkStreamFullRequestReader {
248233
constructor(manager, source) {
249234
this._manager = manager;
250235

251-
const args = {
236+
this._url = source.url;
237+
this._fullRequestId = manager.request({
252238
onHeadersReceived: this._onHeadersReceived.bind(this),
253239
onDone: this._onDone.bind(this),
254240
onError: this._onError.bind(this),
255241
onProgress: this._onProgress.bind(this),
256-
};
257-
this._url = source.url;
258-
this._fullRequestId = manager.requestFull(args);
242+
});
259243
this._headersCapability = Promise.withResolvers();
260244
this._disableRange = source.disableRange || false;
261245
this._contentLength = source.length; // Optional
@@ -418,14 +402,15 @@ class PDFNetworkStreamRangeRequestReader {
418402
constructor(manager, begin, end) {
419403
this._manager = manager;
420404

421-
const args = {
405+
this._url = manager.url;
406+
this._requestId = manager.request({
407+
begin,
408+
end,
422409
onHeadersReceived: this._onHeadersReceived.bind(this),
423410
onDone: this._onDone.bind(this),
424411
onError: this._onError.bind(this),
425412
onProgress: this._onProgress.bind(this),
426-
};
427-
this._url = manager.url;
428-
this._requestId = manager.requestRange(begin, end, args);
413+
});
429414
this._requests = [];
430415
this._queuedChunk = null;
431416
this._done = false;

0 commit comments

Comments
 (0)