Merge pull request #15987 from Snuffleupagus/onOpenWithTransport-params
Remove unused parameters from the `onOpenWithTransport` method in `PDFViewerApplication.initPassiveLoading`
This commit is contained in:
commit
b75dafba87
@ -283,28 +283,32 @@ function getDocument(src) {
|
||||
|
||||
switch (key) {
|
||||
case "url":
|
||||
if (val instanceof URL) {
|
||||
params[key] = val.href;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
// The full path is required in the 'url' field.
|
||||
params[key] = new URL(val, window.location).href;
|
||||
continue;
|
||||
} catch (ex) {
|
||||
if (
|
||||
typeof PDFJSDev !== "undefined" &&
|
||||
PDFJSDev.test("GENERIC") &&
|
||||
isNodeJS &&
|
||||
typeof val === "string"
|
||||
) {
|
||||
break; // Use the url as-is in Node.js environments.
|
||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
||||
continue; // The 'url' is unused with `PDFDataRangeTransport`.
|
||||
} else {
|
||||
if (val instanceof URL) {
|
||||
params[key] = val.href;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
// The full path is required in the 'url' field.
|
||||
params[key] = new URL(val, window.location).href;
|
||||
continue;
|
||||
} catch (ex) {
|
||||
if (
|
||||
typeof PDFJSDev !== "undefined" &&
|
||||
PDFJSDev.test("GENERIC") &&
|
||||
isNodeJS &&
|
||||
typeof val === "string"
|
||||
) {
|
||||
break; // Use the url as-is in Node.js environments.
|
||||
}
|
||||
}
|
||||
throw new Error(
|
||||
"Invalid PDF url data: " +
|
||||
"either string or URL-object is expected in the url property."
|
||||
);
|
||||
}
|
||||
throw new Error(
|
||||
"Invalid PDF url data: " +
|
||||
"either string or URL-object is expected in the url property."
|
||||
);
|
||||
case "range":
|
||||
rangeTransport = val;
|
||||
continue;
|
||||
|
@ -749,8 +749,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)) {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user