Commit Graph

624 Commits

Author SHA1 Message Date
Nils Maier
16a1c38c1f Download: Use the typed array view instead of the buffer
The ArrayBuffer holding the data might be over-sized in case the
data length was not known during the transfer, e.g. when using a
Content-Encoding other than `identity` or when using a
Transfer-Encoding.
Only the view into the buffer has the correct length then, hence
always use the view directly when creating the blob URI for the
download, instead of the over-sized underlying buffer.

Closes GH-3627
Closes GH-3634
2013-09-01 16:45:26 +02:00
Brendan Dahl
427dd3948b Merge pull request #3569 from yurydelendik/bug900193
Fixes canvas alignment for small scale...
2013-08-26 10:52:47 -07:00
Brendan Dahl
e2ca1d0e5e Merge pull request #3613 from Snuffleupagus/remove-dead-find-code
Remove old dead find related code from viewer.js
2013-08-26 10:46:58 -07:00
Brendan Dahl
e9a3ac175c Merge pull request #3612 from Snuffleupagus/fix-find-when-loading-new-file
Prevent searching from breaking when opening a new file in the web viewer
2013-08-26 10:44:54 -07:00
Brendan Dahl
c17a7c9d04 Merge pull request #3505 from Snuffleupagus/move-ThumbnailView
Move ThumbnailView from viewer.js to its own file
2013-08-26 10:30:24 -07:00
Jonas
8892beeb08 Remove old dead find related code from viewer.js 2013-08-23 13:08:51 +02:00
Jonas
baba41f702 Prevent searching from breaking when opening a new file in the web viewer 2013-08-23 11:08:03 +02:00
Yury Delendik
bde863a8ac Merge pull request #3573 from Rob--W/crx-view-local-files
[CRX] Fixes to view local files again
2013-08-21 07:37:32 -07:00
Yury Delendik
ba23a9e8f9 Adds initial telemetry probes 2013-08-16 09:53:05 -05:00
Rob Wu
a4dd4b1789 [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.
2013-08-14 23:50:51 +02:00
Yury Delendik
86077810b0 Fixes canvas alignment for small scale and scale adjustment after Cmd+0 2013-08-13 18:45:06 -05:00
Brendan Dahl
5ecce4996b Split files into worker and main thread pieces. 2013-08-12 10:48:06 -07:00
Tim van der Meij
75035a2970 Named actions implementation 2013-08-08 21:59:59 +02:00
Jonas
d99879bfbf Move ThumbnailView from viewer.js to its own file 2013-08-06 22:19:03 +02:00
Brendan Dahl
820145da05 Merge pull request #3523 from yurydelendik/csp
Bug 889320 - [CSP] removes inlined styles and scripts, also HTTP headers
2013-08-06 13:10:33 -07:00
Brendan Dahl
d85e38d629 Fix intermittent blank page on fast zoom. 2013-08-05 16:34:57 -07:00
Yury Delendik
bea2e41e45 Backout of #3513 (except formatting) 2013-08-05 07:52:24 -05:00
Yury Delendik
7435b267f9 Merge pull request #3535 from Snuffleupagus/issue-3534
Fix issue with initial scale when opening a new file and another one is already loaded
2013-08-04 17:29:36 -07:00
Brendan Dahl
65fd2c77d0 Merge pull request #3513 from Snuffleupagus/keep-scroll-position-on-zoom-v2
Keep current scroll position when zooming the document
2013-08-02 15:22:52 -07:00
Jonas
8170d67a6b Fix issue with initial scale when opening a new file and another one is already loaded 2013-08-02 16:09:33 +02:00
Brendan Dahl
bf72bc94e2 Incrementally render by sending the operator list by chunks as they're ready. 2013-07-31 11:17:36 -07:00
Jonas
edf3163fa6 Keep current scroll position when zooming the document 2013-07-31 19:43:03 +02:00
Yury Delendik
99c9079f54 [CSP] removes inlined styles and scripts 2013-07-30 21:00:37 -05:00
Brendan Dahl
81308d153d Merge pull request #3516 from Rob--W/crx-dont-parse-querystring
[CRX] Get pdf name from URL instead of query string
2013-07-29 10:22:14 -07:00
Rob Wu
b2b2e85ba2 [CRX] Get pdf name from URL instead of querystring 2013-07-27 12:31:51 +02:00
Jonas
d99b7753d6 Check if viewer is embedded only once and cache the result 2013-07-20 16:33:40 +02:00
Jonas
8708f8beb5 Fixes regression that cause scrolling using spacebar to break in Firefox 2013-07-19 22:09:37 +02:00
Yury Delendik
c6e698e21f Merge pull request #3332 from Snuffleupagus/fix-loadingBar
Fix the positioning of the progressive loadingBar
2013-07-18 09:39:25 -07:00
Jonas
4890c5d017 Fix the positioning of the progressive loadingBar 2013-07-18 18:28:59 +02:00
Jonas
09e0c9b65d Move PDFHistory from viewer.js to its own file 2013-07-18 17:18:27 +02:00
Tim van der Meij
343bb7488a Presentation mode shortcut implementation 2013-07-18 16:28:06 +02:00
Yury Delendik
984b9bf78b Merge pull request #3486 from Rob--W/csp-unsafe-inline
Remove all inline JavaScript from viewer.html to comply with CSP unsafe-inline and correct error textarea's height
2013-07-18 06:08:39 -07:00
Tim van der Meij
22120005b7 Removing code duplication 2013-07-18 13:37:55 +02:00
Rob Wu
d5e16ab85c Viewer: Remove inline events; set height on error
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...)
2013-07-18 10:38:44 +02:00
Brendan Dahl
5fa609584e Merge pull request #3449 from Snuffleupagus/history-remove-beforeunload
[Browsing history] Remove 'beforeunload' to enable caching and prevent duplicate entries
2013-07-17 16:03:12 -07:00
Brendan Dahl
330f6212ba Merge pull request #3341 from Snuffleupagus/navigateTo-fix
Tweak the behaviour of navigateTo during document load
2013-07-15 16:16:46 -07:00
Yury Delendik
ef658bf5f1 Refactoring download button logic 2013-07-12 13:14:13 -05:00
Brendan Dahl
077f08fa6d Merge pull request #3456 from brendandahl/cap-image-size
Limit image size to 1024*1024 for b2g.
2013-07-11 11:44:51 -07:00
Rob Wu
e583070deb Download PDF from cache for IE10 / IE11
IE9 falls back to downloading from the original URL.
2013-07-10 22:07:23 +02:00
Rob Wu
84ae29c21d Improve suggested filename on download
For all of the following URLs, "file.pdf" will be suggested:
http://.../file.pdf
http://.../download.aspx?file=file.pdf&whatever
http://.../get.pdf?name=file.pdf&whatever
http://.../single-page-app#view=file.pdf
http://.../download.aspx?file=%2Fpath%2Fto%2Ffile.pdf&whatever

Fixes #3161
2013-07-10 21:50:56 +02:00
Brendan Dahl
bcc085ec52 Limit image size to 1024*1024 for b2g. 2013-07-10 09:52:37 -07:00
Rob Wu
69a64d45bc Put URL = URL || webkitURL in compatibility.js
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
2013-07-09 22:54:12 +02:00
Rob Wu
4ffc408512 Download PDF from cache for non-Firefox add-on
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
2013-07-09 22:54:12 +02:00
Rob Wu
cc04cf5d1f Configurable IMAGE_DIR for annotations
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
2013-07-09 16:24:25 +02:00
Jonas
db1d8cf76e [Browsing history] Remove 'beforeunload' to enable caching and prevent duplicate entries 2013-07-08 16:16:43 +02:00
Jonas
94be9c07f1 Enable changing page using Shift+Spacebar in presentation mode 2013-06-26 22:46:34 +02:00
Jonas
5c93ec3a2c Check if the browser supports manipulation of the history 2013-06-24 20:46:13 +02:00
Jonas
6867083c07 Fix typo causing destinations using '/FitR' to fail 2013-06-24 00:39:28 +02:00
Vivin Paliath
83b6eaed16 pr #3356
squashing commits.
2013-06-18 09:05:55 -07:00
Yury Delendik
167ac98f9c Fixes presentation mode page 2013-06-12 16:18:21 -05:00