Skip to content

Commit

Permalink
Merge pull request mozilla#6201 from Rob--W/crx-dont-force-no-download
Browse files Browse the repository at this point in the history
[CRX] Respect download requests in main frame
  • Loading branch information
timvandermeij committed Jul 18, 2015
2 parents 7065c1b + ffbe669 commit 91ab010
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions extensions/chromium/pdfHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@ function isPdfDownloadable(details) {
if (details.url.indexOf('pdfjs.action=download') >= 0) {
return true;
}
// Display the PDF viewer regardless of the Content-Disposition header
// if the file is displayed in the main frame.
if (details.type === 'main_frame') {
// Display the PDF viewer regardless of the Content-Disposition header if the
// file is displayed in the main frame, since most often users want to view
// a PDF, and servers are often misconfigured.
// If the query string contains "=download", do not unconditionally force the
// viewer to open the PDF, but first check whether the Content-Disposition
// header specifies an attachment. This allows sites like Google Drive to
// operate correctly (#6106).
if (details.type === 'main_frame' &&
details.url.indexOf('=download') === -1) {
return false;
}
var cdHeader = (details.responseHeaders &&
Expand Down

0 comments on commit 91ab010

Please sign in to comment.