Commit c1fad3cd authored by ma1's avatar ma1 Committed by Pier Angelo Vendrame
Browse files

fixup! BB 42220: Allow for more file types to be forced-inline.

This reverts commit 90dbc945.
parent d1d5dbd2
Loading
Loading
Loading
Loading
+0 −6
Changes for modules/libpref/init/StaticPrefList.yaml: 0 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -1634,12 +1634,6 @@
  value: false
  mirror: always
# tor-browser#42220
- name: browser.download.ignore_content_disposition
  type: bool
  value: true
  mirror: always
# See bug 1811830
- name: browser.download.force_save_internally_handled_attachments
  type: bool
+3 −7
Changes for uriloader/base/nsURILoader.cpp: 3 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -432,21 +432,17 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest* request) {

  bool maybeForceInternalHandling =
      forceExternalHandling &&
      (mozilla::StaticPrefs::browser_download_open_pdf_attachments_inline() ||
       mozilla::StaticPrefs::browser_download_ignore_content_disposition());
      mozilla::StaticPrefs::browser_download_open_pdf_attachments_inline();

  // Check if this is a PDF which should be opened internally. We also handle
  // octet-streams that look like they might be PDFs based on their extension.
  if (maybeForceInternalHandling) {
  if (maybeForceInternalHandling && IsContentPDF(aChannel, mContentType)) {
    // For a PDF, check if the preference is set that forces attachments to be
    // opened inline. If so, treat it as a non-attachment by clearing
    // 'forceExternalHandling' again. This allows it open a PDF directly
    // instead of downloading it first. It may still end up being handled by
    // a helper app depending anyway on the later checks.
    nsCString mimeType = IsContentPDF(aChannel, mContentType)
                             ? nsLiteralCString(APPLICATION_PDF)
                             : mContentType;
    auto result = ShouldHandleExternally(mimeType);
    auto result = ShouldHandleExternally(nsLiteralCString(APPLICATION_PDF));
    if (result.isErr()) {
      return result.unwrapErr();
    }