1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Remove unused parameters from the onOpenWithTransport method in PDFViewerApplication.initPassiveLoading

The only parameter that we actually need here is the `PDFDataRangeTransport`-instance, since the others are not necessary.
 - The `url` parameter, as passed to the `getDocument` function in the API, is simply being ignored; see 2d87a2eb1c/src/display/api.js (L447-L458)
 - The `length` parameter, as passed to the `getDocument` function in the API, is always being overwritten; see 2d87a2eb1c/src/display/api.js (L519-L525)
This commit is contained in:
Jonas Jenwald 2023-01-31 21:34:42 +01:00
parent 2d87a2eb1c
commit cf8ee47589
3 changed files with 27 additions and 27 deletions

View file

@ -745,8 +745,8 @@ const PDFViewerApplication = {
throw new Error("Not implemented: initPassiveLoading");
}
this.externalServices.initPassiveLoading({
onOpenWithTransport: (url, length, transport) => {
this.open({ url, length, range: transport });
onOpenWithTransport: range => {
this.open({ range });
},
onOpenWithData: (data, contentDispositionFilename) => {
if (isPdfFile(contentDispositionFilename)) {

View file

@ -347,11 +347,7 @@ class FirefoxExternalServices extends DefaultExternalServices {
args.filename
);
callbacks.onOpenWithTransport(
args.pdfUrl,
args.length,
pdfDataRangeTransport
);
callbacks.onOpenWithTransport(pdfDataRangeTransport);
break;
case "range":
pdfDataRangeTransport.onDataRange(args.begin, args.chunk);