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

Merge pull request #16007 from Snuffleupagus/getDocument-params-init

Re-factor the parameter parsing/validation in `getDocument`
This commit is contained in:
Tim van der Meij 2023-02-05 13:16:59 +01:00 committed by GitHub
commit 05d821e680
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 213 additions and 230 deletions

View file

@ -932,12 +932,10 @@ const PDFViewerApplication = {
) {
// The Firefox built-in viewer always calls `setTitleUsingUrl`, before
// `initPassiveLoading`, and it never provides an `originalUrl` here.
if (args.originalUrl) {
this.setTitleUsingUrl(args.originalUrl, /* downloadUrl = */ args.url);
delete args.originalUrl;
} else {
this.setTitleUsingUrl(args.url, /* downloadUrl = */ args.url);
}
this.setTitleUsingUrl(
args.originalUrl || args.url,
/* downloadUrl = */ args.url
);
}
// Set the necessary API parameters, using all the available options.
const apiParams = AppOptions.getAll(OptionKind.API);