Commit d3f486b8 authored by Ryan VanderMeulen's avatar Ryan VanderMeulen
Browse files

Bug 1632644 - Allow PDF attachments to, once again, be opened directly in the...

Bug 1632644 - Allow PDF attachments to, once again, be opened directly in the browser. r=bdahl, a=RyanVM

Backport of upstream commit https://github.com/mozilla/pdf.js/commit/0960e6c0b5f2bdb45b8f4d280a3353ed230f448a

Differential Revision: https://phabricator.services.mozilla.com/D76200
parent 6c7fc982
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1783,7 +1783,7 @@ function loadAndEnablePDFBug(enabledTabs) {
function webViewerInitialized() {
  const appConfig = PDFViewerApplication.appConfig;
  let file;
  file = window.location.href.split("#")[0];
  file = window.location.href;
  appConfig.toolbar.openFile.setAttribute("hidden", "true");
  appConfig.secondaryToolbar.openFileButton.setAttribute("hidden", "true");

@@ -4693,7 +4693,7 @@ class PDFAttachmentViewer {
      }

      let viewerUrl;
      viewerUrl = blobUrl + "?" + encodeURIComponent(filename);
      viewerUrl = blobUrl + "#filename=" + encodeURIComponent(filename);
      window.open(viewerUrl);
      return false;
    };
@@ -4873,7 +4873,7 @@ class PDFDocumentProperties {
        metadata,
        contentDispositionFilename
      }) => {
        return Promise.all([info, metadata, contentDispositionFilename || (0, _ui_utils.getPDFFileNameFromURL)(this.url || ""), this._parseFileSize(this.maybeFileSize), this._parseDate(info.CreationDate), this._parseDate(info.ModDate), this.pdfDocument.getPage(currentPageNumber).then(pdfPage => {
        return Promise.all([info, metadata, contentDispositionFilename || (0, _ui_utils.getPDFFileNameFromURL)(this.url), this._parseFileSize(this.maybeFileSize), this._parseDate(info.CreationDate), this._parseDate(info.ModDate), this.pdfDocument.getPage(currentPageNumber).then(pdfPage => {
          return this._parsePageSize((0, _ui_utils.getPageSizeInches)(pdfPage), pagesRotation);
        }), this._parseLinearization(info.IsLinearized)]);
      }).then(([info, metadata, fileName, fileSize, creationDate, modDate, pageSize, isLinearized]) => {