[CRX] Fixes to view local files again

pdfHandler-local.js references the isPdfDownloadable function from
pdfHandler.js, but the function didn't expect that the responseHeaders
property was absent. Added a check to prevent a runtime error when a
local file is displayed in a frame, and show local PDF files again.

Local files are rendered on the chrome-extension:-protocol. The previous
method of getting the PDF URL was incorrect, this has been fixed as well.
This commit is contained in:
Rob Wu 2013-08-14 23:36:40 +02:00
parent e5cd027dce
commit a4dd4b1789
2 changed files with 9 additions and 3 deletions

View file

@ -31,8 +31,8 @@ function isPdfDownloadable(details) {
// if the file is displayed in the main frame.
if (details.type == 'main_frame')
return false;
var cdHeader = getHeaderFromHeaders(details.responseHeaders,
'content-disposition');
var cdHeader = details.responseHeaders &&
getHeaderFromHeaders(details.responseHeaders, 'content-disposition');
return cdHeader && /^attachment/i.test(cdHeader.value);
}