Merge pull request #21249 from Snuffleupagus/open-filename-unconditional

Support providing a `filename` unconditionally, when passing binary data to `PDFViewerApplication.open`
This commit is contained in:
Jonas Jenwald 2026-05-10 15:48:43 +02:00 committed by GitHub
commit 1079535a1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1220,11 +1220,12 @@ const PDFViewerApplication = {
const workerParams = AppOptions.getAll(OptionKind.WORKER);
Object.assign(GlobalWorkerOptions, workerParams);
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
if (args.data && isPdfFile(args.filename)) {
this._contentDispositionFilename = args.filename;
}
} else if (args.url) {
if (args.data && isPdfFile(args.filename)) {
this._contentDispositionFilename = args.filename;
} else if (
(typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) &&
args.url
) {
// The Firefox built-in viewer always calls `setTitleUsingUrl`, before
// `initPassiveLoading`, and it never provides an `originalUrl` here.
this.setTitleUsingUrl(