Merge pull request #17363 from Snuffleupagus/issue-17353
[Firefox] Restore opening of PDF attachments (issue 17353, bug 1867764)
This commit is contained in:
commit
a1d84f5ecf
@ -112,9 +112,11 @@ class DownloadManager {
|
|||||||
this.#openBlobUrls.set(data, blobUrl);
|
this.#openBlobUrls.set(data, blobUrl);
|
||||||
}
|
}
|
||||||
// Let Firefox's content handler catch the URL and display the PDF.
|
// Let Firefox's content handler catch the URL and display the PDF.
|
||||||
let viewerUrl = blobUrl + "?filename=" + encodeURIComponent(filename);
|
// NOTE: This cannot use a query string for the filename, see
|
||||||
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1632644#c5
|
||||||
|
let viewerUrl = blobUrl + "#filename=" + encodeURIComponent(filename);
|
||||||
if (dest) {
|
if (dest) {
|
||||||
viewerUrl += `#${escape(dest)}`;
|
viewerUrl += `&filedest=${escape(dest)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -431,7 +431,19 @@ class PDFLinkService {
|
|||||||
if (params.has("nameddest")) {
|
if (params.has("nameddest")) {
|
||||||
this.goToDestination(params.get("nameddest"));
|
this.goToDestination(params.get("nameddest"));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
|
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Support opening of PDF attachments in the Firefox PDF Viewer,
|
||||||
|
// which uses a couple of non-standard hash parameters; refer to
|
||||||
|
// `DownloadManager.openOrDownloadData` in the firefoxcom.js file.
|
||||||
|
if (!params.has("filename") || !params.has("filedest")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hash = params.get("filedest");
|
||||||
|
}
|
||||||
|
|
||||||
// Named (or explicit) destination.
|
// Named (or explicit) destination.
|
||||||
dest = unescape(hash);
|
dest = unescape(hash);
|
||||||
try {
|
try {
|
||||||
@ -452,12 +464,9 @@ class PDFLinkService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.error(
|
console.error(
|
||||||
`PDFLinkService.setHash: "${unescape(
|
`PDFLinkService.setHash: "${unescape(hash)}" is not a valid destination.`
|
||||||
hash
|
|
||||||
)}" is not a valid destination.`
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} action
|
* @param {string} action
|
||||||
|
Loading…
Reference in New Issue
Block a user