Skip to content

PDF viewer doesn't open from mail attachments pane #2

@dirkf

Description

@dirkf

Configuration

SM-2.49.4/5, LXLE 16.04 Linux i686
PDF.js 2.2.253

Steps to reproduce the problem:

  1. Set emails to view as text
  2. Edit>Preferences>Browser>Helper Applications should show "PDF: Always Ask"
  3. Open an email with attached PDF file
  4. Open (double-click or context-menu>Open) the attachment
  5. Nothing happens
  6. Instead try context-menu>Open With...>Document Viewer
  7. The attached file opens in Document Viewer.

What is the expected behaviour?

At step 5, a browser tab with a pdf.js view of the attached file should open.

What went wrong?

There's an invalid assumption in PdfstreamConversion.jsm. When step 5 fails, the Error Console fingers this fragment (lines 941...)

    aRequest.QueryInterface(Ci.nsIChannel);

/*943*/    aRequest.QueryInterface(Ci.nsIWritablePropertyBag);

    var contentDispositionFilename;
    try {
      contentDispositionFilename = aRequest.contentDispositionFilename;
    } catch (e) {}

    // Change the content type so we don't get stuck in a loop.
/*951*/    aRequest.setProperty("contentType", aRequest.contentType);
    aRequest.contentType = "text/html";

Line 943 fails (and the viewer then fails to open) because aRequest in this context doesn't support the nsIWritablePropertyBag interface, as logged in the Console.

However line 951 expects that it does. If both lines are removed, the viewer works as expected, despite the comment above: not just in the test case, but generally. I couldn't find any code in the viewer that might retrieve the contentType stashed at line 951.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions