Simplify how the docBaseUrl
-option is handled in PDFViewerApplication.open
Reduce the "special" handling a bit here, by setting the viewer-option such that it'll be automatically included in the API-parameters.
This commit is contained in:
parent
8bbfcd3bef
commit
e20dabb65b
19
web/app.js
19
web/app.js
@ -1020,19 +1020,20 @@ const PDFViewerApplication = {
|
|||||||
/* downloadUrl = */ args.url
|
/* downloadUrl = */ args.url
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// Always set `docBaseUrl` in development mode, and in the (various)
|
||||||
|
// extension builds.
|
||||||
|
if (typeof PDFJSDev === "undefined") {
|
||||||
|
AppOptions.set("docBaseUrl", document.URL.split("#")[0]);
|
||||||
|
} else if (PDFJSDev.test("MOZCENTRAL || CHROME")) {
|
||||||
|
AppOptions.set("docBaseUrl", this.baseUrl);
|
||||||
|
}
|
||||||
|
|
||||||
// Set the necessary API parameters, using all the available options.
|
// Set the necessary API parameters, using all the available options.
|
||||||
const apiParams = AppOptions.getAll(OptionKind.API);
|
const apiParams = AppOptions.getAll(OptionKind.API);
|
||||||
const params = {
|
const loadingTask = getDocument({
|
||||||
...apiParams,
|
...apiParams,
|
||||||
...args,
|
...args,
|
||||||
};
|
});
|
||||||
|
|
||||||
if (typeof PDFJSDev === "undefined") {
|
|
||||||
params.docBaseUrl ||= document.URL.split("#")[0];
|
|
||||||
} else if (PDFJSDev.test("MOZCENTRAL || CHROME")) {
|
|
||||||
params.docBaseUrl ||= this.baseUrl;
|
|
||||||
}
|
|
||||||
const loadingTask = getDocument(params);
|
|
||||||
this.pdfLoadingTask = loadingTask;
|
this.pdfLoadingTask = loadingTask;
|
||||||
|
|
||||||
loadingTask.onPassword = (updateCallback, reason) => {
|
loadingTask.onPassword = (updateCallback, reason) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user