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.
Move inline event handlers to viewer.js to comply with a
Content-Security-Policy where directive "unsafe-inline" is not set.
Change textarea.rows = <number of newlines> to
textarea.style.height = textarea.scrollHeight.
(The former is extremely unreliable; consider long lines...)
Declares the URL variable globally. If the feature is not
supported, the variable will still be declared, but have the
"undefined" value.
Supported by:
- Firefox 4
Firefox 21 in Web worker
- Chrome 8 (prefixed as webkitURL), 23+ unprefixed
Chrome 10 (prefixed as webkitURL) in Web Worker, 23+ unprefixed
- Opera 15
Opera 15 in Web Worker
- Internet Explorer 10
Internet Explorer 11 in Web Worker
- Safari 6 (prefixed as webkitURL)
Safari 6 (prefixed as webkitURL) in Web Worker
This feature relies on URL.createObjectURL, which is supported by
- Firefox 4
- Chrome 8
- Opera 15
- Internet Explorer 10
If the feature is missing, it falls back to downloading from the server.
The environment-specific code are put in ifdef's. Two methods are
defined:
- noData
This function is used as a fallback in case of failure, it triggers
a download directly from the server.
- triggerSaveAs(String url, optional String blob)
This function attempts to show a Save As dialog for a given URL.
It attempts to use the a.download attribute, if available, and
falls back to window.open(<url>, '_parent') if unavailable.
See also http://caniuse.com/download
The Chrome extension activates PDF.js by inserting the script tags
in a document whose URL and location origin is identical to the PDF
file.
Because of this, the path './images/' was resolved relatively to the
location of the PDF file instead of the extension.
To fix this, the IMAGE_DIR constant is moved outside the local scope,
to allow extensions/chrome/insertviewer.js to override the value.
Originally, the IMAGE_DIR variable was a global variable, but commit
f8f4b3f45d moved the global variable
to the local scope, causing the extension to malfunction.
Impact: low, the only consequence is that some rarely used images
were not visible.
Trivial test:
At the center of page 2, the annotation icon
(images/annotation-comment.svg) should be visible:
http://linorg.usp.br/CTAN/macros/latex/contrib/pdfcomment/doc/pdfcomment.pdf