Use the native URL.createObjectURL method in web/pdf_attachment_viewer.js

There's no particular reason for using the PDF.js helper function `createObjectURL` here, given that the relevant code-path is already guarded by multiple "disableCreateObjectURL" option checks.
This commit is contained in:
Jonas Jenwald 2020-04-24 11:50:58 +02:00
parent 0baabf69db
commit cd666e3a37

View File

@ -14,7 +14,6 @@
*/ */
import { import {
createObjectURL,
createPromiseCapability, createPromiseCapability,
getFilenameFromUrl, getFilenameFromUrl,
removeNullCharacters, removeNullCharacters,
@ -86,7 +85,9 @@ class PDFAttachmentViewer {
let blobUrl; let blobUrl;
button.onclick = function () { button.onclick = function () {
if (!blobUrl) { if (!blobUrl) {
blobUrl = createObjectURL(content, "application/pdf"); blobUrl = URL.createObjectURL(
new Blob([content], { type: "application/pdf" })
);
} }
let viewerUrl; let viewerUrl;
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) { if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {